Changeset 32773 in osm for applications
- Timestamp:
- 2016-08-06T00:25:05+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java
r32738 r32773 8 8 import java.awt.Graphics2D; 9 9 import java.awt.Point; 10 import java.awt.datatransfer.UnsupportedFlavorException;11 10 import java.awt.event.KeyEvent; 12 11 import java.awt.event.MouseEvent; 13 import java.io.IOException;14 12 import java.util.ArrayList; 15 13 import java.util.Collection; 16 import java.util. HashSet;14 import java.util.Collections; 17 15 import java.util.Iterator; 18 16 import java.util.LinkedList; 19 17 import java.util.List; 20 18 import java.util.Map; 21 import java.util.Set;22 19 23 20 import javax.swing.JOptionPane; 24 21 25 22 import org.openstreetmap.josm.Main; 26 import org.openstreetmap.josm.actions.PasteTagsAction.TagPaster;27 23 import org.openstreetmap.josm.actions.mapmode.MapMode; 28 24 import org.openstreetmap.josm.command.AddCommand; … … 35 31 import org.openstreetmap.josm.data.osm.Node; 36 32 import org.openstreetmap.josm.data.osm.OsmPrimitive; 37 import org.openstreetmap.josm.data.osm.Tag;38 33 import org.openstreetmap.josm.data.osm.Way; 39 34 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil; 40 35 import org.openstreetmap.josm.gui.MapFrame; 41 36 import org.openstreetmap.josm.gui.MapView; 42 import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils; 43 import org.openstreetmap.josm.gui.datatransfer.data.PrimitiveTransferData; 37 import org.openstreetmap.josm.gui.datatransfer.OsmTransferHandler; 44 38 import org.openstreetmap.josm.gui.layer.Layer; 45 39 import org.openstreetmap.josm.gui.layer.MapViewPaintable; … … 555 549 556 550 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); 558 552 // there may be a node with the same coords! 559 553 … … 580 574 if (ctrl) { 581 575 // 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)); 592 577 } 593 578 if (!settings.autoTags.isEmpty()) { … … 729 714 730 715 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); 732 717 if (nd != null && line.getPoint(nd.getCoor()).distance(point) <= maxDist) return nd; 733 718 else return null;
Note:
See TracChangeset
for help on using the changeset viewer.