When writing a WMC, bounds should not be rounded to a predefined precision, original patch by bbinet, r=me (closes #2242)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@9703 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -539,10 +539,10 @@ OpenLayers.Format.WMC.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||
node.appendChild(this.createElementDefaultNS(
|
||||
"BoundingBox", null,
|
||||
{
|
||||
minx: bounds.left.toPrecision(10),
|
||||
miny: bounds.bottom.toPrecision(10),
|
||||
maxx: bounds.right.toPrecision(10),
|
||||
maxy: bounds.top.toPrecision(10),
|
||||
minx: bounds.left.toPrecision(18),
|
||||
miny: bounds.bottom.toPrecision(18),
|
||||
maxx: bounds.right.toPrecision(18),
|
||||
maxy: bounds.top.toPrecision(18),
|
||||
SRS: context.projection
|
||||
}
|
||||
));
|
||||
@@ -570,10 +570,10 @@ OpenLayers.Format.WMC.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||
this.namespaces.ol, "ol:maxExtent"
|
||||
);
|
||||
this.setAttributes(maxExtent, {
|
||||
minx: bounds.left.toPrecision(10),
|
||||
miny: bounds.bottom.toPrecision(10),
|
||||
maxx: bounds.right.toPrecision(10),
|
||||
maxy: bounds.top.toPrecision(10)
|
||||
minx: bounds.left.toPrecision(18),
|
||||
miny: bounds.bottom.toPrecision(18),
|
||||
maxx: bounds.right.toPrecision(18),
|
||||
maxy: bounds.top.toPrecision(18)
|
||||
});
|
||||
node.appendChild(maxExtent);
|
||||
}
|
||||
@@ -662,10 +662,10 @@ OpenLayers.Format.WMC.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||
this.namespaces.ol, "ol:maxExtent"
|
||||
);
|
||||
this.setAttributes(maxExtent, {
|
||||
minx: bounds.left.toPrecision(10),
|
||||
miny: bounds.bottom.toPrecision(10),
|
||||
maxx: bounds.right.toPrecision(10),
|
||||
maxy: bounds.top.toPrecision(10)
|
||||
minx: bounds.left.toPrecision(18),
|
||||
miny: bounds.bottom.toPrecision(18),
|
||||
maxx: bounds.right.toPrecision(18),
|
||||
maxy: bounds.top.toPrecision(18)
|
||||
});
|
||||
node.appendChild(maxExtent);
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ OpenLayers.Format.WMC.v1_1_0 = OpenLayers.Class(
|
||||
var minSD = this.createElementNS(
|
||||
this.namespaces.sld, "sld:MinScaleDenominator"
|
||||
);
|
||||
minSD.appendChild(this.createTextNode(layer.maxScale.toPrecision(10)));
|
||||
minSD.appendChild(this.createTextNode(layer.maxScale.toPrecision(16)));
|
||||
node.appendChild(minSD);
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ OpenLayers.Format.WMC.v1_1_0 = OpenLayers.Class(
|
||||
var maxSD = this.createElementNS(
|
||||
this.namespaces.sld, "sld:MaxScaleDenominator"
|
||||
);
|
||||
maxSD.appendChild(this.createTextNode(layer.minScale.toPrecision(10)));
|
||||
maxSD.appendChild(this.createTextNode(layer.minScale.toPrecision(16)));
|
||||
node.appendChild(maxSD);
|
||||
}
|
||||
|
||||
@@ -122,4 +122,4 @@ OpenLayers.Format.WMC.v1_1_0 = OpenLayers.Class(
|
||||
|
||||
CLASS_NAME: "OpenLayers.Format.WMC.v1_1_0"
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -39,11 +39,11 @@
|
||||
node = wmc.write_wmc_Layer(layer);
|
||||
minList = wmc.getElementsByTagNameNS(node, sldNS, "MinScaleDenominator");
|
||||
t.eq(minList.length, 1, "(resolutions) node written with MinScaleDenominator");
|
||||
t.eq(layer.maxScale.toPrecision(10), wmc.getChildValue(minList[0]),
|
||||
t.eq(layer.maxScale.toPrecision(16), wmc.getChildValue(minList[0]),
|
||||
"(resolutions) node written with correct MinScaleDenominator value");
|
||||
maxList = wmc.getElementsByTagNameNS(node, sldNS, "MaxScaleDenominator");
|
||||
t.eq(maxList.length, 1, "(resolutions) node written with MaxScaleDenominator");
|
||||
t.eq(layer.minScale.toPrecision(10), wmc.getChildValue(maxList[0]),
|
||||
t.eq(layer.minScale.toPrecision(16), wmc.getChildValue(maxList[0]),
|
||||
"(resolutions) node written with correct MaxScaleDenominator value");
|
||||
|
||||
layer = new OpenLayers.Layer.WMS(
|
||||
@@ -56,11 +56,11 @@
|
||||
minList = wmc.getElementsByTagNameNS(node, sldNS, "MinScaleDenominator");
|
||||
var f = new OpenLayers.Format.XML();
|
||||
t.eq(minList.length, 1, "(scales) node written with MinScaleDenominator");
|
||||
t.eq(layer.maxScale.toPrecision(10), wmc.getChildValue(minList[0]),
|
||||
t.eq(layer.maxScale.toPrecision(16), wmc.getChildValue(minList[0]),
|
||||
"(scales) node written with correct MinScaleDenominator value");
|
||||
maxList = wmc.getElementsByTagNameNS(node, sldNS, "MaxScaleDenominator");
|
||||
t.eq(maxList.length, 1, "(scales) node written with MaxScaleDenominator");
|
||||
t.eq(layer.minScale.toPrecision(10), wmc.getChildValue(maxList[0]),
|
||||
t.eq(layer.minScale.toPrecision(16), wmc.getChildValue(maxList[0]),
|
||||
"(scales) node written with correct MaxScaleDenominator value");
|
||||
|
||||
layer.metadataURL = 'http://foo';
|
||||
|
||||
Reference in New Issue
Block a user