Ticket #5531: merge-node-averaging.patch
| File merge-node-averaging.patch, 1.5 KB (added by , 16 years ago) |
|---|
-
src/org/openstreetmap/josm/actions/MergeNodesAction.java
25 25 import org.openstreetmap.josm.command.Command; 26 26 import org.openstreetmap.josm.command.DeleteCommand; 27 27 import org.openstreetmap.josm.command.SequenceCommand; 28 import org.openstreetmap.josm.data.coor.LatLon; 28 29 import org.openstreetmap.josm.data.osm.Node; 29 30 import org.openstreetmap.josm.data.osm.OsmPrimitive; 30 31 import org.openstreetmap.josm.data.osm.RelationToChildReference; … … 87 88 * @return the coordinates of this node are later used for the target node 88 89 */ 89 90 public static Node selectTargetLocationNode(LinkedHashSet<Node> candidates) { 90 Node targetNode = null; 91 for (Node n : candidates) { // pick last one 92 targetNode = n; 91 if (!Main.pref.getBoolean("merge.average-location", false)) { 92 Node targetNode = null; 93 for (final Node n : candidates) { // pick last one 94 targetNode = n; 95 } 96 return targetNode; 93 97 } 94 return targetNode; 98 99 double lat = 0, lon = 0; 100 for (final Node n : candidates) { 101 lat += n.getCoor().lat(); 102 lon += n.getCoor().lon(); 103 } 104 105 return new Node(new LatLon(lat / candidates.size(), lon / candidates.size())); 95 106 } 96 107 97 108 /**
