Skip to content

Loading…

Don't overwrite params, and use params in Layer.ArcGISCache #259

Merged
merged 1 commit into from

2 participants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
View
4 lib/OpenLayers/Layer/ArcGISCache.js
@@ -452,7 +452,9 @@ OpenLayers.Layer.ArcGISCache = OpenLayers.Class(OpenLayers.Layer.XYZ, {
// Write the values into our formatted url
url = OpenLayers.String.format(url, {'x': x, 'y': y, 'z': z});
- return url;
+ return OpenLayers.Util.urlAppend(
+ url, OpenLayers.Util.getParameterString(this.params)
+ );
},
/**
View
4 lib/OpenLayers/Layer/HTTPRequest.js
@@ -60,7 +60,9 @@ OpenLayers.Layer.HTTPRequest = OpenLayers.Class(OpenLayers.Layer, {
initialize: function(name, url, params, options) {
OpenLayers.Layer.prototype.initialize.apply(this, [name, options]);
this.url = url;
- this.params = OpenLayers.Util.extend( {}, params);
+ if (!this.params) {
+ this.params = OpenLayers.Util.extend({}, params);
+ }
},
/**
View
7 tests/Layer/ArcGISCache.html
@@ -53,7 +53,8 @@
//initialize the layer using the JSON object from an arcgis server
//SEE: ArcGISCache.json
var layer = new OpenLayers.Layer.ArcGISCache(name, url, {
- layerInfo: layerInfo
+ layerInfo: layerInfo,
+ params: {foo: "bar"}
});
var map = new OpenLayers.Map('map', {
maxExtent: layer.maxExtent,
@@ -98,14 +99,14 @@
}
];
- t.plan( urlSets.length );
+ t.plan( urlSets.length );
for(var i=0;i<urlSets.length;i++)
{
var o = urlSets[i];
map.zoomToExtent(o.bounds, true);
var resultUrl = layer.getURL(o.bounds);
- t.ok( resultUrl == o.url, "correct tile returned for " + o.bounds);
+ t.ok( resultUrl == o.url + "?foo=bar", "correct tile returned for " + o.bounds);
}
}
View
9 tests/Layer/HTTPRequest.html
@@ -12,7 +12,7 @@
var options = { chicken: 151, foo: "bar" };
function test_Layer_HTTPRequest_constructor (t) {
- t.plan( 5 );
+ t.plan( 6 );
layer = new OpenLayers.Layer.HTTPRequest(name, url, params, options);
@@ -27,8 +27,11 @@
t.ok( ((layer.params["map"] == '/mapdata/vmap_wms.map') &&
(layer.params["layers"] == "basic") &&
(layer.params["format"] == "image/png")), "layer.params correctly set" );
-
-
+
+ layer = new OpenLayers.Layer.HTTPRequest(name, url, null, {params: params});
+ t.ok( ((layer.params["map"] == '/mapdata/vmap_wms.map') &&
+ (layer.params["layers"] == "basic") &&
+ (layer.params["format"] == "image/png")), "layer.params correctly set from options" );
}
function test_Layer_HTTPRequest_clone (t) {
Something went wrong with that request. Please try again.