diff --git a/lib/OpenLayers/Strategy/Fixed.js b/lib/OpenLayers/Strategy/Fixed.js index 5f1ee11663..2446368197 100644 --- a/lib/OpenLayers/Strategy/Fixed.js +++ b/lib/OpenLayers/Strategy/Fixed.js @@ -1,4 +1,4 @@ -/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for +/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for * full list of contributors). Published under the 2-clause BSD license. * See license.txt in the OpenLayers distribution or repository for the * full text of the license. */ @@ -42,7 +42,8 @@ OpenLayers.Strategy.Fixed = OpenLayers.Class(OpenLayers.Strategy, { * the strategy was already active. */ activate: function() { - if(OpenLayers.Strategy.prototype.activate.apply(this, arguments)) { + var activated = OpenLayers.Strategy.prototype.activate.call(this); + if(activated) { this.layer.events.on({ "refresh": this.load, scope: this @@ -55,9 +56,8 @@ OpenLayers.Strategy.Fixed = OpenLayers.Class(OpenLayers.Strategy, { scope: this }); } - return true; } - return false; + return activated; }, /** @@ -87,14 +87,13 @@ OpenLayers.Strategy.Fixed = OpenLayers.Class(OpenLayers.Strategy, { * options - {Object} options to pass to protocol read. */ load: function(options) { - var layer = this.layer; - layer.events.triggerEvent("loadstart", {filter: layer.filter}); - layer.protocol.read(OpenLayers.Util.applyDefaults({ - callback: OpenLayers.Function.bind(this.merge, this, - layer.map.getProjectionObject()), - filter: layer.filter + this.layer.events.triggerEvent("loadstart", {filter: this.layer.filter}); + this.layer.protocol.read(OpenLayers.Util.applyDefaults({ + callback: this.merge, + filter: this.layer.filter, + scope: this }, options)); - layer.events.un({ + this.layer.events.un({ "visibilitychanged": this.load, scope: this }); @@ -103,29 +102,33 @@ OpenLayers.Strategy.Fixed = OpenLayers.Class(OpenLayers.Strategy, { /** * Method: merge * Add all features to the layer. + * If the layer projection differs from the map projection, features + * will be transformed from the layer projection to the map projection. * * Parameters: - * mapProjection - {} the map projection * resp - {} The response object passed * by the protocol. */ - merge: function(mapProjection, resp) { - var layer = this.layer; - layer.destroyFeatures(); - var features = resp.features; - if (features && features.length > 0) { - if(!mapProjection.equals(layer.projection)) { - var geom; - for(var i=0, len=features.length; i 0) { + var remote = this.layer.projection; + var local = this.layer.map.getProjectionObject(); + if(!local.equals(remote)) { + var geom; + for(var i=0, len=features.length; i