Changeset 9529
- Timestamp:
- 06/30/09 06:28:30 (9 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/bartvde/owscontext/openlayers/lib/OpenLayers/Format/OWSContext/v0_3_1.js
r9422 r9529 239 239 context.layers = []; 240 240 this.readNode(data, context); 241 241 242 // we need to do postprocessing since we do not know the layer type 242 243 // at the time we parse the Layer node 243 for (var i=0, len=context.layerInfo.length; i<len; i++) { 244 var layer = this.getLayerFromInfo(context.layerInfo[i]); 245 if (layer !== null) { 246 context.layers.push(layer); 247 } 248 } 249 delete context.layerInfo; 244 245 // since an OWSContext can be nested we need to go through this 246 // structure recursively 247 this.processLayer(context.layers, context); 250 248 return context; 249 }, 250 251 /** 252 * Method: processLayer 253 * Recursive function to process a layer and their childLayers 254 * 255 * Parameters: 256 * layer - {Object} layerInfo object 257 */ 258 processLayer: function(layerArray, layer) { 259 if (layer.layerInfo) { 260 for (var i=0, len = layer.layerInfo.length; i<len; i++) { 261 var l = layer.layerInfo[i]; 262 var layerObj = this.getLayerFromInfo(l); 263 if (layerObj != null) { 264 layerArray.push(layerObj); 265 } 266 if (l.layerInfo) { 267 this.processLayer(layerArray, l); 268 } 269 } 270 } 251 271 }, 252 272 … … 294 314 }, 295 315 "ResourceList": function(node, obj) { 296 obj.layerInfo = [];297 316 this.readChildNodes(node, obj); 298 317 }, … … 305 324 name: node.getAttribute("name") 306 325 }; 326 if (!obj.layerInfo) { 327 obj.layerInfo = []; 328 } 307 329 obj.layerInfo.push(layerInfo); 308 330 this.readChildNodes(node, layerInfo);
