21
21
* - <OpenLayers.Format.XML>
22
22
*/
23
23
OpenLayers . Format . OWSContext . v0_3_1 = OpenLayers . Class ( OpenLayers . Format . XML , {
24
-
24
+
25
25
/**
26
26
* Property: namespaces
27
27
* {Object} Mapping of namespace aliases to namespace URIs.
@@ -41,7 +41,7 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
41
41
* Constant: VERSION
42
42
* {String} 0.3.1
43
43
*/
44
- VERSION : "0.3.1" ,
44
+ VERSION : "0.3.1" ,
45
45
46
46
/**
47
47
* Property: schemaLocation
@@ -60,13 +60,13 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
60
60
* {Boolean} Extract attributes from GML. Default is true.
61
61
*/
62
62
extractAttributes : true ,
63
-
63
+
64
64
/**
65
65
* APIProperty: xy
66
66
* {Boolean} Order of the GML coordinate true:(x,y) or false:(y,x)
67
67
* Changing is not recommended, a new Format should be instantiated.
68
- */
69
- xy : true ,
68
+ */
69
+ xy : true ,
70
70
71
71
/**
72
72
* Property: regExes
@@ -79,6 +79,12 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
79
79
trimComma : ( / \s * , \s * / g)
80
80
} ,
81
81
82
+ /**
83
+ * Property: featurePrefix
84
+ * {String} The namespace prefix to use for writing InlineGeometry
85
+ */
86
+ featurePrefix : "feature" ,
87
+
82
88
/**
83
89
* Property: featureNS
84
90
* {String} The namespace uri to use for writing InlineGeometry
@@ -91,7 +97,7 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
91
97
* InlineGeometry
92
98
*/
93
99
featureType : 'vector' ,
94
-
100
+
95
101
/**
96
102
* Property: geometryName
97
103
* {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, {
101
107
102
108
/**
103
109
* 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
107
113
* created, so (nesting) layer nodes are added to those nodes.
108
114
*
109
115
* For example:
@@ -113,10 +119,10 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
113
119
* layer2.metadata.nestingPath = "a/b/"
114
120
* layer2.metadata.nestingPath = "a/c"
115
121
*
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
120
126
* will be "a", "a/b", and "a/c" respectively.
121
127
*/
122
128
nestingLayerLookup : null ,
@@ -142,7 +148,7 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
142
148
*
143
149
* Parameters:
144
150
* l - {Object} An object that may have a layersContext array property.
145
- *
151
+ *
146
152
*/
147
153
setNestingPath : function ( l ) {
148
154
if ( l . layersContext ) {
@@ -191,10 +197,10 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
191
197
192
198
/**
193
199
* 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:
198
204
* data - {String} or {DOMElement} data to read/parse.
199
205
*
200
206
* Returns:
@@ -211,7 +217,7 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
211
217
var context = { } ;
212
218
this . readNode ( data , context ) ;
213
219
// since an OWSContext can be nested we need to go through this
214
- // structure recursively
220
+ // structure recursively
215
221
this . setNestingPath ( { layersContext : context . layersContext } ) ;
216
222
// after nesting path has been set, create a flat list of layers
217
223
var layers = [ ] ;
@@ -264,7 +270,7 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
264
270
"xsi:schemaLocation" , this . schemaLocation
265
271
) ;
266
272
return OpenLayers . Format . XML . prototype . write . apply ( this , [ root ] ) ;
267
- } ,
273
+ } ,
268
274
269
275
/**
270
276
* Property: readers
@@ -278,14 +284,14 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
278
284
"kml" : {
279
285
"Document" : function ( node , obj ) {
280
286
obj . features = new OpenLayers . Format . KML (
281
- { kmlns : this . namespaces . kml ,
287
+ { kmlns : this . namespaces . kml ,
282
288
extractStyles : true } ) . read ( node ) ;
283
289
}
284
290
} ,
285
- "owc" : {
291
+ "owc" : {
286
292
"OWSContext" : function ( node , obj ) {
287
293
this . readChildNodes ( node , obj ) ;
288
- } ,
294
+ } ,
289
295
"General" : function ( node , obj ) {
290
296
this . readChildNodes ( node , obj ) ;
291
297
} ,
@@ -297,11 +303,11 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
297
303
metadata : { } ,
298
304
visibility : ( node . getAttribute ( "hidden" ) != "1" ) ,
299
305
queryable : ( node . getAttribute ( "queryable" ) == "1" ) ,
300
- opacity : ( ( node . getAttribute ( "opacity" ) != null ) ?
306
+ opacity : ( ( node . getAttribute ( "opacity" ) != null ) ?
301
307
parseFloat ( node . getAttribute ( "opacity" ) ) : null ) ,
302
308
name : node . getAttribute ( "name" ) ,
303
309
/* 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
305
311
OpenLayers sense. The assumption we make here is that
306
312
category layers do not have a name attribute */
307
313
categoryLayer : ( node . getAttribute ( "name" ) == null ) ,
@@ -316,25 +322,25 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
316
322
} ,
317
323
"InlineGeometry" : function ( node , obj ) {
318
324
obj . features = [ ] ;
319
- var elements = this . getElementsByTagNameNS ( node ,
325
+ var elements = this . getElementsByTagNameNS ( node ,
320
326
this . namespaces . gml , "featureMember" ) ;
321
327
var el ;
322
328
if ( elements . length >= 1 ) {
323
329
el = elements [ 0 ] ;
324
330
}
325
331
if ( el && el . firstChild ) {
326
- var featurenode = ( el . firstChild . nextSibling ) ?
332
+ var featurenode = ( el . firstChild . nextSibling ) ?
327
333
el . firstChild . nextSibling : el . firstChild ;
328
334
this . setNamespace ( "feature" , featurenode . namespaceURI ) ;
329
- this . featureType = featurenode . localName ||
335
+ this . featureType = featurenode . localName ||
330
336
featurenode . nodeName . split ( ":" ) . pop ( ) ;
331
337
this . readChildNodes ( node , obj ) ;
332
338
}
333
339
} ,
334
340
"Server" : function ( node , obj ) {
335
341
// 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 !=
338
344
OpenLayers . Format . Context . serviceTypes . WMS ) ) {
339
345
obj . service = node . getAttribute ( "service" ) ;
340
346
obj . version = node . getAttribute ( "version" ) ;
@@ -363,7 +369,7 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
363
369
this . readChildNodes ( node , legend ) ;
364
370
} ,
365
371
"OnlineResource" : function ( node , obj ) {
366
- obj . url = this . getAttributeNS ( node , this . namespaces . xlink ,
372
+ obj . url = this . getAttributeNS ( node , this . namespaces . xlink ,
367
373
"href" ) ;
368
374
this . readChildNodes ( node , obj ) ;
369
375
}
@@ -387,11 +393,11 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
387
393
attributes : {
388
394
version : this . VERSION ,
389
395
id : options . id || OpenLayers . Util . createUniqueID ( "OpenLayers_OWSContext_" )
390
- }
391
- } ) ;
396
+ }
397
+ } ) ;
392
398
this . writeNode ( "General" , options , node ) ;
393
399
this . writeNode ( "ResourceList" , options , node ) ;
394
- return node ;
400
+ return node ;
395
401
} ,
396
402
"General" : function ( options ) {
397
403
var node = this . createElementNSPlus ( "General" ) ;
@@ -473,7 +479,7 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
473
479
} ) ;
474
480
this . writeNode ( "ows:Title" , layer . name , node ) ;
475
481
this . writeNode ( "ows:OutputFormat" , layer . params . FORMAT , node ) ;
476
- this . writeNode ( "Server" , { service :
482
+ this . writeNode ( "Server" , { service :
477
483
OpenLayers . Format . Context . serviceTypes . WMS ,
478
484
version : layer . params . VERSION , url : layer . url } , node ) ;
479
485
if ( layer . metadata . styles && layer . metadata . styles . length > 0 ) {
@@ -488,7 +494,7 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
488
494
node = null ;
489
495
title = null ;
490
496
// 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
492
498
// real writer is called and nodes are returned.
493
499
if ( subPaths . length > 0 ) {
494
500
var path = subPaths [ 0 ] . join ( "/" ) ;
@@ -527,11 +533,11 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
527
533
}
528
534
}
529
535
if ( layer . options . maxScale ) {
530
- this . writeNode ( "sld:MinScaleDenominator" ,
536
+ this . writeNode ( "sld:MinScaleDenominator" ,
531
537
layer . options . maxScale , node ) ;
532
538
}
533
539
if ( layer . options . minScale ) {
534
- this . writeNode ( "sld:MaxScaleDenominator" ,
540
+ this . writeNode ( "sld:MaxScaleDenominator" ,
535
541
layer . options . minScale , node ) ;
536
542
}
537
543
this . nestingLayerLookup [ layer . name ] = node ;
@@ -544,9 +550,9 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
544
550
hidden : layer . visibility ? "0" : "1" }
545
551
} ) ;
546
552
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 ,
550
556
url : layer . protocol . url } , node ) ;
551
557
return node ;
552
558
} ,
@@ -562,18 +568,18 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
562
568
"_GML" : function ( layer ) {
563
569
var node = this . createElementNSPlus ( "Layer" ) ;
564
570
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 :
568
574
layer . protocol . format . version } , node ) ;
569
575
return node ;
570
576
} ,
571
577
"_KML" : function ( layer ) {
572
578
var node = this . createElementNSPlus ( "Layer" ) ;
573
579
this . writeNode ( "ows:Title" , layer . name , node ) ;
574
- this . writeNode ( "Server" , { service :
580
+ this . writeNode ( "Server" , { service :
575
581
OpenLayers . Format . Context . serviceTypes . KML ,
576
- version : layer . protocol . format . version , url :
582
+ version : layer . protocol . format . version , url :
577
583
layer . protocol . url } , node ) ;
578
584
return node ;
579
585
}
@@ -589,7 +595,7 @@ OpenLayers.Format.OWSContext.v0_3_1 = OpenLayers.Class(OpenLayers.Format.XML, {
589
595
"sld" : OpenLayers . Format . SLD . v1_0_0 . prototype . writers . sld ,
590
596
"feature" : OpenLayers . Format . GML . v2 . prototype . writers . feature
591
597
} ,
592
-
593
- CLASS_NAME : "OpenLayers.Format.OWSContext.v0_3_1"
598
+
599
+ CLASS_NAME : "OpenLayers.Format.OWSContext.v0_3_1"
594
600
595
601
} ) ;
0 commit comments