From bb1c61acc2b742790171b5085c192d8d3b1a9887 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Tue, 22 Mar 2011 08:27:27 +0000 Subject: [PATCH] making it so Strategy.BBOX receives options from layer.refresh(options). Thanks vmische for the tests. r=bartvde (closes #2171) git-svn-id: http://svn.openlayers.org/trunk/openlayers@11719 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Strategy/BBOX.js | 18 +++++++++++------- tests/Strategy/BBOX.html | 10 +++++++++- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/lib/OpenLayers/Strategy/BBOX.js b/lib/OpenLayers/Strategy/BBOX.js index 78f44f637e..54135af22d 100644 --- a/lib/OpenLayers/Strategy/BBOX.js +++ b/lib/OpenLayers/Strategy/BBOX.js @@ -134,7 +134,7 @@ OpenLayers.Strategy.BBOX = OpenLayers.Class(OpenLayers.Strategy, { this.invalidBounds(mapBounds))) { this.calculateBounds(mapBounds); this.resolution = this.layer.map.getResolution(); - this.triggerRead(); + this.triggerRead(options); } }, @@ -210,21 +210,25 @@ OpenLayers.Strategy.BBOX = OpenLayers.Class(OpenLayers.Strategy, { /** * Method: triggerRead * + * Parameters: + * options - Additional options for the protocol's read method (optional) + * * Returns: * {} 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)); }, /** diff --git a/tests/Strategy/BBOX.html b/tests/Strategy/BBOX.html index 746c915a33..dd0499297d 100644 --- a/tests/Strategy/BBOX.html +++ b/tests/Strategy/BBOX.html @@ -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(); }