From cdd6acc413edca5721e0df72e50819ab61518340 Mon Sep 17 00:00:00 2001 From: euzuro Date: Thu, 5 Jul 2007 14:24:15 +0000 Subject: [PATCH] fix for #800 - the mergeNewParams function is now simplified. the only time it need be overridden now is in WMS, which mandates that all parameters should be uppercased. thanks for the review and the added test, tim. git-svn-id: http://svn.openlayers.org/trunk/openlayers@3584 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Layer/Grid.js | 17 ----------------- lib/OpenLayers/Layer/HTTPRequest.js | 1 + lib/OpenLayers/Layer/MapServer/Untiled.js | 15 +-------------- lib/OpenLayers/Layer/WFS.js | 2 -- lib/OpenLayers/Layer/WMS/Untiled.js | 15 --------------- tests/Layer/test_HTTPRequest.html | 7 ++++++- 6 files changed, 8 insertions(+), 49 deletions(-) diff --git a/lib/OpenLayers/Layer/Grid.js b/lib/OpenLayers/Layer/Grid.js index 47c72fecb9..a0bcfb3c42 100644 --- a/lib/OpenLayers/Layer/Grid.js +++ b/lib/OpenLayers/Layer/Grid.js @@ -395,23 +395,6 @@ OpenLayers.Layer.Grid.prototype = addTile:function(bounds, position) { // Should be implemented by subclasses }, - - /** - * APIMethod: mergeNewParams - * Once params have been changed, we will need to re-init our tiles - * - * Parameters: - * newParams - {Object} Hashtable of new params to use - */ - mergeNewParams:function(newArguments) { - OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this, - [newArguments]); - - if (this.map != null) { - this._initTiles(); - } - }, - /** * Method: shiftRow diff --git a/lib/OpenLayers/Layer/HTTPRequest.js b/lib/OpenLayers/Layer/HTTPRequest.js index 30e6620678..b9d9fa6b29 100644 --- a/lib/OpenLayers/Layer/HTTPRequest.js +++ b/lib/OpenLayers/Layer/HTTPRequest.js @@ -115,6 +115,7 @@ OpenLayers.Layer.HTTPRequest.prototype = */ mergeNewParams:function(newParams) { this.params = OpenLayers.Util.extend(this.params, newParams); + this.redraw(); }, /** diff --git a/lib/OpenLayers/Layer/MapServer/Untiled.js b/lib/OpenLayers/Layer/MapServer/Untiled.js index eea7d050e1..c308244d7c 100644 --- a/lib/OpenLayers/Layer/MapServer/Untiled.js +++ b/lib/OpenLayers/Layer/MapServer/Untiled.js @@ -243,20 +243,7 @@ OpenLayers.Layer.MapServer.Untiled.prototype = OpenLayers.Layer.HTTPRequest.prototype.setUrl.apply(this, arguments); this.redraw(); }, - - /** - * APIMethod: mergeNewParams - * Once HTTPRequest has updated new params, reload the image div - * - * Parameters: - * newParams - {Object} - */ - mergeNewParams:function(newParams) { - OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this, - [newParams]); - this.redraw(); - }, - + /** * APIMethod: getFullRequestString * combine the layer's url with its params and these newParams. diff --git a/lib/OpenLayers/Layer/WFS.js b/lib/OpenLayers/Layer/WFS.js index 2295e84639..fac98c8c3a 100644 --- a/lib/OpenLayers/Layer/WFS.js +++ b/lib/OpenLayers/Layer/WFS.js @@ -248,8 +248,6 @@ OpenLayers.Layer.WFS.prototype = var newArguments = [upperParams]; OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this, newArguments); - //redraw - this.moveTo(null, true); }, /** diff --git a/lib/OpenLayers/Layer/WMS/Untiled.js b/lib/OpenLayers/Layer/WMS/Untiled.js index dc65c8b56a..a49270410a 100644 --- a/lib/OpenLayers/Layer/WMS/Untiled.js +++ b/lib/OpenLayers/Layer/WMS/Untiled.js @@ -259,21 +259,6 @@ OpenLayers.Layer.WMS.Untiled.prototype = OpenLayers.Layer.HTTPRequest.prototype.setUrl.apply(this, arguments); this.redraw(); }, - - /** - * APIMethod: mergeNewParams - * Once HTTPRequest has updated new params, reload the image div - * - * Parameters: - * newParams - {Object} - */ - mergeNewParams:function(newParams) { - var upperParams = OpenLayers.Util.upperCaseObject(newParams); - var newArguments = [upperParams]; - OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this, - newArguments); - this.redraw(); - }, /** * APIMethod: getFullRequestString diff --git a/tests/Layer/test_HTTPRequest.html b/tests/Layer/test_HTTPRequest.html index 3a8f23d90f..25798c9f6e 100644 --- a/tests/Layer/test_HTTPRequest.html +++ b/tests/Layer/test_HTTPRequest.html @@ -65,7 +65,7 @@ } function test_05_Layer_HTTPRequest_mergeNewParams (t) { - t.plan( 3 ); + t.plan( 4 ); layer = new OpenLayers.Layer.HTTPRequest(name, url, params, options); @@ -80,6 +80,11 @@ newParams.chickpeas = 151; t.eq( layer.params.chickpeas, "image/png", "mergeNewParams() makes clean copy of hash"); + + layer.redraw = function() { + t.ok(true, "layer.mergeNewParams calls layer.redraw"); + } + layer.mergeNewParams(); }