Ignore:
Timestamp:
2013-05-10T17:13:24+02:00 (11 years ago)
Author:
Don-vip
Message:

fix #8690 - After copying some primitives, only select those that have been directly selected (and not all that have been created) -> Copying a way only selects the new way

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/PasteAction.java

    r5096 r5953  
    3030import org.openstreetmap.josm.tools.Shortcut;
    3131
     32/**
     33 * Paste OSM primitives from clipboard to the current edit layer.
     34 * @since 404
     35 */
    3236public final class PasteAction extends JosmAction implements PasteBufferChangedListener {
    3337
     38    /**
     39     * Constructs a new {@code PasteAction}.
     40     */
    3441    public PasteAction() {
    3542        super(tr("Paste"), "paste", tr("Paste contents of paste buffer."),
     
    4552    }
    4653
    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) {
    4861        /* Find the middle of the pasteBuffer area */
    4962        double maxEast = -1E100, minEast = 1E100, maxNorth = -1E100, minNorth = 1E100;
     
    87100        // Make a copy of pasteBuffer and map from old id to copied data id
    88101        List<PrimitiveData> bufferCopy = new ArrayList<PrimitiveData>();
     102        List<PrimitiveData> toSelect = new ArrayList<PrimitiveData>();
    89103        Map<Long, Long> newNodeIds = new HashMap<Long, Long>();
    90104        Map<Long, Long> newWayIds = new HashMap<Long, Long>();
     
    104118            }
    105119            bufferCopy.add(copy);
     120            if (pasteBuffer.getDirectlyAdded().contains(data)) {
     121                toSelect.add(copy);
     122            }
    106123        }
    107124
     
    148165        /* Now execute the commands to add the duplicated contents of the paste buffer to the map */
    149166
    150         Main.main.undoRedo.add(new AddPrimitivesCommand(bufferCopy));
     167        Main.main.undoRedo.add(new AddPrimitivesCommand(bufferCopy, toSelect));
    151168        Main.map.mapView.repaint();
    152169    }
Note: See TracChangeset for help on using the changeset viewer.