Ignore:
Timestamp:
2016-08-06T00:25:05+02:00 (8 years ago)
Author:
donvip
Message:

update to latest JOSM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java

    r32738 r32773  
    88import java.awt.Graphics2D;
    99import java.awt.Point;
    10 import java.awt.datatransfer.UnsupportedFlavorException;
    1110import java.awt.event.KeyEvent;
    1211import java.awt.event.MouseEvent;
    13 import java.io.IOException;
    1412import java.util.ArrayList;
    1513import java.util.Collection;
    16 import java.util.HashSet;
     14import java.util.Collections;
    1715import java.util.Iterator;
    1816import java.util.LinkedList;
    1917import java.util.List;
    2018import java.util.Map;
    21 import java.util.Set;
    2219
    2320import javax.swing.JOptionPane;
    2421
    2522import org.openstreetmap.josm.Main;
    26 import org.openstreetmap.josm.actions.PasteTagsAction.TagPaster;
    2723import org.openstreetmap.josm.actions.mapmode.MapMode;
    2824import org.openstreetmap.josm.command.AddCommand;
     
    3531import org.openstreetmap.josm.data.osm.Node;
    3632import org.openstreetmap.josm.data.osm.OsmPrimitive;
    37 import org.openstreetmap.josm.data.osm.Tag;
    3833import org.openstreetmap.josm.data.osm.Way;
    3934import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;
    4035import org.openstreetmap.josm.gui.MapFrame;
    4136import org.openstreetmap.josm.gui.MapView;
    42 import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils;
    43 import org.openstreetmap.josm.gui.datatransfer.data.PrimitiveTransferData;
     37import org.openstreetmap.josm.gui.datatransfer.OsmTransferHandler;
    4438import org.openstreetmap.josm.gui.layer.Layer;
    4539import org.openstreetmap.josm.gui.layer.MapViewPaintable;
     
    555549
    556550        for (LatLon p : pts) {
    557             Node nd = Main.map.mapView.getNearestNode(line.getPoint(p), OsmPrimitive.isSelectablePredicate);
     551            Node nd = Main.map.mapView.getNearestNode(line.getPoint(p), OsmPrimitive::isSelectable);
    558552            // there may be a node with the same coords!
    559553
     
    580574        if (ctrl) {
    581575            // paste tags - from ctrl-shift-v
    582             Set<OsmPrimitive> ts = new HashSet<>();
    583             ts.add(w);
    584             try {
    585                 PrimitiveTransferData data = (PrimitiveTransferData) ClipboardUtils.getClipboard().getData(PrimitiveTransferData.DATA_FLAVOR);
    586                 for (Tag t : new TagPaster(data.getDirectlyAdded(), ts).execute()) {
    587                     w.put(t.getKey(), t.getValue());
    588                 }
    589             } catch (UnsupportedFlavorException | IOException e) {
    590                 Main.error(e);
    591             }
     576            new OsmTransferHandler().pasteTags(Collections.singleton(w));
    592577        }
    593578        if (!settings.autoTags.isEmpty()) {
     
    729714
    730715    private Node getNearestNode(Point point, double maxDist) {
    731         Node nd = Main.map.mapView.getNearestNode(point, OsmPrimitive.isSelectablePredicate);
     716        Node nd = Main.map.mapView.getNearestNode(point, OsmPrimitive::isSelectable);
    732717        if (nd != null && line.getPoint(nd.getCoor()).distance(point) <= maxDist) return nd;
    733718        else return null;
Note: See TracChangeset for help on using the changeset viewer.