Changeset 7511
- Timestamp:
- 07/15/08 16:13:53 (1 month ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/topp/trimet/lib/OpenLayers/Format/GML/Base.js
r7496 r7511 38 38 39 39 /** 40 * APIProperty: typeName41 * {String} The feature typeName.42 */ 43 typeName: null,40 * APIProperty: featureType 41 * {String} The local (without prefix) feature typeName. 42 */ 43 featureType: null, 44 44 45 45 /** … … 90 90 * 91 91 * Valid options properties: 92 * typeName - {String} Feature typeName (required).92 * featureType - {String} Local (without prefix) feature typeName (required). 93 93 * featureNS - {String} Feature namespace (required). 94 94 * geometryName - {String} Geometry element name. … … 149 149 "gml": { 150 150 "featureMember": function(node, obj) { 151 this.readChildNodes(node, feature);151 this.readChildNodes(node, obj); 152 152 }, 153 153 "featureMembers": function(node, obj) { 154 this.readChildNodes(node, feature);154 this.readChildNodes(node, obj); 155 155 }, 156 156 "Point": function(node, container) { … … 254 254 }, 255 255 "MultiLineString": function(node, container) { 256 var obj = { };256 var obj = {components: []}; 257 257 this.readChildNodes(node, obj); 258 258 container.components = [ 259 259 new OpenLayers.Geometry.MultiLineString(obj.components) 260 260 ]; 261 }, 262 "lineStringMember": function(node, obj) { 263 this.readChildNodes(node, obj); 261 264 }, 262 265 "Polygon": function(node, container) { … … 295 298 "feature": { 296 299 "*": function(node, obj) { 297 // The node can either be named like the typeName, or it298 // can be a child of the feature: typeName. Children can be300 // The node can either be named like the featureType, or it 301 // can be a child of the feature:featureType. Children can be 299 302 // geometry or attributes. 300 303 var name; 301 304 var local = node.nodeName.split(":").pop(); 302 if(local == this. typeName) {305 if(local == this.featureType) { 303 306 name = "_typeName"; 304 307 } else { … … 314 317 }, 315 318 "_typeName": function(node, obj) { 316 var feature = new OpenLayers.Feature.Vector(); 319 var container = {components: [], attributes: {}}; 320 this.readChildNodes(node, container); 321 var feature = new OpenLayers.Feature.Vector( 322 container.components[0], container.attributes 323 ); 317 324 var fid = node.getAttribute("fid"); 318 325 if(fid) { 319 326 feature.fid = fid; 320 327 } 321 var container = {components: []};322 this.readChildNodes(node, container);323 feature.geometry = container.components[0];324 328 obj.features.push(feature); 325 329 }, 326 "_geometry": function(node, feature) {327 this.readChildNodes(node, feature);328 }, 329 "_attribute": function(node, feature) {330 "_geometry": function(node, obj) { 331 this.readChildNodes(node, obj); 332 }, 333 "_attribute": function(node, obj) { 330 334 var local = node.nodeName.split(":").pop(); 331 335 var value = this.getChildValue(node); 332 feature.attributes[local] = value;336 obj.attributes[local] = value; 333 337 } 334 338 } … … 454 458 "feature": { 455 459 "_typeName": function(feature) { 456 var node = this.createElementNSPlus("feature:" + this. typeName);460 var node = this.createElementNSPlus("feature:" + this.featureType); 457 461 if(feature.geometry) { 458 462 this.writeNode(node, "feature:_geometry", feature.geometry);
