dos2unix, non-functional change

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10838 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
bartvde
2010-10-15 14:36:48 +00:00
parent 12d3c86eb4
commit 44bba4bc6b

View File

@@ -2,261 +2,261 @@
* full list of contributors). Published under the Clear BSD license. * full list of contributors). Published under the Clear BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
* full text of the license. */ * full text of the license. */
/** /**
* @requires OpenLayers/Format/XML.js * @requires OpenLayers/Format/XML.js
* @requires OpenLayers/Format/GML.js * @requires OpenLayers/Format/GML.js
* @requires OpenLayers/Format/GML/v3.js * @requires OpenLayers/Format/GML/v3.js
*/ */
/** /**
* Class: OpenLayers.Format.SOSGetObservation * Class: OpenLayers.Format.SOSGetObservation
* Read and write SOS GetObersation (to get the actual values from a sensor) * Read and write SOS GetObersation (to get the actual values from a sensor)
* version 1.0.0 * version 1.0.0
* *
* Inherits from: * Inherits from:
* - <OpenLayers.Format.XML> * - <OpenLayers.Format.XML>
*/ */
OpenLayers.Format.SOSGetObservation = OpenLayers.Class(OpenLayers.Format.XML, { OpenLayers.Format.SOSGetObservation = OpenLayers.Class(OpenLayers.Format.XML, {
/** /**
* Property: namespaces * Property: namespaces
* {Object} Mapping of namespace aliases to namespace URIs. * {Object} Mapping of namespace aliases to namespace URIs.
*/ */
namespaces: { namespaces: {
ows: "http://www.opengis.net/ows", ows: "http://www.opengis.net/ows",
gml: "http://www.opengis.net/gml", gml: "http://www.opengis.net/gml",
sos: "http://www.opengis.net/sos/1.0", sos: "http://www.opengis.net/sos/1.0",
ogc: "http://www.opengis.net/ogc", ogc: "http://www.opengis.net/ogc",
om: "http://www.opengis.net/om/1.0", om: "http://www.opengis.net/om/1.0",
xlink: "http://www.w3.org/1999/xlink", xlink: "http://www.w3.org/1999/xlink",
xsi: "http://www.w3.org/2001/XMLSchema-instance" xsi: "http://www.w3.org/2001/XMLSchema-instance"
}, },
/** /**
* Property: regExes * Property: regExes
* Compiled regular expressions for manipulating strings. * Compiled regular expressions for manipulating strings.
*/ */
regExes: { regExes: {
trimSpace: (/^\s*|\s*$/g), trimSpace: (/^\s*|\s*$/g),
removeSpace: (/\s*/g), removeSpace: (/\s*/g),
splitSpace: (/\s+/), splitSpace: (/\s+/),
trimComma: (/\s*,\s*/g) trimComma: (/\s*,\s*/g)
}, },
/** /**
* Constant: VERSION * Constant: VERSION
* {String} 1.0.0 * {String} 1.0.0
*/ */
VERSION: "1.0.0", VERSION: "1.0.0",
/** /**
* Property: schemaLocation * Property: schemaLocation
* {String} Schema location * {String} Schema location
*/ */
schemaLocation: "http://www.opengis.net/sos/1.0 http://schemas.opengis.net/sos/1.0.0/sosGetObservation.xsd", schemaLocation: "http://www.opengis.net/sos/1.0 http://schemas.opengis.net/sos/1.0.0/sosGetObservation.xsd",
/** /**
* Property: defaultPrefix * Property: defaultPrefix
*/ */
defaultPrefix: "sos", defaultPrefix: "sos",
/** /**
* Constructor: OpenLayers.Format.SOSGetObservation * Constructor: OpenLayers.Format.SOSGetObservation
* *
* Parameters: * Parameters:
* options - {Object} An optional object whose properties will be set on * options - {Object} An optional object whose properties will be set on
* this instance. * this instance.
*/ */
initialize: function(options) { initialize: function(options) {
OpenLayers.Format.XML.prototype.initialize.apply(this, [options]); OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
}, },
/** /**
* Method: read * Method: read
* *
* Parameters: * Parameters:
* data - {String} or {DOMElement} data to read/parse. * data - {String} or {DOMElement} data to read/parse.
* *
* Returns: * Returns:
* {Object} An object containing the measurements * {Object} An object containing the measurements
*/ */
read: function(data) { read: function(data) {
if(typeof data == "string") { if(typeof data == "string") {
data = OpenLayers.Format.XML.prototype.read.apply(this, [data]); data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
} }
if(data && data.nodeType == 9) { if(data && data.nodeType == 9) {
data = data.documentElement; data = data.documentElement;
} }
var info = {measurements: []}; var info = {measurements: []};
this.readNode(data, info); this.readNode(data, info);
return info; return info;
}, },
/** /**
* Method: write * Method: write
* *
* Parameters: * Parameters:
* options - {Object} Optional object. * options - {Object} Optional object.
* *
* Returns: * Returns:
* {String} An SOS GetObservation request XML string. * {String} An SOS GetObservation request XML string.
*/ */
write: function(options) { write: function(options) {
var node = this.writeNode("sos:GetObservation", options); var node = this.writeNode("sos:GetObservation", options);
node.setAttribute("xmlns:om", this.namespaces.om); node.setAttribute("xmlns:om", this.namespaces.om);
this.setAttributeNS( this.setAttributeNS(
node, this.namespaces.xsi, node, this.namespaces.xsi,
"xsi:schemaLocation", this.schemaLocation "xsi:schemaLocation", this.schemaLocation
); );
return OpenLayers.Format.XML.prototype.write.apply(this, [node]); return OpenLayers.Format.XML.prototype.write.apply(this, [node]);
}, },
/** /**
* Property: readers * Property: readers
* Contains public functions, grouped by namespace prefix, that will * Contains public functions, grouped by namespace prefix, that will
* be applied when a namespaced node is found matching the function * be applied when a namespaced node is found matching the function
* name. The function will be applied in the scope of this parser * name. The function will be applied in the scope of this parser
* with two arguments: the node being read and a context object passed * with two arguments: the node being read and a context object passed
* from the parent. * from the parent.
*/ */
readers: { readers: {
"om": { "om": {
"ObservationCollection": function(node, obj) { "ObservationCollection": function(node, obj) {
obj.id = this.getAttributeNS(node, this.namespaces.gml, "id"); obj.id = this.getAttributeNS(node, this.namespaces.gml, "id");
this.readChildNodes(node, obj); this.readChildNodes(node, obj);
}, },
"member": function(node, observationCollection) { "member": function(node, observationCollection) {
this.readChildNodes(node, observationCollection); this.readChildNodes(node, observationCollection);
}, },
"Measurement": function(node, observationCollection) { "Measurement": function(node, observationCollection) {
var measurement = {}; var measurement = {};
observationCollection.measurements.push(measurement); observationCollection.measurements.push(measurement);
this.readChildNodes(node, measurement); this.readChildNodes(node, measurement);
}, },
"samplingTime": function(node, measurement) { "samplingTime": function(node, measurement) {
var samplingTime = {}; var samplingTime = {};
measurement.samplingTime = samplingTime; measurement.samplingTime = samplingTime;
this.readChildNodes(node, samplingTime); this.readChildNodes(node, samplingTime);
}, },
"observedProperty": function(node, measurement) { "observedProperty": function(node, measurement) {
measurement.observedProperty = measurement.observedProperty =
this.getAttributeNS(node, this.namespaces.xlink, "href"); this.getAttributeNS(node, this.namespaces.xlink, "href");
this.readChildNodes(node, measurement); this.readChildNodes(node, measurement);
}, },
"procedure": function(node, measurement) { "procedure": function(node, measurement) {
measurement.procedure = measurement.procedure =
this.getAttributeNS(node, this.namespaces.xlink, "href"); this.getAttributeNS(node, this.namespaces.xlink, "href");
this.readChildNodes(node, measurement); this.readChildNodes(node, measurement);
}, },
"result": function(node, measurement) { "result": function(node, measurement) {
var result = {}; var result = {};
measurement.result = result; measurement.result = result;
if (this.getChildValue(node) !== '') { if (this.getChildValue(node) !== '') {
result.value = this.getChildValue(node); result.value = this.getChildValue(node);
result.uom = node.getAttribute("uom"); result.uom = node.getAttribute("uom");
} else { } else {
this.readChildNodes(node, result); this.readChildNodes(node, result);
} }
} }
}, },
"gml": OpenLayers.Util.applyDefaults({ "gml": OpenLayers.Util.applyDefaults({
"TimeInstant": function(node, samplingTime) { "TimeInstant": function(node, samplingTime) {
var timeInstant = {}; var timeInstant = {};
samplingTime.timeInstant = timeInstant; samplingTime.timeInstant = timeInstant;
this.readChildNodes(node, timeInstant); this.readChildNodes(node, timeInstant);
}, },
"timePosition": function(node, timeInstant) { "timePosition": function(node, timeInstant) {
timeInstant.timePosition = this.getChildValue(node); timeInstant.timePosition = this.getChildValue(node);
} }
}, OpenLayers.Format.GML.v3.prototype.readers.gml) }, OpenLayers.Format.GML.v3.prototype.readers.gml)
}, },
/** /**
* Property: writers * Property: writers
* As a compliment to the readers property, this structure contains public * As a compliment to the readers property, this structure contains public
* writing functions grouped by namespace alias and named like the * writing functions grouped by namespace alias and named like the
* node names they produce. * node names they produce.
*/ */
writers: { writers: {
"sos": { "sos": {
"GetObservation": function(options) { "GetObservation": function(options) {
var node = this.createElementNSPlus("GetObservation", { var node = this.createElementNSPlus("GetObservation", {
attributes: { attributes: {
version: this.VERSION, version: this.VERSION,
service: 'SOS' service: 'SOS'
} }
}); });
this.writeNode("offering", options, node); this.writeNode("offering", options, node);
this.writeNode("eventTime", options, node); this.writeNode("eventTime", options, node);
this.writeNode("procedure", options, node); this.writeNode("procedure", options, node);
this.writeNode("observedProperty", options, node); this.writeNode("observedProperty", options, node);
this.writeNode("responseFormat", options, node); this.writeNode("responseFormat", options, node);
this.writeNode("resultModel", options, node); this.writeNode("resultModel", options, node);
this.writeNode("responseMode", options, node); this.writeNode("responseMode", options, node);
return node; return node;
}, },
"responseFormat": function(options) { "responseFormat": function(options) {
return this.createElementNSPlus("responseFormat", return this.createElementNSPlus("responseFormat",
{value: options.responseFormat}); {value: options.responseFormat});
}, },
"procedure": function(options) { "procedure": function(options) {
return this.createElementNSPlus("procedure", return this.createElementNSPlus("procedure",
{value: options.procedure}); {value: options.procedure});
}, },
"offering": function(options) { "offering": function(options) {
return this.createElementNSPlus("offering", {value: return this.createElementNSPlus("offering", {value:
options.offering}); options.offering});
}, },
"observedProperty": function(options) { "observedProperty": function(options) {
return this.createElementNSPlus("observedProperty", return this.createElementNSPlus("observedProperty",
{value: options.observedProperty}); {value: options.observedProperty});
}, },
"eventTime": function(options) { "eventTime": function(options) {
var node = this.createElementNSPlus("eventTime"); var node = this.createElementNSPlus("eventTime");
if (options.eventTime === 'latest') { if (options.eventTime === 'latest') {
this.writeNode("ogc:TM_Equals", options, node); this.writeNode("ogc:TM_Equals", options, node);
} }
return node; return node;
}, },
"resultModel": function(options) { "resultModel": function(options) {
return this.createElementNSPlus("resultModel", {value: return this.createElementNSPlus("resultModel", {value:
options.resultModel}); options.resultModel});
}, },
"responseMode": function(options) { "responseMode": function(options) {
return this.createElementNSPlus("responseMode", {value: return this.createElementNSPlus("responseMode", {value:
options.responseMode}); options.responseMode});
} }
}, },
"ogc": { "ogc": {
"TM_Equals": function(options) { "TM_Equals": function(options) {
var node = this.createElementNSPlus("ogc:TM_Equals"); var node = this.createElementNSPlus("ogc:TM_Equals");
this.writeNode("ogc:PropertyName", {property: this.writeNode("ogc:PropertyName", {property:
"urn:ogc:data:time:iso8601"}, node); "urn:ogc:data:time:iso8601"}, node);
if (options.eventTime === 'latest') { if (options.eventTime === 'latest') {
this.writeNode("gml:TimeInstant", {value: 'latest'}, node); this.writeNode("gml:TimeInstant", {value: 'latest'}, node);
} }
return node; return node;
}, },
"PropertyName": function(options) { "PropertyName": function(options) {
return this.createElementNSPlus("ogc:PropertyName", return this.createElementNSPlus("ogc:PropertyName",
{value: options.property}); {value: options.property});
} }
}, },
"gml": { "gml": {
"TimeInstant": function(options) { "TimeInstant": function(options) {
var node = this.createElementNSPlus("gml:TimeInstant"); var node = this.createElementNSPlus("gml:TimeInstant");
this.writeNode("gml:timePosition", options, node); this.writeNode("gml:timePosition", options, node);
return node; return node;
}, },
"timePosition": function(options) { "timePosition": function(options) {
var node = this.createElementNSPlus("gml:timePosition", var node = this.createElementNSPlus("gml:timePosition",
{value: options.value}); {value: options.value});
return node; return node;
} }
} }
}, },
CLASS_NAME: "OpenLayers.Format.SOSGetObservation" CLASS_NAME: "OpenLayers.Format.SOSGetObservation"
}); });