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

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Tue Mar 22 04:27:32 EDT 2011


Author: ahocevar
Date: 2011-03-22 01:27:27 -0700 (Tue, 22 Mar 2011)
New Revision: 11719

Modified:
   trunk/openlayers/lib/OpenLayers/Strategy/BBOX.js
   trunk/openlayers/tests/Strategy/BBOX.html
Log:
making it so Strategy.BBOX receives options from layer.refresh(options). Thanks vmische for the tests. r=bartvde (closes #2171)

Modified: trunk/openlayers/lib/OpenLayers/Strategy/BBOX.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Strategy/BBOX.js	2011-03-22 08:15:48 UTC (rev 11718)
+++ trunk/openlayers/lib/OpenLayers/Strategy/BBOX.js	2011-03-22 08:27:27 UTC (rev 11719)
@@ -134,7 +134,7 @@
                                    this.invalidBounds(mapBounds))) {
             this.calculateBounds(mapBounds);
             this.resolution = this.layer.map.getResolution(); 
-            this.triggerRead();
+            this.triggerRead(options);
         }
     },
     
@@ -210,21 +210,25 @@
     /**
      * Method: triggerRead
      *
+     * Parameters:
+     * options - Additional options for the protocol's read method (optional)
+     *
      * Returns:
      * {<OpenLayers.Protocol.Response>} The protocol response object
      *      returned by the layer protocol.
      */
-    triggerRead: function() {
+    triggerRead: function(options) {
         if (this.response) {
             this.layer.protocol.abort(this.response);
             this.layer.events.triggerEvent("loadend");
         }
         this.layer.events.triggerEvent("loadstart");
-        this.response = this.layer.protocol.read({
-            filter: this.createFilter(),
-            callback: this.merge,
-            scope: this
-        });
+        this.response = this.layer.protocol.read(
+            OpenLayers.Util.applyDefaults({
+                filter: this.createFilter(),
+                callback: this.merge,
+                scope: this
+        }, options));
     },
  
     /**

Modified: trunk/openlayers/tests/Strategy/BBOX.html
===================================================================
--- trunk/openlayers/tests/Strategy/BBOX.html	2011-03-22 08:15:48 UTC (rev 11718)
+++ trunk/openlayers/tests/Strategy/BBOX.html	2011-03-22 08:27:27 UTC (rev 11719)
@@ -87,7 +87,7 @@
     
     function test_events(t) {
         
-        t.plan(2);
+        t.plan(3);
         var log = {
             loadstart: 0,
             loadend: 0
@@ -117,6 +117,14 @@
         t.eq(log.loadstart, 1, "loadstart triggered");
         t.eq(log.loadend, 1, "loadend triggered");
         
+        log = {};
+        layer.protocol.read = function(obj) {
+            log.obj = obj;
+        }
+        layer.refresh({force: true, whee: 'chicken'});
+
+        t.eq(log.obj && log.obj.whee, "chicken", "properties passed to read on refresh correctly.");
+
         map.destroy();
         
     }



More information about the Commits mailing list