fix up the case in which a vector layer needs to be reprojected and the map is not yet centered for the BBOX Strategy, thanks tschaub for the catch, p=vmische, r=me (closes #3142)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11617 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -153,7 +153,8 @@ OpenLayers.Strategy.BBOX = OpenLayers.Class(OpenLayers.Strategy, {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var bounds = this.layer.map.getExtent();
|
var bounds = this.layer.map.getExtent();
|
||||||
if(!this.layer.projection.equals(this.layer.map.getProjectionObject())) {
|
if(bounds && !this.layer.projection.equals(
|
||||||
|
this.layer.map.getProjectionObject())) {
|
||||||
bounds = bounds.clone().transform(
|
bounds = bounds.clone().transform(
|
||||||
this.layer.map.getProjectionObject(), this.layer.projection
|
this.layer.map.getProjectionObject(), this.layer.projection
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -284,8 +284,17 @@
|
|||||||
strategies: [strategy]
|
strategies: [strategy]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Make sure to test the case of a vector layer needing to be
|
||||||
|
// reprojected while the map is not yet centered
|
||||||
|
var layerReproject = new OpenLayers.Layer.Vector(null, {
|
||||||
|
protocol: new OpenLayers.Protocol(),
|
||||||
|
strategies: [new OpenLayers.Strategy.BBOX()],
|
||||||
|
projection: 'EPSG:900913'
|
||||||
|
});
|
||||||
|
|
||||||
var map = new OpenLayers.Map("map");
|
var map = new OpenLayers.Map("map");
|
||||||
map.addLayer(dummy);
|
map.addLayer(dummy);
|
||||||
|
map.addLayer(layerReproject);
|
||||||
map.setCenter(new OpenLayers.LonLat(0, 0));
|
map.setCenter(new OpenLayers.LonLat(0, 0));
|
||||||
map.addLayer(layer);
|
map.addLayer(layer);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user