diff --git src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java
index c4895b556..2ab6d49a9 100644
|
|
|
public class ImproveWayAccuracyAction extends MapMode implements DataSelectionLi
|
| 511 | 511 | |
| 512 | 512 | UndoRedoHandler.getInstance().add( |
| 513 | 513 | new MoveCommand(candidateNode, cursorEN.east() - nodeEN.east(), cursorEN.north() - nodeEN.north())); |
| | 514 | |
| | 515 | SelectAction.checkCommandForLargeDistance(UndoRedoHandler.getInstance().getLastCommand()); |
| 514 | 516 | } |
| 515 | 517 | } |
| 516 | 518 | |
diff --git src/org/openstreetmap/josm/actions/mapmode/SelectAction.java src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
index bd7e9c22f..6983b3d58 100644
|
|
|
public class SelectAction extends MapMode implements ModifierExListener, KeyPres
|
| 837 | 837 | ed.toggleEnable("movedHiddenElements"); |
| 838 | 838 | showConfirmMoveDialog(ed); |
| 839 | 839 | } |
| | 840 | |
| 840 | 841 | final Command lastCommand = UndoRedoHandler.getInstance().getLastCommand(); |
| 841 | 842 | if (lastCommand == null) { |
| 842 | 843 | Logging.warn("No command found in undo/redo history, skipping confirmOrUndoMovement"); |
| 843 | 844 | return; |
| 844 | 845 | } |
| | 846 | |
| | 847 | SelectAction.checkCommandForLargeDistance(lastCommand); |
| | 848 | |
| 845 | 849 | final int moveCount = lastCommand.getParticipatingPrimitives().size(); |
| 846 | | if (lastCommand instanceof MoveCommand) { |
| 847 | | final double moveDistance = ((MoveCommand) lastCommand).getDistance(n -> !n.isNew()); |
| 848 | | if (Double.isFinite(moveDistance) && moveDistance > Config.getPref().getInt("warn.move.maxdistance", 200)) { |
| 849 | | final ConfirmMoveDialog ed = new ConfirmMoveDialog(); |
| 850 | | ed.setContent(trn( |
| 851 | | "You moved {0} element by a distance of {1}. " |
| 852 | | + "Moving elements by a large distance is often an error.\n" + "Really move them?", |
| 853 | | "You moved {0} elements by a distance of {1}. " |
| 854 | | + "Moving elements by a large distance is often an error.\n" + "Really move them?", |
| 855 | | moveCount, moveCount, SystemOfMeasurement.getSystemOfMeasurement().getDistText(moveDistance))); |
| 856 | | ed.toggleEnable("movedLargeDistance"); |
| 857 | | showConfirmMoveDialog(ed); |
| 858 | | } |
| 859 | | } |
| 860 | | int max = Config.getPref().getInt("warn.move.maxelements", 20); |
| | 850 | final int max = Config.getPref().getInt("warn.move.maxelements", 20); |
| 861 | 851 | if (moveCount > max) { |
| 862 | 852 | final ConfirmMoveDialog ed = new ConfirmMoveDialog(); |
| 863 | 853 | ed.setContent( |
| … |
… |
public class SelectAction extends MapMode implements ModifierExListener, KeyPres
|
| 874 | 864 | } |
| 875 | 865 | } |
| 876 | 866 | |
| 877 | | private void showConfirmMoveDialog(ConfirmMoveDialog ed) { |
| | 867 | static void checkCommandForLargeDistance(Command lastCommand) { |
| | 868 | final int moveCount = lastCommand.getParticipatingPrimitives().size(); |
| | 869 | if (lastCommand instanceof MoveCommand) { |
| | 870 | final double moveDistance = ((MoveCommand) lastCommand).getDistance(n -> !n.isNew()); |
| | 871 | if (Double.isFinite(moveDistance) && moveDistance > Config.getPref().getInt("warn.move.maxdistance", 200)) { |
| | 872 | final ConfirmMoveDialog ed = new ConfirmMoveDialog(); |
| | 873 | ed.setContent(trn( |
| | 874 | "You moved {0} element by a distance of {1}. " |
| | 875 | + "Moving elements by a large distance is often an error.\n" + "Really move them?", |
| | 876 | "You moved {0} elements by a distance of {1}. " |
| | 877 | + "Moving elements by a large distance is often an error.\n" + "Really move them?", |
| | 878 | moveCount, moveCount, SystemOfMeasurement.getSystemOfMeasurement().getDistText(moveDistance))); |
| | 879 | ed.toggleEnable("movedLargeDistance"); |
| | 880 | showConfirmMoveDialog(ed); |
| | 881 | } |
| | 882 | } |
| | 883 | } |
| | 884 | |
| | 885 | private static void showConfirmMoveDialog(ConfirmMoveDialog ed) { |
| 878 | 886 | if (ed.showDialog().getValue() != 1) { |
| 879 | 887 | UndoRedoHandler.getInstance().undo(); |
| 880 | 888 | } |