Changeset 1023 in josm for trunk/src/org/openstreetmap/josm/actions/PasteAction.java
- Timestamp:
- 2008-10-05T17:06:27+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/PasteAction.java
r999 r1023 24 24 import org.openstreetmap.josm.data.osm.Way; 25 25 import org.openstreetmap.josm.data.coor.EastNorth; 26 import org.openstreetmap.josm.tools.ShortCut; 26 27 27 28 public final class PasteAction extends JosmAction { 28 29 29 30 public PasteAction() { 30 super(tr("Paste"), "paste", 31 tr("Paste contents of paste buffer."), 32 KeyEvent.VK_V, KeyEvent.CTRL_MASK, true); 33 setEnabled(false); 31 super(tr("Paste"), "paste", tr("Paste contents of paste buffer."), 32 ShortCut.registerShortCut("system:paste", tr("Edit: Paste"), KeyEvent.VK_V, ShortCut.GROUP_MENU), true); 33 setEnabled(false); 34 34 } 35 35 … … 37 37 DataSet pasteBuffer = Main.pasteBuffer; 38 38 39 /* Find the middle of the pasteBuffer area */ 39 /* Find the middle of the pasteBuffer area */ 40 40 double maxEast = -1E100, minEast = 1E100, maxNorth = -1E100, minNorth = 1E100; 41 41 for (Node n : pasteBuffer.nodes) { 42 42 double east = n.eastNorth.east(); 43 43 double north = n.eastNorth.north(); 44 if (east > maxEast) { maxEast = east; } 45 if (east < minEast) { minEast = east; } 46 if (north > maxNorth) { maxNorth = north; } 47 if (north < minNorth) { minNorth = north; } 44 if (east > maxEast) { maxEast = east; } 45 if (east < minEast) { minEast = east; } 46 if (north > maxNorth) { maxNorth = north; } 47 if (north < minNorth) { minNorth = north; } 48 48 } 49 49 … … 57 57 double offsetEast = mPosition.east() - (maxEast + minEast)/2.0; 58 58 double offsetNorth = mPosition.north() - (maxNorth + minNorth)/2.0; 59 60 HashMap<OsmPrimitive,OsmPrimitive> map = new HashMap<OsmPrimitive,OsmPrimitive>(); 59 60 HashMap<OsmPrimitive,OsmPrimitive> map = new HashMap<OsmPrimitive,OsmPrimitive>(); 61 61 /* temporarily maps old nodes to new so we can do a true deep copy */ 62 62 63 63 /* do the deep copy of the paste buffer contents, leaving the pasteBuffer unchanged */ 64 64 for (Node n : pasteBuffer.nodes) { … … 96 96 map.put(r, rnew); 97 97 } 98 98 99 99 /* Now execute the commands to add the dupicated contents of the paste buffer to the map */ 100 100 Collection<OsmPrimitive> osms = map.values();
Note:
See TracChangeset
for help on using the changeset viewer.