Ignore:
Timestamp:
2005-10-01T04:01:45+02:00 (19 years ago)
Author:
imi
Message:
  • pretty preferrences menu
  • drawing double circles on double position hit
  • mergeNodes option
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/io/GpxReader.java

    r2 r6  
    1515import org.openstreetmap.josm.data.osm.Track;
    1616import org.openstreetmap.josm.data.osm.LineSegment;
     17import org.openstreetmap.josm.gui.Main;
    1718
    1819/**
     
    7071                data.allNodes = new LinkedList<Node>();
    7172                for (Object o : e.getChildren("wpt", GPX))
    72                         data.allNodes.add(parseWaypoint((Element)o));
     73                        addNode(data, parseWaypoint((Element)o));
    7374
    7475                // read tracks
     
    7980                                for (Object w : ((Element)trackSegmentElement).getChildren("trkpt", GPX)) {
    8081                                        Node node = parseWaypoint((Element)w);
    81                                         data.allNodes.add(node);
     82                                        node = addNode(data, node);
    8283                                        if (start == null)
    8384                                                start = node;
     
    9697                return data;
    9798        }
     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        }
    98117}
Note: See TracChangeset for help on using the changeset viewer.