Changeset 8343 in josm for trunk/src/org
- Timestamp:
- 2015-05-10T00:55:10+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r8338 r8343 856 856 return; 857 857 858 if (selNodes.size() == 1) { 859 // Move all selected primitive to preserve shape #10748 860 Collection<OsmPrimitive> selection = 861 getCurrentDataSet().getSelectedNodesAndWays(); 862 Collection<Node> affectedNodes = AllNodesVisitor.getAllNodes(selection); 863 Command c = getLastCommand(); 864 getCurrentDataSet().beginUpdate(); 865 if (c instanceof MoveCommand 866 && affectedNodes.equals(((MoveCommand) c).getParticipatingPrimitives())) { 867 Node selectedNode = selNodes.iterator().next(); 868 EastNorth selectedEN = selectedNode.getEastNorth(); 869 EastNorth targetEN = target.getEastNorth(); 870 ((MoveCommand) c).moveAgain(targetEN.getX() - selectedEN.getX(), 871 targetEN.getY() - selectedEN.getY()); 872 } 873 getCurrentDataSet().endUpdate(); 874 } 875 858 876 Collection<Node> nodesToMerge = new LinkedList<>(selNodes); 859 877 nodesToMerge.add(target); 860 MergeNodesAction.doMergeNodes(Main.main.getEditLayer(), nodesToMerge, target); 878 mergeNodes(Main.main.getEditLayer(), nodesToMerge, target); 879 } 880 881 /** 882 * Merge nodes using {@code MergeNodesAction}. 883 * Can be overridden for testing purpose. 884 * @param layer layer the reference data layer. Must not be null 885 * @param nodes the collection of nodes. Ignored if null 886 * @param targetLocationNode this node's location will be used for the target node 887 */ 888 public void mergeNodes(OsmDataLayer layer, Collection<Node> nodes, 889 Node targetLocationNode) { 890 MergeNodesAction.doMergeNodes(layer, nodes, targetLocationNode); 861 891 } 862 892
Note:
See TracChangeset
for help on using the changeset viewer.