From 0015331273bc4597c4515042db5c6522ab83b11b Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Mon, 17 Feb 2014 14:23:12 -0700 Subject: [PATCH] Provide a default style function --- src/ol/feature.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/ol/feature.js b/src/ol/feature.js index 3f69d4d8a0..642b602d80 100644 --- a/src/ol/feature.js +++ b/src/ol/feature.js @@ -7,6 +7,9 @@ goog.require('goog.events.EventType'); goog.require('goog.functions'); goog.require('ol.Object'); goog.require('ol.geom.Geometry'); +goog.require('ol.style.Circle'); +goog.require('ol.style.Fill'); +goog.require('ol.style.Stroke'); goog.require('ol.style.Style'); @@ -213,12 +216,35 @@ ol.feature.FeatureStyleFunction; /** + * Default style function for features. * @param {number} resolution Resolution. * @return {Array.} Style. * @this {ol.Feature} * @todo stability experimental */ -ol.feature.defaultFeatureStyleFunction = goog.functions.constant([]); +ol.feature.defaultFeatureStyleFunction = (function() { + var fill = new ol.style.Fill({ + color: 'rgba(255,255,255,0.4)' + }); + var stroke = new ol.style.Stroke({ + color: '#3399CC', + width: 1.25 + }); + var styles = [ + new ol.style.Style({ + image: new ol.style.Circle({ + fill: fill, + stroke: stroke, + radius: 5 + }), + fill: fill, + stroke: stroke + }) + ]; + return function(resolution) { + return styles; + }; +})(); /**