WMSCapabilities format may fail to correctly read BoundingBox of layers, r=fredj (closes #3449)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@12209 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2011-08-08 04:45:41 +00:00
parent dd76c74bca
commit 61b291ee67
3 changed files with 20 additions and 8 deletions

View File

@@ -133,8 +133,8 @@ OpenLayers.Format.WMSCapabilities.v1 = OpenLayers.Class(
"dimensions",
"authorityURLs"];
var key;
for (var j=0; j<attributes.length; j++) {
var key, j;
for (j=0; j<attributes.length; j++) {
key = attributes[j];
if (key in parentLayer) {
// only take parent value if not present (null or undefined)
@@ -157,9 +157,9 @@ OpenLayers.Format.WMSCapabilities.v1 = OpenLayers.Class(
}
}
for (var j=0; j<complexAttr.length; j++) {
for (j=0; j<complexAttr.length; j++) {
key = complexAttr[j];
layer[key] = OpenLayers.Util.extend(
layer[key] = OpenLayers.Util.applyDefaults(
layer[key], parentLayer[key]);
}
}

View File

@@ -111,7 +111,7 @@
function test_layers(t) {
t.plan(22);
t.plan(24);
var xml = document.getElementById("ogcsample").firstChild.nodeValue;
var doc = new OpenLayers.Format.XML().read(xml);
@@ -143,7 +143,11 @@
[189000, 834000, 285000, 962000],
"Correct bbox from BoundingBox");
t.eq(bbox.res, {x: 1, y: 1}, "Correct resolution");
bbox = layers["ROADS_RIVERS"].bbox["EPSG:4326"];
t.eq(bbox.bbox,
[-71.63, 41.75, -70.78, 42.90],
"Correct bbox from BoundingBox (override)");
t.eq(bbox.res, {x: 0.01, y: 0.01}, "Correct resolution (override)");
bbox = layers["ROADS_1M"].bbox["EPSG:26986"];
t.eq(bbox.bbox,
[189000, 834000, 285000, 962000],
@@ -535,7 +539,8 @@ Changes:
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple"
xlink:href="http://gcmd.gsfc.nasa.gov/difguide/whatisadif.html" />
</AuthorityURL>
<BoundingBox SRS="EPSG:4326"
minx="-1" miny="-1" maxx="1" maxy="1" resx="0.0" resy="0.0"/>
<Layer>
<Name>ROADS_RIVERS</Name>

View File

@@ -14,7 +14,7 @@
function test_layers(t) {
t.plan(22);
t.plan(24);
var xml = document.getElementById("ogcsample").firstChild.nodeValue;
var doc = new OpenLayers.Format.XML().read(xml);
@@ -46,6 +46,11 @@
[189000, 834000, 285000, 962000],
"Correct bbox from BoundingBox");
t.eq(bbox.res, {x: 1, y: 1}, "Correct resolution");
bbox = layers["ROADS_RIVERS"].bbox["CRS:84"];
t.eq(bbox.bbox,
[-71.63, 41.75, -70.78, 42.90],
"Correct bbox from BoundingBox (override)");
t.eq(bbox.res, {x: 0.01, y: 0.01}, "Correct resolution (override)");
bbox = layers["ROADS_1M"].bbox["EPSG:26986"];
t.eq(bbox.bbox,
@@ -432,6 +437,8 @@ Changes:
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple"
xlink:href="http://gcmd.gsfc.nasa.gov/difguide/whatisadif.html" />
</AuthorityURL>
<BoundingBox CRS="CRS:84"
minx="-1" miny="-1" maxx="1" maxy="1" resx="0.0" resy="0.0"/>
<Layer>
<Name>ROADS_RIVERS</Name>