Changeset 5989 in josm
- Timestamp:
- 2013-06-05T00:26:22+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java
r5818 r5989 153 153 */ 154 154 public static Node selectTargetNode(Collection<Node> candidates) { 155 Node oldestNode = null; 155 156 Node targetNode = null; 156 157 Node lastNode = null; 157 158 for (Node n : candidates) { 158 159 if (!n.isNew()) { 159 if (targetNode == null) { 160 targetNode = n; 161 } else if (n.getId() < targetNode.getId()) { 162 targetNode = n; 160 // Among existing nodes, try to keep the oldest used one 161 if (!n.getReferrers().isEmpty()) { 162 if (targetNode == null) { 163 targetNode = n; 164 } else if (n.getId() < targetNode.getId()) { 165 targetNode = n; 166 } 167 } else if (oldestNode == null) { 168 oldestNode = n; 169 } else if (n.getId() < oldestNode.getId()) { 170 oldestNode = n; 163 171 } 164 172 } … … 166 174 } 167 175 if (targetNode == null) { 168 targetNode = lastNode;176 targetNode = (oldestNode != null ? oldestNode : lastNode); 169 177 } 170 178 return targetNode;
Note:
See TracChangeset
for help on using the changeset viewer.