Changeset 868 in josm for trunk/src/org
- Timestamp:
- 2008-08-25T18:10:18+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r860 r868 182 182 virtualNode = null; 183 183 } 184 185 Collection<OsmPrimitive> selection = Main.ds.getSelected(); 186 Collection<Node> affectedNodes = AllNodesVisitor.getAllNodes(selection); 187 188 // when rotating, having only one node makes no sense - quit silently 189 if (mode == Mode.rotate && affectedNodes.size() < 2) 190 return; 191 192 Command c = !Main.main.undoRedo.commands.isEmpty() 193 ? Main.main.undoRedo.commands.getLast() : null; 194 if(c instanceof SequenceCommand) 195 c = ((SequenceCommand)c).getLastCommand(); 196 197 if (mode == Mode.move) { 198 if (c instanceof MoveCommand && affectedNodes.equals(((MoveCommand)c).objects)) 199 ((MoveCommand)c).moveAgain(dx,dy); 200 else 201 Main.main.undoRedo.add( 202 c = new MoveCommand(selection, dx, dy)); 203 204 for (Node n : affectedNodes) { 205 if (n.coor.isOutSideWorld()) { 206 // Revert move 207 ((MoveCommand) c).moveAgain(-dx, -dy); 208 209 JOptionPane.showMessageDialog(Main.parent, 210 tr("Cannot move objects outside of the world.")); 211 return; 184 else 185 { 186 Collection<OsmPrimitive> selection = Main.ds.getSelected(); 187 Collection<Node> affectedNodes = AllNodesVisitor.getAllNodes(selection); 188 189 // when rotating, having only one node makes no sense - quit silently 190 if (mode == Mode.rotate && affectedNodes.size() < 2) 191 return; 192 193 Command c = !Main.main.undoRedo.commands.isEmpty() 194 ? Main.main.undoRedo.commands.getLast() : null; 195 if(c instanceof SequenceCommand) 196 c = ((SequenceCommand)c).getLastCommand(); 197 198 if (mode == Mode.move) { 199 if (c instanceof MoveCommand && affectedNodes.equals(((MoveCommand)c).objects)) 200 ((MoveCommand)c).moveAgain(dx,dy); 201 else 202 Main.main.undoRedo.add( 203 c = new MoveCommand(selection, dx, dy)); 204 205 for (Node n : affectedNodes) { 206 if (n.coor.isOutSideWorld()) { 207 // Revert move 208 ((MoveCommand) c).moveAgain(-dx, -dy); 209 210 JOptionPane.showMessageDialog(Main.parent, 211 tr("Cannot move objects outside of the world.")); 212 return; 213 } 212 214 } 215 } else if (mode == Mode.rotate) { 216 if (c instanceof RotateCommand && affectedNodes.equals(((RotateCommand)c).objects)) 217 ((RotateCommand)c).rotateAgain(mouseStartEN, mouseEN); 218 else 219 Main.main.undoRedo.add(new RotateCommand(selection, mouseStartEN, mouseEN)); 213 220 } 214 } else if (mode == Mode.rotate) {215 if (c instanceof RotateCommand && affectedNodes.equals(((RotateCommand)c).objects))216 ((RotateCommand)c).rotateAgain(mouseStartEN, mouseEN);217 else218 Main.main.undoRedo.add(new RotateCommand(selection, mouseStartEN, mouseEN));219 221 } 220 222
Note:
See TracChangeset
for help on using the changeset viewer.