OpenLayers OpenLayers

Changeset 7511

Show
Ignore:
Timestamp:
07/15/08 16:13:53 (1 month ago)
Author:
tschaub
Message:

correctly parsing multilinestring

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/topp/trimet/lib/OpenLayers/Format/GML/Base.js

    r7496 r7511  
    3838     
    3939    /** 
    40      * APIProperty: typeNam
    41      * {String} The feature typeName. 
    42      */ 
    43     typeName: null, 
     40     * APIProperty: featureTyp
     41     * {String} The local (without prefix) feature typeName. 
     42     */ 
     43    featureType: null, 
    4444     
    4545    /** 
     
    9090     * 
    9191     * Valid options properties: 
    92      * typeName - {String} Feature typeName (required). 
     92     * featureType - {String} Local (without prefix) feature typeName (required). 
    9393     * featureNS - {String} Feature namespace (required). 
    9494     * geometryName - {String} Geometry element name. 
     
    149149        "gml": { 
    150150            "featureMember": function(node, obj) { 
    151                 this.readChildNodes(node, feature); 
     151                this.readChildNodes(node, obj); 
    152152            }, 
    153153            "featureMembers": function(node, obj) { 
    154                 this.readChildNodes(node, feature);                 
     154                this.readChildNodes(node, obj);                 
    155155            }, 
    156156            "Point": function(node, container) { 
     
    254254            }, 
    255255            "MultiLineString": function(node, container) { 
    256                 var obj = {}; 
     256                var obj = {components: []}; 
    257257                this.readChildNodes(node, obj); 
    258258                container.components = [ 
    259259                    new OpenLayers.Geometry.MultiLineString(obj.components) 
    260260                ]; 
     261            }, 
     262            "lineStringMember": function(node, obj) { 
     263                this.readChildNodes(node, obj); 
    261264            }, 
    262265            "Polygon": function(node, container) { 
     
    295298        "feature": { 
    296299            "*": function(node, obj) { 
    297                 // The node can either be named like the typeName, or it 
    298                 // can be a child of the feature:typeName.  Children can be 
     300                // The node can either be named like the featureType, or it 
     301                // can be a child of the feature:featureType.  Children can be 
    299302                // geometry or attributes. 
    300303                var name; 
    301304                var local = node.nodeName.split(":").pop(); 
    302                 if(local == this.typeName) { 
     305                if(local == this.featureType) { 
    303306                    name = "_typeName"; 
    304307                } else { 
     
    314317            }, 
    315318            "_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                ); 
    317324                var fid = node.getAttribute("fid"); 
    318325                if(fid) { 
    319326                    feature.fid = fid; 
    320327                } 
    321                 var container = {components: []}; 
    322                 this.readChildNodes(node, container); 
    323                 feature.geometry = container.components[0]; 
    324328                obj.features.push(feature); 
    325329            }, 
    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) { 
    330334                var local = node.nodeName.split(":").pop(); 
    331335                var value = this.getChildValue(node); 
    332                 feature.attributes[local] = value; 
     336                obj.attributes[local] = value; 
    333337            } 
    334338        } 
     
    454458        "feature": { 
    455459            "_typeName": function(feature) { 
    456                 var node = this.createElementNSPlus("feature:" + this.typeName); 
     460                var node = this.createElementNSPlus("feature:" + this.featureType); 
    457461                if(feature.geometry) { 
    458462                    this.writeNode(node, "feature:_geometry", feature.geometry);