Changeset 12065 in josm
- Timestamp:
- 2017-05-05T16:27:43+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 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 -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r12062 r12065 1228 1228 public void invalidateEastNorthCache() { 1229 1229 if (Main.getProjection() == null) return; // sanity check 1230 beginUpdate(); 1230 1231 try { 1231 beginUpdate();1232 1232 for (Node n: getNodes()) { 1233 1233 n.invalidateEastNorthCache(); -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r11848 r12065 293 293 boolean isAtOldPosition = mouseNotMoved && popup != null; 294 294 boolean middleMouseDown = (ms.modifiers & MouseEvent.BUTTON2_DOWN_MASK) != 0; 295 296 ds = mv.getLayerManager().getEditDataSet(); 297 if (ds != null) { 298 // This is not perfect, if current dataset was changed during execution, the lock would be useless 299 if (isAtOldPosition && middleMouseDown) { 300 // Write lock is necessary when selecting in popupCycleSelection 301 // locks can not be upgraded -> if do read lock here and write lock later 302 // (in OsmPrimitive.updateFlags) then always occurs deadlock (#5814) 303 ds.beginUpdate(); 304 } else { 305 ds.getReadLock().lock(); 306 } 307 } 295 308 try { 296 ds = mv.getLayerManager().getEditDataSet();297 if (ds != null) {298 // This is not perfect, if current dataset was changed during execution, the lock would be useless299 if (isAtOldPosition && middleMouseDown) {300 // Write lock is necessary when selecting in popupCycleSelection301 // locks can not be upgraded -> if do read lock here and write lock later302 // (in OsmPrimitive.updateFlags) then always occurs deadlock (#5814)303 ds.beginUpdate();304 } else {305 ds.getReadLock().lock();306 }307 }308 309 309 // Set the text label in the bottom status bar 310 310 // "if mouse moved only" was added to stop heap growing -
trunk/src/org/openstreetmap/josm/io/AbstractReader.java
r11919 r12065 194 194 195 195 protected final void prepareDataSet() throws IllegalDataException { 196 ds.beginUpdate(); 196 197 try { 197 ds.beginUpdate();198 198 processNodesAfterParsing(); 199 199 processWaysAfterParsing();
Note:
See TracChangeset
for help on using the changeset viewer.