Skip to content

Commit edb5f4f

Browse files
committed
Specify now required featurePrefix
1 parent 5e38756 commit edb5f4f

File tree

1 file changed

+54
-48
lines changed

1 file changed

+54
-48
lines changed

lib/OpenLayers/Format/OWSContext/v0_3_1.js

Lines changed: 54 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* - <OpenLayers.Format.XML>
2222
*/
2323
OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
24-
24+
2525
/**
2626
* Property: namespaces
2727
* {Object} Mapping of namespace aliases to namespace URIs.
@@ -41,7 +41,7 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
4141
* Constant: VERSION
4242
* {String} 0.3.1
4343
*/
44-
VERSION: "0.3.1",
44+
VERSION: "0.3.1",
4545

4646
/**
4747
* Property: schemaLocation
@@ -60,13 +60,13 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
6060
* {Boolean} Extract attributes from GML. Default is true.
6161
*/
6262
extractAttributes: true,
63-
63+
6464
/**
6565
* APIProperty: xy
6666
* {Boolean} Order of the GML coordinate true:(x,y) or false:(y,x)
6767
* Changing is not recommended, a new Format should be instantiated.
68-
*/
69-
xy: true,
68+
*/
69+
xy: true,
7070

7171
/**
7272
* Property: regExes
@@ -79,6 +79,12 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
7979
trimComma: (/\s*,\s*/g)
8080
},
8181

82+
/**
83+
* Property: featurePrefix
84+
* {String} The namespace prefix to use for writing InlineGeometry
85+
*/
86+
featurePrefix: "feature",
87+
8288
/**
8389
* Property: featureNS
8490
* {String} The namespace uri to use for writing InlineGeometry
@@ -91,7 +97,7 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
9197
* InlineGeometry
9298
*/
9399
featureType: 'vector',
94-
100+
95101
/**
96102
* Property: geometryName
97103
* {String} The name to use for the geometry attribute when writing out
@@ -101,9 +107,9 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
101107

102108
/**
103109
* Property: nestingLayerLookup
104-
* {Object} Hashtable lookup for nesting layer nodes. Used while writing
105-
* the OWS context document. It is necessary to keep track of the
106-
* nestingPaths for which nesting layer nodes have already been
110+
* {Object} Hashtable lookup for nesting layer nodes. Used while writing
111+
* the OWS context document. It is necessary to keep track of the
112+
* nestingPaths for which nesting layer nodes have already been
107113
* created, so (nesting) layer nodes are added to those nodes.
108114
*
109115
* For example:
@@ -113,10 +119,10 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
113119
* layer2.metadata.nestingPath = "a/b/"
114120
* layer2.metadata.nestingPath = "a/c"
115121
*
116-
* then a nesting layer node "a" should be created once and added
117-
* to the resource list, a nesting layer node "b" should be created
118-
* once and added under "a", and a nesting layer node "c" should be
119-
* created and added under "a". The lookup paths for these nodes
122+
* then a nesting layer node "a" should be created once and added
123+
* to the resource list, a nesting layer node "b" should be created
124+
* once and added under "a", and a nesting layer node "c" should be
125+
* created and added under "a". The lookup paths for these nodes
120126
* will be "a", "a/b", and "a/c" respectively.
121127
*/
122128
nestingLayerLookup: null,
@@ -142,7 +148,7 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
142148
*
143149
* Parameters:
144150
* l - {Object} An object that may have a layersContext array property.
145-
*
151+
*
146152
*/
147153
setNestingPath : function(l){
148154
if(l.layersContext){
@@ -191,10 +197,10 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
191197

192198
/**
193199
* APIMethod: read
194-
* Read OWS context data from a string or DOMElement, and return a list
195-
* of layers.
196-
*
197-
* Parameters:
200+
* Read OWS context data from a string or DOMElement, and return a list
201+
* of layers.
202+
*
203+
* Parameters:
198204
* data - {String} or {DOMElement} data to read/parse.
199205
*
200206
* Returns:
@@ -211,7 +217,7 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
211217
var context = {};
212218
this.readNode(data, context);
213219
// since an OWSContext can be nested we need to go through this
214-
// structure recursively
220+
// structure recursively
215221
this.setNestingPath({layersContext : context.layersContext});
216222
// after nesting path has been set, create a flat list of layers
217223
var layers = [];
@@ -264,7 +270,7 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
264270
"xsi:schemaLocation", this.schemaLocation
265271
);
266272
return OpenLayers.Format.XML.prototype.write.apply(this, [root]);
267-
},
273+
},
268274

269275
/**
270276
* Property: readers
@@ -278,14 +284,14 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
278284
"kml": {
279285
"Document": function(node, obj) {
280286
obj.features = new OpenLayers.Format.KML(
281-
{kmlns: this.namespaces.kml,
287+
{kmlns: this.namespaces.kml,
282288
extractStyles: true}).read(node);
283289
}
284290
},
285-
"owc": {
291+
"owc": {
286292
"OWSContext": function(node, obj) {
287293
this.readChildNodes(node, obj);
288-
},
294+
},
289295
"General": function(node, obj) {
290296
this.readChildNodes(node, obj);
291297
},
@@ -297,11 +303,11 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
297303
metadata: {},
298304
visibility: (node.getAttribute("hidden") != "1"),
299305
queryable: (node.getAttribute("queryable") == "1"),
300-
opacity: ((node.getAttribute("opacity") != null) ?
306+
opacity: ((node.getAttribute("opacity") != null) ?
301307
parseFloat(node.getAttribute("opacity")) : null),
302308
name: node.getAttribute("name"),
303309
/* A category layer is a dummy layer meant for creating
304-
hierarchies. It is not a physical layer in the
310+
hierarchies. It is not a physical layer in the
305311
OpenLayers sense. The assumption we make here is that
306312
category layers do not have a name attribute */
307313
categoryLayer: (node.getAttribute("name") == null),
@@ -316,25 +322,25 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
316322
},
317323
"InlineGeometry": function(node, obj) {
318324
obj.features = [];
319-
var elements = this.getElementsByTagNameNS(node,
325+
var elements = this.getElementsByTagNameNS(node,
320326
this.namespaces.gml, "featureMember");
321327
var el;
322328
if (elements.length >= 1) {
323329
el = elements[0];
324330
}
325331
if (el && el.firstChild) {
326-
var featurenode = (el.firstChild.nextSibling) ?
332+
var featurenode = (el.firstChild.nextSibling) ?
327333
el.firstChild.nextSibling : el.firstChild;
328334
this.setNamespace("feature", featurenode.namespaceURI);
329-
this.featureType = featurenode.localName ||
335+
this.featureType = featurenode.localName ||
330336
featurenode.nodeName.split(":").pop();
331337
this.readChildNodes(node, obj);
332338
}
333339
},
334340
"Server": function(node, obj) {
335341
// when having multiple Server types, we prefer WMS
336-
if ((!obj.service && !obj.version) ||
337-
(obj.service !=
342+
if ((!obj.service && !obj.version) ||
343+
(obj.service !=
338344
OpenLayers.Format.Context.serviceTypes.WMS)) {
339345
obj.service = node.getAttribute("service");
340346
obj.version = node.getAttribute("version");
@@ -363,7 +369,7 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
363369
this.readChildNodes(node, legend);
364370
},
365371
"OnlineResource": function(node, obj) {
366-
obj.url = this.getAttributeNS(node, this.namespaces.xlink,
372+
obj.url = this.getAttributeNS(node, this.namespaces.xlink,
367373
"href");
368374
this.readChildNodes(node, obj);
369375
}
@@ -387,11 +393,11 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
387393
attributes: {
388394
version: this.VERSION,
389395
id: options.id || OpenLayers.Util.createUniqueID("OpenLayers_OWSContext_")
390-
}
391-
});
396+
}
397+
});
392398
this.writeNode("General", options, node);
393399
this.writeNode("ResourceList", options, node);
394-
return node;
400+
return node;
395401
},
396402
"General": function(options) {
397403
var node = this.createElementNSPlus("General");
@@ -473,7 +479,7 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
473479
});
474480
this.writeNode("ows:Title", layer.name, node);
475481
this.writeNode("ows:OutputFormat", layer.params.FORMAT, node);
476-
this.writeNode("Server", {service:
482+
this.writeNode("Server", {service:
477483
OpenLayers.Format.Context.serviceTypes.WMS,
478484
version: layer.params.VERSION, url: layer.url}, node);
479485
if (layer.metadata.styles && layer.metadata.styles.length > 0) {
@@ -488,7 +494,7 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
488494
node = null;
489495
title = null;
490496
// subPaths is an array of an array
491-
// recursively calling _Layer writer eats up subPaths, until a
497+
// recursively calling _Layer writer eats up subPaths, until a
492498
// real writer is called and nodes are returned.
493499
if(subPaths.length > 0){
494500
var path = subPaths[0].join("/");
@@ -527,11 +533,11 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
527533
}
528534
}
529535
if (layer.options.maxScale) {
530-
this.writeNode("sld:MinScaleDenominator",
536+
this.writeNode("sld:MinScaleDenominator",
531537
layer.options.maxScale, node);
532538
}
533539
if (layer.options.minScale) {
534-
this.writeNode("sld:MaxScaleDenominator",
540+
this.writeNode("sld:MaxScaleDenominator",
535541
layer.options.minScale, node);
536542
}
537543
this.nestingLayerLookup[layer.name] = node;
@@ -544,9 +550,9 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
544550
hidden: layer.visibility ? "0" : "1" }
545551
});
546552
this.writeNode("ows:Title", layer.name, node);
547-
this.writeNode("Server", {service:
548-
OpenLayers.Format.Context.serviceTypes.WFS,
549-
version: layer.protocol.version,
553+
this.writeNode("Server", {service:
554+
OpenLayers.Format.Context.serviceTypes.WFS,
555+
version: layer.protocol.version,
550556
url: layer.protocol.url}, node);
551557
return node;
552558
},
@@ -562,18 +568,18 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
562568
"_GML": function(layer) {
563569
var node = this.createElementNSPlus("Layer");
564570
this.writeNode("ows:Title", layer.name, node);
565-
this.writeNode("Server", {service:
566-
OpenLayers.Format.Context.serviceTypes.GML,
567-
url: layer.protocol.url, version:
571+
this.writeNode("Server", {service:
572+
OpenLayers.Format.Context.serviceTypes.GML,
573+
url: layer.protocol.url, version:
568574
layer.protocol.format.version}, node);
569575
return node;
570576
},
571577
"_KML": function(layer) {
572578
var node = this.createElementNSPlus("Layer");
573579
this.writeNode("ows:Title", layer.name, node);
574-
this.writeNode("Server", {service:
580+
this.writeNode("Server", {service:
575581
OpenLayers.Format.Context.serviceTypes.KML,
576-
version: layer.protocol.format.version, url:
582+
version: layer.protocol.format.version, url:
577583
layer.protocol.url}, node);
578584
return node;
579585
}
@@ -589,7 +595,7 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
589595
"sld": OpenLayers.Format.SLD.v1_0_0.prototype.writers.sld,
590596
"feature": OpenLayers.Format.GML.v2.prototype.writers.feature
591597
},
592-
593-
CLASS_NAME: "OpenLayers.Format.OWSContext.v0_3_1"
598+
599+
CLASS_NAME: "OpenLayers.Format.OWSContext.v0_3_1"
594600

595601
});

0 commit comments

Comments
 (0)