Commit a 'changeParams' method, along with test and example, to show how it would be possible to use WMS-T with changeParams. ChangeParams sets the new params, then recalls initTiles with the new params set.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@843 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2006-06-30 23:59:42 +00:00
parent c958f9f88a
commit 2117aa0539
4 changed files with 78 additions and 0 deletions
+15
View File
@@ -50,6 +50,21 @@
t.eq( layer.grid.length, 4, "Grid rows is correct." );
t.eq( layer.grid[0].length, 2, "Grid cols is correct." );
}
function test_03_Layer_WMS_changeParams (t) {
t.plan( 4 );
var map = new OpenLayers.Map($('map'));
layer = new OpenLayers.Layer.WMS('Test Layer', "http://octo.metacarta.com/cgi-bin/mapserv", {map: '/mapdata/vmap_wms.map', layers: 'basic', format: 'image/jpeg'});
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0),5);
t.eq( layer.params.MAP, "/mapdata/vmap_wms.map", "Map param set to original." );
layer.changeParams({'map':'newparam'});
t.eq( layer.params.MAP, "newparam", "Map param changed.");
layer.changeParams({'MAP':'newparam2'});
t.eq( layer.params.MAP, "newparam2", "Map param changed again with upper-case.");
var firstChild = layer.div.firstChild;
t.eq( firstChild.src, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=newparam2&LAYERS=basic&FORMAT=image/jpeg&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&SRS=EPSG:4326&BBOX=-11.25,11.25,0,22.5&WIDTH=256&HEIGHT=256", "div first child is correct image object after param change." );
}
function test_99_Layer_WMS_destroy (t) {