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
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -115,6 +115,7 @@ OpenLayers.Layer.HTTPRequest.prototype =
|
||||
*/
|
||||
mergeNewParams:function(newParams) {
|
||||
this.params = OpenLayers.Util.extend(this.params, newParams);
|
||||
this.redraw();
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -248,8 +248,6 @@ OpenLayers.Layer.WFS.prototype =
|
||||
var newArguments = [upperParams];
|
||||
OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this,
|
||||
newArguments);
|
||||
//redraw
|
||||
this.moveTo(null, true);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user