Create Format for OWSContext, r=ahocevar (closes #2063)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10300 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
bartvde
2010-05-11 06:51:21 +00:00
parent e67c9411b4
commit 449bc859c4
14 changed files with 1581 additions and 439 deletions
+28 -45
View File
@@ -7,6 +7,7 @@
* @requires OpenLayers/Format/CSWGetRecords.js
* @requires OpenLayers/Format/Filter/v1_0_0.js
* @requires OpenLayers/Format/Filter/v1_1_0.js
* @requires OpenLayers/Format/OWSCommon/v1_0_0.js
*/
/**
@@ -118,6 +119,17 @@ OpenLayers.Format.CSWGetRecords.v2_0_2 = OpenLayers.Class(OpenLayers.Format.XML,
*/
Query: null,
/**
* Property: regExes
* Compiled regular expressions for manipulating strings.
*/
regExes: {
trimSpace: (/^\s*|\s*$/g),
removeSpace: (/\s*/g),
splitSpace: (/\s+/),
trimComma: (/\s*,\s*/g)
},
/**
* Constructor: OpenLayers.Format.CSWGetRecords.v2_0_2
* A class for parsing and generating CSWGetRecords v2.0.2 transactions.
@@ -249,53 +261,24 @@ OpenLayers.Format.CSWGetRecords.v2_0_2 = OpenLayers.Class(OpenLayers.Format.XML,
obj[name].push(this.getChildValue(node));
}
},
"ows": {
"WGS84BoundingBox": function(node, obj) {
// LowerCorner = "min_x min_y"
// UpperCorner = "max_x max_y"
if (!(obj.BoundingBox instanceof Array)) {
obj.BoundingBox = new Array();
}
//this.readChildNodes(node, bbox);
var lc = this.getChildValue(
this.getElementsByTagNameNS(
node,
this.namespaces["ows"],
"LowerCorner"
)[0]
).split(' ', 2);
var uc = this.getChildValue(
this.getElementsByTagNameNS(
node,
this.namespaces["ows"],
"UpperCorner"
)[0]
).split(' ', 2);
var boundingBox = {
value: [
parseFloat(lc[0]),
parseFloat(lc[1]),
parseFloat(uc[0]),
parseFloat(uc[1])
]
};
// store boundingBox attributes
var attrs = node.attributes;
for(var i=0, len=attrs.length; i<len; ++i) {
boundingBox[attrs[i].name] = attrs[i].nodeValue;
}
obj.BoundingBox.push(boundingBox);
},
"ows": OpenLayers.Util.applyDefaults({
"BoundingBox": function(node, obj) {
// FIXME: We consider that BoundingBox is the same as WGS84BoundingBox
// LowerCorner = "min_x min_y"
// UpperCorner = "max_x max_y"
// It should normally depend on the projection
this.readers['ows']['WGS84BoundingBox'].apply(this, [node, obj]);
if (obj.bounds) {
obj.BoundingBox = [{crs: obj.projection, value:
[
obj.bounds.left,
obj.bounds.bottom,
obj.bounds.right,
obj.bounds.top
]
}];
delete obj.projection;
delete obj.bounds;
}
OpenLayers.Format.OWSCommon.v1_0_0.prototype.readers["ows"]["BoundingBox"].apply(
this, arguments);
}
}
}, OpenLayers.Format.OWSCommon.v1_0_0.prototype.readers["ows"])
},
/**