Allow for users to determine whether the bounding box should be encoded or

not on WMS and WFS layers. This change, by default, makes us compliant
with the WMS spec again.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@4038 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-08-24 23:50:43 +00:00
parent 42e4f72a9f
commit c8afa7222b
8 changed files with 112 additions and 6 deletions

View File

@@ -63,6 +63,45 @@
var tile = layer.addTile(new OpenLayers.Bounds(1,2,3,4), pixel);
tile.draw();
var img = tile.imgDiv;
var tParams = OpenLayers.Util.extend({},
OpenLayers.Util.upperCaseObject(params));
tParams = OpenLayers.Util.extend(tParams, {
SERVICE: "WMS", VERSION: "1.1.1",
REQUEST: "GetMap", STYLES: "",
EXCEPTIONS: "application/vnd.ogc.se_inimage",
SRS: "EPSG:4326", BBOX: [1,2,3,4],
WIDTH: "256", HEIGHT: "256"
});
t.eq( img.src,
url + "?" + OpenLayers.Util.getParameterString(tParams),
"image src is created correctly via addtile" );
t.eq( tile.frame.style.top, "6px", "image top is set correctly via addtile" );
t.eq( tile.frame.style.left, "5px", "image top is set correctly via addtile" );
var firstChild = layer.div.firstChild.firstChild;
if (!isMozilla)
t.ok( true, "skipping element test outside of Mozilla");
else
t.ok( firstChild instanceof HTMLElement, "div first child is an image object" );
t.eq( firstChild.src,
url + "?" + OpenLayers.Util.getParameterString(tParams),
"div first child is correct image object" );
t.eq( tile.position.toString(), "x=5,y=6", "Position of tile is set correctly." );
map.destroy();
}
function test_Layer_WMS_bboxEncoding (t) {
t.plan( 6 );
var url = "http://octo.metacarta.com/cgi-bin/mapserv";
layer = new OpenLayers.Layer.WMS(name, url, params, {encodeBBOX:true});
var map = new OpenLayers.Map('map');
map.addLayer(layer);
var pixel = new OpenLayers.Pixel(5,6);
var tile = layer.addTile(new OpenLayers.Bounds(1,2,3,4), pixel);
tile.draw();
var img = tile.imgDiv;
var tParams = OpenLayers.Util.extend({},
OpenLayers.Util.upperCaseObject(params));