OpenLayers OpenLayers

Changeset 3096

Show
Ignore:
Timestamp:
04/26/07 09:31:46 (2 years ago)
Author:
crschmidt
Message:

Add GML format test, which for the time being only has a constructor and
getFID tests, to test for broken fid parser, patch provided by Andreas
Hocevar in #679 .

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Format/GML.js

    r3043 r3096  
    8585        var feature = new OpenLayers.Feature.Vector(); 
    8686 
    87         if (xmlNode.firstChild.attributes && xmlNode.firstChild.attributes['fid']) { 
    88             feature.fid = xmlNode.firstChild.attributes['fid'].nodeValue; 
    89         } 
    90          
    9187        // match MultiPolygon 
    9288        if (OpenLayers.Ajax.getElementsByTagNameNS(xmlNode, this.gmlns, "gml", "MultiPolygon").length != 0) { 
    9389            var multipolygon = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode, this.gmlns, "gml", "MultiPolygon")[0]; 
     90            feature.fid = multipolygon.parentNode.parentNode.getAttribute('fid'); 
     91 
    9492            geom = new OpenLayers.Geometry.MultiPolygon(); 
    9593            var polygons = OpenLayers.Ajax.getElementsByTagNameNS(multipolygon, 
     
    105103            var multilinestring = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode, 
    106104            this.gmlns, "gml", "MultiLineString")[0]; 
     105            feature.fid = multilinestring.parentNode.parentNode.getAttribute('fid'); 
    107106             
    108107            geom = new OpenLayers.Geometry.MultiLineString(); 
     
    123122            var multiPoint = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode, 
    124123                this.gmlns, "gml", "MultiPoint")[0]; 
     124            feature.fid = multiPoint.parentNode.parentNode.getAttribute('fid'); 
    125125                 
    126126            geom = new OpenLayers.Geometry.MultiPoint(); 
     
    139139            var polygon = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode, 
    140140                this.gmlns, "gml", "Polygon")[0]; 
     141            feature.fid = polygon.parentNode.parentNode.getAttribute('fid'); 
    141142             
    142143            geom = this.parsePolygonNode(polygon); 
     
    147148            var lineString = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode, 
    148149                this.gmlns, "gml", "LineString")[0]; 
     150            feature.fid = lineString.parentNode.parentNode.getAttribute('fid'); 
     151 
    149152            p = this.parseCoords(lineString); 
    150153            if (p.points) { 
     
    158161            var point = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode, 
    159162                this.gmlns, "gml", "Point")[0]; 
     163            feature.fid = point.parentNode.parentNode.getAttribute('fid'); 
    160164             
    161165            p = this.parseCoords(point); 
  • trunk/openlayers/tests/list-tests.html

    r3076 r3096  
    1818    <li>Geometry/test_Surface.html</li> 
    1919    <li>test_Format.html</li> 
     20    <li>Format/test_GML.html</li> 
    2021    <li>Format/test_WKT.html</li> 
    2122    <li>test_Icon.html</li>