Changeset 6 in josm for src/org/openstreetmap/josm/io/GpxReader.java
- Timestamp:
- 2005-10-01T04:01:45+02:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/io/GpxReader.java
r2 r6 15 15 import org.openstreetmap.josm.data.osm.Track; 16 16 import org.openstreetmap.josm.data.osm.LineSegment; 17 import org.openstreetmap.josm.gui.Main; 17 18 18 19 /** … … 70 71 data.allNodes = new LinkedList<Node>(); 71 72 for (Object o : e.getChildren("wpt", GPX)) 72 data.allNodes.add(parseWaypoint((Element)o));73 addNode(data, parseWaypoint((Element)o)); 73 74 74 75 // read tracks … … 79 80 for (Object w : ((Element)trackSegmentElement).getChildren("trkpt", GPX)) { 80 81 Node node = parseWaypoint((Element)w); 81 data.allNodes.add(node);82 node = addNode(data, node); 82 83 if (start == null) 83 84 start = node; … … 96 97 return data; 97 98 } 99 100 /** 101 * Adds the node to allNodes if it is not already listed. Does respect the 102 * preference setting "mergeNodes". Return the node in the list that correspond 103 * to the node in the list (either the new added or the old found). 104 * 105 * @param data The DataSet to add the node to. 106 * @param node The node that should be added. 107 * @return Either the parameter node or the old node found in the dataset. 108 */ 109 private Node addNode (DataSet data, Node node) { 110 if (Main.pref.mergeNodes) 111 for (Node n : data.allNodes) 112 if (node.equals(n)) 113 return n; 114 data.allNodes.add(node); 115 return node; 116 } 98 117 }
Note:
See TracChangeset
for help on using the changeset viewer.