Skip to content

Commit 976957b

Browse files
author
Bart van den Eijnden
committed
merge with master
2 parents fcf9540 + bc0f3d3 commit 976957b

File tree

14 files changed

+830
-91
lines changed

14 files changed

+830
-91
lines changed

lib/OpenLayers.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,10 @@
319319
"OpenLayers/Format/WCSCapabilities/v1.js",
320320
"OpenLayers/Format/WCSCapabilities/v1_0_0.js",
321321
"OpenLayers/Format/WCSCapabilities/v1_1_0.js",
322+
"OpenLayers/Format/WCSDescribeCoverage.js",
323+
"OpenLayers/Format/WCSDescribeCoverage/v1.js",
324+
"OpenLayers/Format/WCSDescribeCoverage/v1_0_0.js",
325+
"OpenLayers/Format/WCSDescribeCoverage/v1_1_0.js",
322326
"OpenLayers/Format/WFSCapabilities.js",
323327
"OpenLayers/Format/WFSCapabilities/v1.js",
324328
"OpenLayers/Format/WFSCapabilities/v1_0_0.js",

lib/OpenLayers/Format/GML/v3.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ OpenLayers.Format.GML.v3 = OpenLayers.Class(OpenLayers.Format.GML.Base, {
137137
coords[1], coords[0], coords[2]
138138
);
139139
}
140-
obj.points = [point];
140+
if(!!!obj.points) {
141+
obj.points = [];
142+
}
143+
obj.points.push(point);
141144
},
142145
"posList": function(node, obj) {
143146
var str = this.getChildValue(node).replace(
@@ -228,6 +231,7 @@ OpenLayers.Format.GML.v3 = OpenLayers.Class(OpenLayers.Format.GML.Base, {
228231
if(!container.components) {
229232
container.components = [];
230233
}
234+
231235
var min = obj.points[0];
232236
var max = obj.points[1];
233237
container.components.push(

lib/OpenLayers/Format/OWSCommon/v1.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ OpenLayers.Format.OWSCommon.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
131131
"Voice": function(node, phone) {
132132
phone.voice = this.getChildValue(node);
133133
},
134+
"Facsimile": function(node, phone) {
135+
phone.facsimile = this.getChildValue(node);
136+
},
134137
"Address": function(node, contactInfo) {
135138
contactInfo.address = {};
136139
this.readChildNodes(node, contactInfo.address);

lib/OpenLayers/Format/WCSCapabilities/v1_0_0.js

Lines changed: 64 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414
*
1515
* Inherits from:
1616
* - <OpenLayers.Format.WCSCapabilities.v1>
17+
* - <OpenLayers.Format.GML.v3>
1718
*/
1819
OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class(
19-
OpenLayers.Format.WCSCapabilities.v1, {
20-
20+
OpenLayers.Format.GML.v3, OpenLayers.Format.WCSCapabilities.v1, {
21+
2122
/**
2223
* Constructor: OpenLayers.Format.WCSCapabilities.v1_0_0
2324
* Create a new parser for WCS capabilities version 1.0.0.
@@ -45,55 +46,61 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class(
4546
* errorProperty is undefined on the returned object, the document will be
4647
* run through an OGCExceptionReport parser.
4748
*/
48-
errorProperty: "service",
49+
errorProperty: "serviceIdentification",
4950

5051
/**
5152
* Property: readers
5253
* Contains public functions, grouped by namespace prefix, that will
5354
* be applied when a namespaced node is found matching the function
5455
* name. The function will be applied in the scope of this parser
5556
* with two arguments: the node being read and a context object passed
56-
* from the parent.
57+
* from the parent. Where possible, the 1.0.0 readers attempt to make
58+
* their output compatible with 1.1.0 to reduce client complexity.
5759
*/
5860
readers: {
5961
"wcs": {
60-
"WCS_Capabilities": function(node, obj) {
62+
"WCS_Capabilities": function(node, obj) {
6163
this.readChildNodes(node, obj);
6264
},
6365
"Service": function(node, obj) {
64-
obj.service = {};
65-
this.readChildNodes(node, obj.service);
66-
},
67-
"name": function(node, service) {
68-
service.name = this.getChildValue(node);
69-
},
70-
"label": function(node, service) {
71-
service.label = this.getChildValue(node);
66+
var children = {};
67+
this.readChildNodes(node, children);
68+
69+
// Rearrange things a little to get a tree that is
70+
// compatible with 1.1.0
71+
var providerName = children.serviceContact.providerName;
72+
delete children.serviceContact.providerName;
73+
74+
obj.serviceProvider = {
75+
providerName: providerName,
76+
serviceContact: children.serviceContact };
77+
children.serviceContact = undefined;
78+
obj.serviceIdentification = children;
7279
},
73-
"keywords": function(node, service) {
74-
service.keywords = [];
75-
this.readChildNodes(node, service.keywords);
80+
"keywords": function(node, serviceIdentification) {
81+
serviceIdentification.keywords = [];
82+
this.readChildNodes(node, serviceIdentification.keywords);
7683
},
7784
"keyword": function(node, keywords) {
7885
// Append the keyword to the keywords list
7986
keywords.push(this.getChildValue(node));
8087
},
81-
"responsibleParty": function(node, service) {
82-
service.responsibleParty = {};
83-
this.readChildNodes(node, service.responsibleParty);
88+
"responsibleParty": function(node, serviceIdentification) {
89+
serviceIdentification.serviceContact = {};
90+
this.readChildNodes(node, serviceIdentification.serviceContact);
8491
},
85-
"individualName": function(node, responsibleParty) {
86-
responsibleParty.individualName = this.getChildValue(node);
92+
"individualName": function(node, serviceContact) {
93+
serviceContact.individualName = this.getChildValue(node);
8794
},
88-
"organisationName": function(node, responsibleParty) {
89-
responsibleParty.organisationName = this.getChildValue(node);
95+
"organisationName": function(node, serviceContact) {
96+
serviceContact.providerName = this.getChildValue(node);
9097
},
91-
"positionName": function(node, responsibleParty) {
92-
responsibleParty.positionName = this.getChildValue(node);
98+
"positionName": function(node, serviceContact) {
99+
serviceContact.positionName = this.getChildValue(node);
93100
},
94-
"contactInfo": function(node, responsibleParty) {
95-
responsibleParty.contactInfo = {};
96-
this.readChildNodes(node, responsibleParty.contactInfo);
101+
"contactInfo": function(node, serviceContact) {
102+
serviceContact.contactInfo = {};
103+
this.readChildNodes(node, serviceContact.contactInfo);
97104
},
98105
"phone": function(node, contactInfo) {
99106
contactInfo.phone = {};
@@ -124,11 +131,11 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class(
124131
"electronicMailAddress": function(node, address) {
125132
address.electronicMailAddress = this.getChildValue(node);
126133
},
127-
"fees": function(node, service) {
128-
service.fees = this.getChildValue(node);
134+
"fees": function(node, serviceIdentification) {
135+
serviceIdentification.fees = this.getChildValue(node);
129136
},
130-
"accessConstraints": function(node, service) {
131-
service.accessConstraints = this.getChildValue(node);
137+
"accessConstraints": function(node, serviceIdentification) {
138+
serviceIdentification.accessConstraints = this.getChildValue(node);
132139
},
133140
"ContentMetadata": function(node, obj) {
134141
obj.contentMetadata = [];
@@ -139,11 +146,27 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class(
139146
this.readChildNodes(node, coverageOfferingBrief);
140147
contentMetadata.push(coverageOfferingBrief);
141148
},
142-
"name": function(node, coverageOfferingBrief) {
143-
coverageOfferingBrief.name = this.getChildValue(node);
149+
"name": function(node, serviceOrCoverageOfferingBrief) {
150+
// split/pop used to strip off any namespace prefixes
151+
if(node.parentNode.nodeName.split(':').pop() === "Service") {
152+
// We're parsing a service description
153+
serviceOrCoverageOfferingBrief.title = this.getChildValue(node);
154+
}
155+
else { // node.parentNode.nodeName === "CoverageOfferingBrief"
156+
// We're parsing a dataset
157+
serviceOrCoverageOfferingBrief.identifier = this.getChildValue(node);
158+
}
144159
},
145-
"label": function(node, coverageOfferingBrief) {
146-
coverageOfferingBrief.label = this.getChildValue(node);
160+
"label": function(node, serviceOrCoverageOfferingBrief) {
161+
// split/pop used to strip off any namespace prefixes
162+
if(node.parentNode.nodeName.split(':').pop() === "Service") {
163+
// We're parsing a service description
164+
serviceOrCoverageOfferingBrief.abstract = this.getChildValue(node);
165+
}
166+
else { // node.parentNode.nodeName === "CoverageOfferingBrief"
167+
// We"re parsing a dataset
168+
serviceOrCoverageOfferingBrief.title = this.getChildValue(node);
169+
}
147170
},
148171
"lonLatEnvelope": function(node, coverageOfferingBrief) {
149172
var nodeList = this.getElementsByTagNameNS(node, "http://www.opengis.net/gml", "pos");
@@ -153,16 +176,18 @@ OpenLayers.Format.WCSCapabilities.v1_0_0 = OpenLayers.Class(
153176
var min = {};
154177
var max = {};
155178

156-
OpenLayers.Format.GML.v3.prototype.readers["gml"].pos.apply(this, [nodeList[0], min]);
157-
OpenLayers.Format.GML.v3.prototype.readers["gml"].pos.apply(this, [nodeList[1], max]);
179+
this.xy = true; // Affirm we don't want our coordinates switched around
180+
this.readers.gml.pos.apply(this, [nodeList[0], min]);
181+
this.readers.gml.pos.apply(this, [nodeList[1], max]);
158182

159183
coverageOfferingBrief.lonLatEnvelope = {};
160184
coverageOfferingBrief.lonLatEnvelope.srsName = node.getAttribute("srsName");
161185
coverageOfferingBrief.lonLatEnvelope.min = min.points[0];
162186
coverageOfferingBrief.lonLatEnvelope.max = max.points[0];
163187
}
164188
}
165-
}
189+
},
190+
"gml": OpenLayers.Format.GML.v3.prototype.readers["gml"]
166191
},
167192

168193
CLASS_NAME: "OpenLayers.Format.WCSCapabilities.v1_0_0"

lib/OpenLayers/Format/WCSCapabilities/v1_1_0.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,19 @@ OpenLayers.Format.WCSCapabilities.v1_1_0 = OpenLayers.Class(
101101
}
102102
}
103103
}, OpenLayers.Format.WCSCapabilities.v1.prototype.readers["wcs"]),
104-
"ows": OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers["ows"]
104+
"ows": OpenLayers.Util.applyDefaults({
105+
// ows puts keywords in a dictionary, which doesn't make a
106+
// lot of sense in this context; we just want a list, so we'll
107+
// override this aspect of the ows parsing.
108+
"Keywords": function(node, serviceIdentification) {
109+
serviceIdentification.keywords = [];
110+
this.readChildNodes(node, serviceIdentification.keywords);
111+
},
112+
"Keyword": function(node, keywords) {
113+
// Append the keyword to the keywords list
114+
keywords.push(this.getChildValue(node));
115+
}
116+
}, OpenLayers.Format.OWSCommon.v1_1_0.prototype.readers["ows"])
105117
},
106118

107119
CLASS_NAME: "OpenLayers.Format.WCSCapabilities.v1_1_0"
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
2+
* full list of contributors). Published under the 2-clause BSD license.
3+
* See license.txt in the OpenLayers distribution or repository for the
4+
* full text of the license. */
5+
6+
/**
7+
* @requires OpenLayers/Format/XML/VersionedOGC.js
8+
*/
9+
10+
/**
11+
* Class: OpenLayers.Format.WCSDescribeCoverage
12+
* Parse results from WCS DescribeCoverage request.
13+
*
14+
* Inherits from:
15+
* - <OpenLayers.Format.XML.VersionedOGC>
16+
*/
17+
OpenLayers.Format.WCSDescribeCoverage = OpenLayers.Class(OpenLayers.Format.XML.VersionedOGC, {
18+
19+
/**
20+
* APIProperty: defaultVersion
21+
* {String} Version number to assume if none found. Default is "1.1.0".
22+
*/
23+
defaultVersion: "1.1.0",
24+
25+
/**
26+
* Constructor: OpenLayers.Format.WCSDescribeCoverage
27+
* Create a new parser for WCS DescribeCoverage response.
28+
*
29+
* Parameters:
30+
* options - {Object} An optional object whose properties will be set on
31+
* this instance.
32+
*/
33+
34+
/**
35+
* APIMethod: read
36+
* Read response data from a string, and return a list of coverage descriptions.
37+
*
38+
* Parameters:
39+
* data - {String} or {DOMElement} data to read/parse.
40+
*
41+
* Returns:
42+
* {Array} List of coverage descriptions.
43+
*/
44+
45+
CLASS_NAME: "OpenLayers.Format.WCSDescribeCoverage"
46+
47+
});
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
2+
* full list of contributors). Published under the 2-clause BSD license.
3+
* See license.txt in the OpenLayers distribution or repository for the
4+
* full text of the license. */
5+
6+
/**
7+
* @requires OpenLayers/Format/WCSCapabilities.js
8+
* @requires OpenLayers/Format/XML.js
9+
*/
10+
11+
/**
12+
* Class: OpenLayers.Format.WCSDescribeCoverage.v1
13+
* Abstract class not to be instantiated directly.
14+
*
15+
* Inherits from:
16+
* - <OpenLayers.Format.XML>
17+
*/
18+
OpenLayers.Format.WCSDescribeCoverage.v1 = OpenLayers.Class(
19+
OpenLayers.Format.XML, {
20+
21+
regExes: {
22+
trimSpace: (/^\s*|\s*$/g),
23+
splitSpace: (/\s+/)
24+
},
25+
26+
/**
27+
* Property: defaultPrefix
28+
*/
29+
defaultPrefix: "wcs",
30+
31+
/**
32+
* APIMethod: read
33+
*
34+
* Parameters:
35+
* data - {DOMElement|String} A WCS DescribeCoverage document.
36+
*
37+
* Returns:
38+
* {Object} An object representing the WCS DescribeCoverage response.
39+
*/
40+
read: function(data) {
41+
if(typeof data == "string") {
42+
data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
43+
}
44+
if(data && data.nodeType == 9) {
45+
data = data.documentElement;
46+
}
47+
var schema = {};
48+
if (data.nodeName.split(":").pop() === 'ExceptionReport') {
49+
// an exception must have occurred, so parse it
50+
var parser = new OpenLayers.Format.OGCExceptionReport();
51+
schema.error = parser.read(data);
52+
} else {
53+
this.readNode(data, schema);
54+
}
55+
return schema;
56+
},
57+
58+
CLASS_NAME: "OpenLayers.Format.WCSDescribeCoverage.v1"
59+
60+
});

0 commit comments

Comments
 (0)