bcef16ce7ebd9a796d60c33c821bb3bfff800ecb.svn-base
6.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the Clear BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the
* full text of the license. */
/**
* @requires OpenLayers/Format/XML.js
* @requires OpenLayers/Format/OWSCommon/v1_1_0.js
*/
/**
* Class: OpenLayers.Format.WCSGetCoverage version 1.1.0
*
* Inherits from:
* - <OpenLayers.Format.XML>
*/
OpenLayers.Format.WCSGetCoverage = OpenLayers.Class(OpenLayers.Format.XML, {
/**
* Property: namespaces
* {Object} Mapping of namespace aliases to namespace URIs.
*/
namespaces: {
ows: "http://www.opengis.net/ows/1.1",
wcs: "http://www.opengis.net/wcs/1.1",
xlink: "http://www.w3.org/1999/xlink",
xsi: "http://www.w3.org/2001/XMLSchema-instance"
},
/**
* Property: regExes
* Compiled regular expressions for manipulating strings.
*/
regExes: {
trimSpace: (/^\s*|\s*$/g),
removeSpace: (/\s*/g),
splitSpace: (/\s+/),
trimComma: (/\s*,\s*/g)
},
/**
* Constant: VERSION
* {String} 1.1.2
*/
VERSION: "1.1.2",
/**
* Property: schemaLocation
* {String} Schema location
*/
schemaLocation: "http://www.opengis.net/wcs/1.1 http://schemas.opengis.net/wcs/1.1/wcsGetCoverage.xsd",
/**
* Constructor: OpenLayers.Format.WCSGetCoverage
*
* Parameters:
* options - {Object} An optional object whose properties will be set on
* this instance.
*/
/**
* Method: write
*
* Parameters:
* options - {Object} Optional object.
*
* Returns:
* {String} A WCS GetCoverage request XML string.
*/
write: function(options) {
var node = this.writeNode("wcs:GetCoverage", options);
this.setAttributeNS(
node, this.namespaces.xsi,
"xsi:schemaLocation", this.schemaLocation
);
return OpenLayers.Format.XML.prototype.write.apply(this, [node]);
},
/**
* Property: writers
* As a compliment to the readers property, this structure contains public
* writing functions grouped by namespace alias and named like the
* node names they produce.
*/
writers: {
"wcs": {
"GetCoverage": function(options) {
var node = this.createElementNSPlus("wcs:GetCoverage", {
attributes: {
version: options.version || this.VERSION,
service: 'WCS'
}
});
this.writeNode("ows:Identifier", options.identifier, node);
this.writeNode("wcs:DomainSubset", options.domainSubset, node);
this.writeNode("wcs:Output", options.output, node);
return node;
},
"DomainSubset": function(domainSubset) {
var node = this.createElementNSPlus("wcs:DomainSubset", {});
this.writeNode("ows:BoundingBox", domainSubset.boundingBox, node);
if (domainSubset.temporalSubset) {
this.writeNode("wcs:TemporalSubset", domainSubset.temporalSubset, node);
}
return node;
},
"TemporalSubset": function(temporalSubset) {
var node = this.createElementNSPlus("wcs:TemporalSubset", {});
for (var i=0, len=temporalSubset.timePeriods.length; i<len; ++i) {
this.writeNode("wcs:TimePeriod", temporalSubset.timePeriods[i], node);
}
return node;
},
"TimePeriod": function(timePeriod) {
var node = this.createElementNSPlus("wcs:TimePeriod", {});
this.writeNode("wcs:BeginPosition", timePeriod.begin, node);
this.writeNode("wcs:EndPosition", timePeriod.end, node);
if (timePeriod.resolution) {
this.writeNode("wcs:TimeResolution", timePeriod.resolution, node);
}
return node;
},
"BeginPosition": function(begin) {
var node = this.createElementNSPlus("wcs:BeginPosition", {
value: begin
});
return node;
},
"EndPosition": function(end) {
var node = this.createElementNSPlus("wcs:EndPosition", {
value: end
});
return node;
},
"TimeResolution": function(resolution) {
var node = this.createElementNSPlus("wcs:TimeResolution", {
value: resolution
});
return node;
},
"Output": function(output) {
var node = this.createElementNSPlus("wcs:Output", {
attributes: {
format: output.format,
store: output.store
}
});
if (output.gridCRS) {
this.writeNode("wcs:GridCRS", output.gridCRS, node);
}
return node;
},
"GridCRS": function(gridCRS) {
var node = this.createElementNSPlus("wcs:GridCRS", {});
this.writeNode("wcs:GridBaseCRS", gridCRS.baseCRS, node);
if (gridCRS.type) {
this.writeNode("wcs:GridType", gridCRS.type, node);
}
if (gridCRS.origin) {
this.writeNode("wcs:GridOrigin", gridCRS.origin, node);
}
this.writeNode("wcs:GridOffsets", gridCRS.offsets, node);
if (gridCRS.CS) {
this.writeNode("wcs:GridCS", gridCRS.CS, node);
}
return node;
},
"GridBaseCRS": function(baseCRS) {
return this.createElementNSPlus("wcs:GridBaseCRS", {
value: baseCRS
});
},
"GridOrigin": function(origin) {
return this.createElementNSPlus("wcs:GridOrigin", {
value: origin
});
},
"GridType": function(type) {
return this.createElementNSPlus("wcs:GridType", {
value: type
});
},
"GridOffsets": function(offsets) {
return this.createElementNSPlus("wcs:GridOffsets", {
value: offsets
});
},
"GridCS": function(CS) {
return this.createElementNSPlus("wcs:GridCS", {
value: CS
});
}
},
"ows": OpenLayers.Format.OWSCommon.v1_1_0.prototype.writers.ows
},
CLASS_NAME: "OpenLayers.Format.WCSGetCoverage"
});