Ticket #1566: addTypeName2feature.patch
| File addTypeName2feature.patch, 1.7 kB (added by openlayers, 6 months ago) |
|---|
-
tests/Format/GML.html
old new 14 14 t.eq(typeof format.read, "function", "format has a read function"); 15 15 t.eq(typeof format.write, "function", "format has a write function"); 16 16 } 17 function test_Format_GML_getTypeName(t) { 18 t.plan(2); 19 var parser = new OpenLayers.Format.GML(); 20 data = parser.read(test_content[1]); 21 t.eq(data[0].typeName, 'scribble', 'typeName set correctly once'); 22 t.eq(data[1].typeName, 'scribble', 'typeName set correctly twice'); 23 } 17 24 function test_Format_GML_getFid(t) { 18 25 t.plan(2); 19 26 var parser = new OpenLayers.Format.GML(); -
lib/OpenLayers/Format/GML.js
old new 170 170 var feature = new OpenLayers.Feature.Vector(geometry, attributes); 171 171 // assign fid - this can come from a "fid" or "id" attribute 172 172 var childNode = node.firstChild; 173 var fid;173 var typeName, fid; 174 174 while(childNode) { 175 175 if(childNode.nodeType == 1) { 176 typeName = (childNode.prefix) ? childNode.nodeName.split(":")[1] : childNode.nodeName; 176 177 fid = childNode.getAttribute("fid") || 177 178 childNode.getAttribute("id"); 178 179 if(fid) { … … 181 182 } 182 183 childNode = childNode.nextSibling; 183 184 } 184 feature.fid = fid; 185 feature.typeName = typeName; 186 feature.fid = fid; 185 187 return feature; 186 188 }, 187 189
