add parsing of boundedBy in Format.WMSGetFeatureInfo, r=elemoine (closes #2329)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@9800 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -147,7 +147,7 @@ OpenLayers.Format.GML = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||
nodeList = this.getElementsByTagNameNS(node, this.gmlns, type);
|
||||
if(nodeList.length > 0) {
|
||||
// only deal with first geometry of this type
|
||||
var parser = this.parseGeometry[type.toLowerCase()];
|
||||
parser = this.parseGeometry[type.toLowerCase()];
|
||||
if(parser) {
|
||||
geometry = parser.apply(this, [nodeList[0]]);
|
||||
if (this.internalProjection && this.externalProjection) {
|
||||
@@ -176,6 +176,14 @@ OpenLayers.Format.GML = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||
featureNSPrefix: node.firstChild.prefix
|
||||
};
|
||||
|
||||
var boundedByNodes = this.getElementsByTagNameNS(node, this.gmlns, 'boundedBy');
|
||||
if (boundedByNodes.length === 1) {
|
||||
parser = this.parseGeometry['box'];
|
||||
if (parser) {
|
||||
feature.bounds = parser.apply(this, [boundedByNodes[0]]);
|
||||
}
|
||||
}
|
||||
|
||||
// assign fid - this can come from a "fid" or "id" attribute
|
||||
var childNode = node.firstChild;
|
||||
var fid;
|
||||
@@ -522,7 +530,40 @@ OpenLayers.Format.GML = OpenLayers.Class(OpenLayers.Format.XML, {
|
||||
envelope = new OpenLayers.Geometry.Polygon([ring]);
|
||||
}
|
||||
return envelope;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: parseGeometry.box
|
||||
* Given a GML node representing a box geometry, create an
|
||||
* OpenLayers.Bounds.
|
||||
*
|
||||
* Parameters:
|
||||
* node - {DOMElement} A GML node.
|
||||
*
|
||||
* Returns:
|
||||
* {<OpenLayers.Bounds>} A bounds representing the box.
|
||||
*/
|
||||
box: function(node) {
|
||||
var nodeList = this.getElementsByTagNameNS(node, this.gmlns,
|
||||
"coordinates");
|
||||
var coordString;
|
||||
var coords, beginPoint = null, endPoint = null;
|
||||
if (nodeList.length > 0) {
|
||||
coordString = nodeList[0].firstChild.nodeValue;
|
||||
coords = coordString.split(" ");
|
||||
if (coords.length == 2) {
|
||||
beginPoint = coords[0].split(",");
|
||||
endPoint = coords[1].split(",");
|
||||
}
|
||||
}
|
||||
if (beginPoint !== null && endPoint !== null) {
|
||||
return new OpenLayers.Bounds(parseFloat(beginPoint[0]),
|
||||
parseFloat(beginPoint[1]),
|
||||
parseFloat(endPoint[0]),
|
||||
parseFloat(endPoint[1]) );
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user