Strategies that request data (fixed and bbox currently) should transform geometries when the layer projection is different than the map projection. This adds reprojection support to the Fixed and BBOX strategies. Given more strategies that request data, we will likely want to extract out the common parts. r=elemoine (closes #1841)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@8804 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -88,6 +88,17 @@ OpenLayers.Strategy.Fixed = OpenLayers.Class(OpenLayers.Strategy, {
|
||||
merge: function(resp) {
|
||||
var features = resp.features;
|
||||
if (features && features.length > 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<len; ++i) {
|
||||
geom = features[i].geometry;
|
||||
if(geom) {
|
||||
geom.transform(remote, local);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.layer.addFeatures(features);
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user