Changeset 12065 in josm for trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
- Timestamp:
- 2017-05-05T16:27:43+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r12060 r12065 715 715 if (startEN == null) return false; // fix #8128 716 716 ds.beginUpdate(); 717 if (c instanceof MoveCommand && affectedNodes.equals(((MoveCommand) c).getParticipatingPrimitives())) { 718 ((MoveCommand) c).saveCheckpoint(); 719 ((MoveCommand) c).applyVectorTo(currentEN); 720 } else { 721 c = new MoveCommand(selection, startEN, currentEN); 722 Main.main.undoRedo.add(c); 723 } 724 for (Node n : affectedNodes) { 725 LatLon ll = n.getCoor(); 726 if (ll != null && ll.isOutSideWorld()) { 727 // Revert move 728 ((MoveCommand) c).resetToCheckpoint(); 729 ds.endUpdate(); 730 JOptionPane.showMessageDialog( 731 Main.parent, 732 tr("Cannot move objects outside of the world."), 733 tr("Warning"), 734 JOptionPane.WARNING_MESSAGE); 735 mv.setNewCursor(cursor, this); 736 return false; 737 } 717 try { 718 if (c instanceof MoveCommand && affectedNodes.equals(((MoveCommand) c).getParticipatingPrimitives())) { 719 ((MoveCommand) c).saveCheckpoint(); 720 ((MoveCommand) c).applyVectorTo(currentEN); 721 } else { 722 c = new MoveCommand(selection, startEN, currentEN); 723 Main.main.undoRedo.add(c); 724 } 725 for (Node n : affectedNodes) { 726 LatLon ll = n.getCoor(); 727 if (ll != null && ll.isOutSideWorld()) { 728 // Revert move 729 ((MoveCommand) c).resetToCheckpoint(); 730 // TODO: We might use a simple notification in the lower left corner. 731 JOptionPane.showMessageDialog( 732 Main.parent, 733 tr("Cannot move objects outside of the world."), 734 tr("Warning"), 735 JOptionPane.WARNING_MESSAGE); 736 mv.setNewCursor(cursor, this); 737 return false; 738 } 739 } 740 } finally { 741 ds.endUpdate(); 738 742 } 739 743 } else { … … 745 749 746 750 ds.beginUpdate(); 747 748 if (mode == Mode.ROTATE) { 749 if (c instanceof RotateCommand && affectedNodes.equals(((RotateCommand) c).getTransformedNodes())) { 750 ((RotateCommand) c).handleEvent(currentEN); 751 } else { 752 Main.main.undoRedo.add(new RotateCommand(selection, currentEN)); 753 } 754 } else if (mode == Mode.SCALE) { 755 if (c instanceof ScaleCommand && affectedNodes.equals(((ScaleCommand) c).getTransformedNodes())) { 756 ((ScaleCommand) c).handleEvent(currentEN); 757 } else { 758 Main.main.undoRedo.add(new ScaleCommand(selection, currentEN)); 759 } 760 } 761 762 Collection<Way> ways = ds.getSelectedWays(); 763 if (doesImpactStatusLine(affectedNodes, ways)) { 764 Main.map.statusLine.setDist(ways); 765 } 766 } 767 ds.endUpdate(); 751 try { 752 if (mode == Mode.ROTATE) { 753 if (c instanceof RotateCommand && affectedNodes.equals(((RotateCommand) c).getTransformedNodes())) { 754 ((RotateCommand) c).handleEvent(currentEN); 755 } else { 756 Main.main.undoRedo.add(new RotateCommand(selection, currentEN)); 757 } 758 } else if (mode == Mode.SCALE) { 759 if (c instanceof ScaleCommand && affectedNodes.equals(((ScaleCommand) c).getTransformedNodes())) { 760 ((ScaleCommand) c).handleEvent(currentEN); 761 } else { 762 Main.main.undoRedo.add(new ScaleCommand(selection, currentEN)); 763 } 764 } 765 766 Collection<Way> ways = ds.getSelectedWays(); 767 if (doesImpactStatusLine(affectedNodes, ways)) { 768 Main.map.statusLine.setDist(ways); 769 } 770 } finally { 771 ds.endUpdate(); 772 } 773 } 768 774 return true; 769 775 } … … 907 913 Command c = getLastCommandInDataset(ds); 908 914 ds.beginUpdate(); 909 if (c instanceof MoveCommand && affectedNodes.equals(((MoveCommand) c).getParticipatingPrimitives())) { 910 Node selectedNode = selNodes.iterator().next(); 911 EastNorth selectedEN = selectedNode.getEastNorth(); 912 EastNorth targetEN = target.getEastNorth(); 913 ((MoveCommand) c).moveAgain(targetEN.getX() - selectedEN.getX(), 914 targetEN.getY() - selectedEN.getY()); 915 } 916 ds.endUpdate(); 915 try { 916 if (c instanceof MoveCommand && affectedNodes.equals(((MoveCommand) c).getParticipatingPrimitives())) { 917 Node selectedNode = selNodes.iterator().next(); 918 EastNorth selectedEN = selectedNode.getEastNorth(); 919 EastNorth targetEN = target.getEastNorth(); 920 ((MoveCommand) c).moveAgain(targetEN.getX() - selectedEN.getX(), 921 targetEN.getY() - selectedEN.getY()); 922 } 923 } finally { 924 ds.endUpdate(); 925 } 917 926 } 918 927
Note:
See TracChangeset
for help on using the changeset viewer.