Changeset 5953 in josm for trunk/src/org/openstreetmap/josm/actions/PasteAction.java
- Timestamp:
- 2013-05-10T17:13:24+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/PasteAction.java
r5096 r5953 30 30 import org.openstreetmap.josm.tools.Shortcut; 31 31 32 /** 33 * Paste OSM primitives from clipboard to the current edit layer. 34 * @since 404 35 */ 32 36 public final class PasteAction extends JosmAction implements PasteBufferChangedListener { 33 37 38 /** 39 * Constructs a new {@code PasteAction}. 40 */ 34 41 public PasteAction() { 35 42 super(tr("Paste"), "paste", tr("Paste contents of paste buffer."), … … 45 52 } 46 53 47 public void pasteData(PrimitiveDeepCopy pasteBuffer, Layer source, ActionEvent e) { 54 /** 55 * Paste OSM primitives from the given paste buffer and OSM data layer source to the current edit layer. 56 * @param pasteBuffer The paste buffer containing primitive ids to copy 57 * @param source The OSM data layer used to look for primitive ids 58 * @param e The ActionEvent that triggered this operation 59 */ 60 public void pasteData(PrimitiveDeepCopy pasteBuffer, Layer source, ActionEvent e) { 48 61 /* Find the middle of the pasteBuffer area */ 49 62 double maxEast = -1E100, minEast = 1E100, maxNorth = -1E100, minNorth = 1E100; … … 87 100 // Make a copy of pasteBuffer and map from old id to copied data id 88 101 List<PrimitiveData> bufferCopy = new ArrayList<PrimitiveData>(); 102 List<PrimitiveData> toSelect = new ArrayList<PrimitiveData>(); 89 103 Map<Long, Long> newNodeIds = new HashMap<Long, Long>(); 90 104 Map<Long, Long> newWayIds = new HashMap<Long, Long>(); … … 104 118 } 105 119 bufferCopy.add(copy); 120 if (pasteBuffer.getDirectlyAdded().contains(data)) { 121 toSelect.add(copy); 122 } 106 123 } 107 124 … … 148 165 /* Now execute the commands to add the duplicated contents of the paste buffer to the map */ 149 166 150 Main.main.undoRedo.add(new AddPrimitivesCommand(bufferCopy ));167 Main.main.undoRedo.add(new AddPrimitivesCommand(bufferCopy, toSelect)); 151 168 Main.map.mapView.repaint(); 152 169 }
Note:
See TracChangeset
for help on using the changeset viewer.