diff --git a/src/ol/featureoverlay.js b/src/ol/featureoverlay.js
index e19c922b87..09b7151342 100644
--- a/src/ol/featureoverlay.js
+++ b/src/ol/featureoverlay.js
@@ -10,7 +10,7 @@ goog.require('ol.CollectionEventType');
goog.require('ol.Feature');
goog.require('ol.render.EventType');
goog.require('ol.renderer.vector');
-goog.require('ol.style.defaults');
+goog.require('ol.style.Style');
@@ -74,7 +74,7 @@ ol.FeatureOverlay = function(opt_options) {
this.styleFunction_ = undefined;
this.setStyle(goog.isDef(options.style) ?
- options.style : ol.style.defaults.styleFunction);
+ options.style : ol.style.defaultStyleFunction);
if (goog.isDef(options.features)) {
if (goog.isArray(options.features)) {
@@ -168,7 +168,7 @@ ol.FeatureOverlay.prototype.handleMapPostCompose_ = function(event) {
}
var styleFunction = this.styleFunction_;
if (!goog.isDef(styleFunction)) {
- styleFunction = ol.style.defaults.styleFunction;
+ styleFunction = ol.style.defaultStyleFunction;
}
var replayGroup = /** @type {ol.render.IReplayGroup} */
(event.replayGroup);
diff --git a/src/ol/layer/vectorlayer.js b/src/ol/layer/vectorlayer.js
index 6a45fccb42..e7a9561967 100644
--- a/src/ol/layer/vectorlayer.js
+++ b/src/ol/layer/vectorlayer.js
@@ -3,7 +3,6 @@ goog.provide('ol.layer.Vector');
goog.require('goog.object');
goog.require('ol.layer.Layer');
goog.require('ol.style.Style');
-goog.require('ol.style.defaults');
/**
@@ -53,7 +52,7 @@ ol.layer.Vector = function(opt_options) {
this.styleFunction_ = undefined;
this.setStyle(goog.isDefAndNotNull(options.style) ?
- options.style : ol.style.defaults.styleFunction);
+ options.style : ol.style.defaultStyleFunction);
};
goog.inherits(ol.layer.Vector, ol.layer.Layer);
diff --git a/src/ol/source/imagevectorsource.js b/src/ol/source/imagevectorsource.js
index 81e1703c47..c73a0c8895 100644
--- a/src/ol/source/imagevectorsource.js
+++ b/src/ol/source/imagevectorsource.js
@@ -10,7 +10,7 @@ goog.require('ol.render.canvas.ReplayGroup');
goog.require('ol.renderer.vector');
goog.require('ol.source.ImageCanvas');
goog.require('ol.source.Vector');
-goog.require('ol.style.defaults');
+goog.require('ol.style.Style');
goog.require('ol.vec.Mat4');
@@ -46,7 +46,7 @@ ol.source.ImageVector = function(options) {
*/
this.styleFunction_ = goog.isDefAndNotNull(options.style) ?
ol.style.createStyleFunction(options.style) :
- ol.style.defaults.styleFunction;
+ ol.style.defaultStyleFunction;
/**
* @private
diff --git a/src/ol/style/defaultsstyle.js b/src/ol/style/defaultsstyle.js
deleted file mode 100644
index 67356e56a0..0000000000
--- a/src/ol/style/defaultsstyle.js
+++ /dev/null
@@ -1,43 +0,0 @@
-goog.provide('ol.style.defaults');
-
-goog.require('ol.style.Circle');
-goog.require('ol.style.Fill');
-goog.require('ol.style.Stroke');
-goog.require('ol.style.Style');
-
-
-/**
- * @param {ol.Feature} feature Feature.
- * @param {number} resolution Resolution.
- * @return {Array.
} Style.
- */
-ol.style.defaults.styleFunction = function(feature, resolution) {
- 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
- })
- ];
-
- // now that we've run it the first time,
- // replace the function with a constant version
- ol.style.defaults.styleFunction =
- /** @type {function(this:ol.Feature):Array.} */(
- function(resolution) {
- return styles;
- });
-
- return styles;
-};
diff --git a/src/ol/style/style.js b/src/ol/style/style.js
index 56f47263f9..b2aa63dabb 100644
--- a/src/ol/style/style.js
+++ b/src/ol/style/style.js
@@ -2,8 +2,10 @@ goog.provide('ol.style.Style');
goog.require('goog.asserts');
goog.require('goog.functions');
+goog.require('ol.style.Circle');
goog.require('ol.style.Fill');
goog.require('ol.style.Image');
+goog.require('ol.style.Stroke');
@@ -139,3 +141,40 @@ ol.style.createStyleFunction = function(obj) {
}
return styleFunction;
};
+
+
+/**
+ * @param {ol.Feature} feature Feature.
+ * @param {number} resolution Resolution.
+ * @return {Array.} Style.
+ */
+ol.style.defaultStyleFunction = function(feature, resolution) {
+ 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
+ })
+ ];
+
+ // now that we've run it the first time,
+ // replace the function with a constant version
+ ol.style.defaultStyleFunction =
+ /** @type {function(this:ol.Feature):Array.} */(
+ function(resolution) {
+ return styles;
+ });
+
+ return styles;
+};
diff --git a/test/spec/ol/layer/vectorlayer.test.js b/test/spec/ol/layer/vectorlayer.test.js
index d3eb586a7f..92e1d790b7 100644
--- a/test/spec/ol/layer/vectorlayer.test.js
+++ b/test/spec/ol/layer/vectorlayer.test.js
@@ -76,10 +76,10 @@ describe('ol.layer.Vector', function() {
var layer = new ol.layer.Vector({
source: source
});
- expect(layer.getStyleFunction()).to.be(ol.style.defaults.styleFunction);
+ expect(layer.getStyleFunction()).to.be(ol.style.defaultStyleFunction);
layer.setStyle(style);
expect(layer.getStyleFunction()).not.to.be(
- ol.style.defaults.styleFunction);
+ ol.style.defaultStyleFunction);
});
});
@@ -94,7 +94,7 @@ describe('ol.layer.Vector', function() {
source: source
});
- expect(layer.getStyle()).to.be(ol.style.defaults.styleFunction);
+ expect(layer.getStyle()).to.be(ol.style.defaultStyleFunction);
layer.setStyle(style);
expect(layer.getStyle()).to.be(style);
@@ -118,4 +118,3 @@ goog.require('ol.layer.Layer');
goog.require('ol.layer.Vector');
goog.require('ol.source.Vector');
goog.require('ol.style.Style');
-goog.require('ol.style.defaults');