[OpenLayers-Commits] r12126 - in trunk/openlayers: lib/OpenLayers/Strategy tests/Strategy

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Fri Jun 24 14:21:50 EDT 2011


Author: bartvde
Date: 2011-06-24 11:21:49 -0700 (Fri, 24 Jun 2011)
New Revision: 12126

Modified:
   trunk/openlayers/lib/OpenLayers/Strategy/BBOX.js
   trunk/openlayers/tests/Strategy/BBOX.html
Log:
BBOX Strategy is active for an inactive vector layer, r=pgiraud (pullup #3383)

Modified: trunk/openlayers/lib/OpenLayers/Strategy/BBOX.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Strategy/BBOX.js	2011-06-22 15:20:01 UTC (rev 12125)
+++ trunk/openlayers/lib/OpenLayers/Strategy/BBOX.js	2011-06-24 18:21:49 UTC (rev 12126)
@@ -87,7 +87,7 @@
                 "refresh": this.update,
                 scope: this
             });
-            if(this.layer.visibility == true) {
+            if(this.layer.visibility === true && this.layer.inRange === true) {
                 this.update();
             } else {
                 this.layer.events.on({

Modified: trunk/openlayers/tests/Strategy/BBOX.html
===================================================================
--- trunk/openlayers/tests/Strategy/BBOX.html	2011-06-22 15:20:01 UTC (rev 12125)
+++ trunk/openlayers/tests/Strategy/BBOX.html	2011-06-24 18:21:49 UTC (rev 12126)
@@ -280,7 +280,7 @@
 
     // Test fix for Ticket #3142
     function test_layerLoadedAfterBeingAdded(t) {
-        t.plan(1);
+        t.plan(2);
 
         var dummy = new OpenLayers.Layer(null, {isBaseLayer: true});
 
@@ -300,14 +300,23 @@
             projection: 'EPSG:900913'
         });
 
+        // Make sure that layers that are not in range don't request data
+        var layerOutOfRange = new OpenLayers.Layer.Vector(null, {
+            maxResolution: 1,
+            protocol: new OpenLayers.Protocol(),
+            strategies: [new OpenLayers.Strategy.BBOX()]
+        });
+
         var map = new OpenLayers.Map("map");
         map.addLayer(dummy);
         map.addLayer(layerReproject);
         map.setCenter(new OpenLayers.LonLat(0, 0));
         map.addLayer(layer);
-
+        map.addLayer(layerOutOfRange);
         // test that the strategy bounds were set
         t.ok(map.getExtent().equals(strategy.bounds), "[set center] bounds set to map extent");
+        t.eq(layerOutOfRange.strategies[0].bounds, null, "Data not requested if layer is out of range");
+        map.destroy();
     }
 
   </script>



More information about the Commits mailing list