[OpenLayers-Commits] r11617 - in trunk/openlayers:
lib/OpenLayers/Strategy tests/Strategy
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Sat Mar 5 18:34:50 EST 2011
Author: bartvde
Date: 2011-03-05 15:34:44 -0800 (Sat, 05 Mar 2011)
New Revision: 11617
Modified:
trunk/openlayers/lib/OpenLayers/Strategy/BBOX.js
trunk/openlayers/tests/Strategy/BBOX.html
Log:
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)
Modified: trunk/openlayers/lib/OpenLayers/Strategy/BBOX.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Strategy/BBOX.js 2011-03-05 21:17:02 UTC (rev 11616)
+++ trunk/openlayers/lib/OpenLayers/Strategy/BBOX.js 2011-03-05 23:34:44 UTC (rev 11617)
@@ -153,7 +153,8 @@
return null;
}
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(
this.layer.map.getProjectionObject(), this.layer.projection
);
Modified: trunk/openlayers/tests/Strategy/BBOX.html
===================================================================
--- trunk/openlayers/tests/Strategy/BBOX.html 2011-03-05 21:17:02 UTC (rev 11616)
+++ trunk/openlayers/tests/Strategy/BBOX.html 2011-03-05 23:34:44 UTC (rev 11617)
@@ -284,8 +284,17 @@
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");
map.addLayer(dummy);
+ map.addLayer(layerReproject);
map.setCenter(new OpenLayers.LonLat(0, 0));
map.addLayer(layer);
More information about the Commits
mailing list