need to make WMS & WFS case-independent. I dont know why I chose to move them all to uppercase instead of lowercase, but I did. This required changing the test cases and the 'srs' property which is set in Grid. Personally, I dont think that is the best place to set it, but so be it jedi. As long as I have the mic, i'd add that having 'projection' stored in both map and layer objects seems a bit redundant as well.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@493 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-06-01 11:54:31 +00:00
parent aa4d877688
commit 77c168462b
4 changed files with 22 additions and 12 deletions

View File

@@ -220,7 +220,7 @@ OpenLayers.Layer.Grid.prototype = Object.extend( new OpenLayers.Layer(), {
*/
getFullRequestString:function(params) {
var requestString = "";
this.params.srs = this.projection;
this.params.SRS = this.projection;
// concat tile params with layer params and convert to string
var allParams = Object.extend(params, this.params);
var paramsString = OpenLayers.Util.getParameterString(allParams);

View File

@@ -31,13 +31,18 @@ OpenLayers.Layer.WFS.prototype =
var newArguments = new Array();
if (arguments.length > 0) {
//uppercase params
params = OpenLayers.Util.upperCaseObject(params);
newArguments.push(name, url, params);
}
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
OpenLayers.Layer.Markers.prototype.initialize.apply(this, newArguments);
if (arguments.length > 0) {
OpenLayers.Util.applyDefaults(this.params, this.DEFAULT_PARAMS);
OpenLayers.Util.applyDefaults(
this.params,
OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS)
);
}
},
@@ -78,7 +83,7 @@ OpenLayers.Layer.WFS.prototype =
*/
addTile:function(bounds, position) {
url = this.getFullRequestString(
{ bbox:bounds.toBBOX() });
{ BBOX:bounds.toBBOX() });
var tile = new OpenLayers.Tile.WFS(this, position, bounds,
url, this.tileSize);
tile.draw();

View File

@@ -25,12 +25,17 @@ OpenLayers.Layer.WMS.prototype =
initialize: function(name, url, params) {
var newArguments = new Array();
if (arguments.length > 0) {
//uppercase params
params = OpenLayers.Util.upperCaseObject(params);
newArguments.push(name, url, params);
}
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
if (arguments.length > 0) {
OpenLayers.Util.applyDefaults(this.params, this.DEFAULT_PARAMS);
OpenLayers.Util.applyDefaults(
this.params,
OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS)
);
}
},
@@ -62,9 +67,9 @@ OpenLayers.Layer.WMS.prototype =
*/
addTile:function(bounds,position) {
url = this.getFullRequestString(
{bbox:bounds.toBBOX(),
width:this.tileSize.w,
height:this.tileSize.h});
{BBOX:bounds.toBBOX(),
WIDTH:this.tileSize.w,
HEIGHT:this.tileSize.h});
var tile = new OpenLayers.Tile.Image(this, position, bounds,
url, this.tileSize);
tile.draw();

View File

@@ -12,9 +12,9 @@
t.ok( layer instanceof OpenLayers.Layer.WMS, "new OpenLayers.Layer.WMS returns object" );
t.eq( layer.name, "Test Layer", "layer.name is correct" );
t.eq( layer.url, "http://octo.metacarta.com/cgi-bin/mapserv", "layer.url is correct" );
t.eq( layer.params.map, "/mapdata/vmap_wms.map", "layer.params.map is correct" );
t.eq( layer.params.format, "image/png", "layer.params.format is correctly overridden" );
t.eq( layer.params.exceptions, "application/vnd.ogc.se_inimage",
t.eq( layer.params.MAP, "/mapdata/vmap_wms.map", "layer.params.map is correct" );
t.eq( layer.params.FORMAT, "image/png", "layer.params.format is correctly overridden" );
t.eq( layer.params.EXCEPTIONS, "application/vnd.ogc.se_inimage",
"other default layer.params are set correctly" );
}
function test_02_Layer_WMS_addtile (t) {
@@ -24,14 +24,14 @@
map.addLayer(layer);
var pixel = new OpenLayers.Pixel(5,6);
var tile = layer.addTile(new OpenLayers.Bounds(1,2,3,4), pixel);
t.eq( tile.img.src, "http://octo.metacarta.com/cgi-bin/mapserv?bbox=1,2,3,4&width=256&height=256&map=/mapdata/vmap_wms.map&layers=basic&format=image/jpeg&service=WMS&version=1.1.1&request=GetMap&styles=&exceptions=application/vnd.ogc.se_inimage&srs=EPSG:4326", "image src is created correctly via addtile" );
t.eq( tile.img.src, "http://octo.metacarta.com/cgi-bin/mapserv?BBOX=1,2,3,4&WIDTH=256&HEIGHT=256&MAP=/mapdata/vmap_wms.map&LAYERS=basic&FORMAT=image/jpeg&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&SRS=EPSG:4326", "image src is created correctly via addtile" );
t.eq( tile.img.style.top, "6px", "image top is set correctly via addtile" );
t.eq( tile.img.style.left, "5px", "image top is set correctly via addtile" );
if (!isMozilla)
t.ok( true, "skipping element test outside of Mozilla");
else
t.ok( layer.div.firstChild instanceof HTMLImageElement, "div first child is an image object" );
t.eq( layer.div.firstChild.src, "http://octo.metacarta.com/cgi-bin/mapserv?bbox=1,2,3,4&width=256&height=256&map=/mapdata/vmap_wms.map&layers=basic&format=image/jpeg&service=WMS&version=1.1.1&request=GetMap&styles=&exceptions=application/vnd.ogc.se_inimage&srs=EPSG:4326", "div first child is correct image object" );
t.eq( layer.div.firstChild.src, "http://octo.metacarta.com/cgi-bin/mapserv?BBOX=1,2,3,4&WIDTH=256&HEIGHT=256&MAP=/mapdata/vmap_wms.map&LAYERS=basic&FORMAT=image/jpeg&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&SRS=EPSG:4326", "div first child is correct image object" );
var pos = tile.getPosition();
t.eq( pos.toString(), "x=5,y=6", "Position of tile is set correctly." );
}