Changeset 33813 in osm for applications/editors/josm/plugins
- Timestamp:
- 2017-11-17T00:40:45+01:00 (7 years ago)
- Location:
- applications/editors/josm/plugins/tracer
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/tracer/build.xml
r32680 r33813 4 4 <property name="commit.message" value="Tracer plugin can load at runtime"/> 5 5 <!-- enter the *lowest* JOSM version this plugin is currently compatible with --> 6 <property name="plugin.main.version" value="1 0580"/>6 <property name="plugin.main.version" value="12643"/> 7 7 <property name="plugin.canloadatruntime" value="true"/> 8 8 -
applications/editors/josm/plugins/tracer/src/org/openstreetmap/josm/plugins/tracer/ConnectWays.java
r32510 r33813 8 8 9 9 import static org.openstreetmap.josm.tools.I18n.tr; 10 10 11 import java.util.HashMap; 11 12 import java.util.LinkedList; 12 13 import java.util.List; 13 14 import java.util.Map; 14 import org.openstreetmap.josm.Main; 15 15 16 import org.openstreetmap.josm.command.ChangeCommand; 16 17 import org.openstreetmap.josm.command.Command; … … 19 20 import org.openstreetmap.josm.command.SequenceCommand; 20 21 import org.openstreetmap.josm.data.coor.LatLon; 22 import org.openstreetmap.josm.data.osm.BBox; 21 23 import org.openstreetmap.josm.data.osm.Node; 24 import org.openstreetmap.josm.data.osm.OsmPrimitive; 22 25 import org.openstreetmap.josm.data.osm.Way; 23 import org.openstreetmap.josm.data.osm.BBox; 24 import org.openstreetmap.josm.data.osm.OsmPrimitive; 26 import org.openstreetmap.josm.gui.MainApplication; 25 27 import org.openstreetmap.josm.tools.Pair; 26 28 … … 53 55 // bude se node slucovat s jinym? 54 56 double minDistanceSq = MIN_DISTANCE; 55 List<Node> nodes = Main.getLayerManager().getEditDataSet().searchNodes(bbox); 57 List<Node> nodes = MainApplication.getLayerManager().getEditDataSet().searchNodes(bbox); 56 58 Node nearestNode = null; 57 59 for (Node nn : nodes) { … … 133 135 // node nebyl slouceny s jinym 134 136 // hledani pripadne blizke usecky, kam bod pridat 135 List<Way> ways = Main.getLayerManager().getEditDataSet().searchWays(bbox); 137 List<Way> ways = MainApplication.getLayerManager().getEditDataSet().searchWays(bbox); 136 138 double minDist = Double.MAX_VALUE; 137 139 Way nearestWay = null; … … 190 192 double minDistanceSq = MIN_DISTANCE_SQ; 191 193 //double maxAngle = MAX_ANGLE; 192 List<Node> nodes = Main.getLayerManager().getEditDataSet().searchNodes(new BBox( 194 List<Node> nodes = MainApplication.getLayerManager().getEditDataSet().searchNodes(new BBox( 193 195 Math.min(n1.getX(), n2.getX()) - minDistanceSq, 194 196 Math.min(n1.getY(), n2.getY()) - minDistanceSq, -
applications/editors/josm/plugins/tracer/src/org/openstreetmap/josm/plugins/tracer/TracerAction.java
r32510 r33813 7 7 8 8 import static org.openstreetmap.josm.tools.I18n.tr; 9 9 10 import java.awt.Cursor; 10 11 import java.awt.Point; … … 17 18 import java.util.Collection; 18 19 import java.util.LinkedList; 20 19 21 import org.openstreetmap.josm.Main; 20 22 import org.openstreetmap.josm.actions.mapmode.MapMode; … … 23 25 import org.openstreetmap.josm.command.SequenceCommand; 24 26 import org.openstreetmap.josm.data.coor.LatLon; 27 import org.openstreetmap.josm.data.osm.DataSet; 25 28 import org.openstreetmap.josm.data.osm.Node; 26 29 import org.openstreetmap.josm.data.osm.Way; 30 import org.openstreetmap.josm.gui.MainApplication; 27 31 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 28 32 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 29 import org.openstreetmap.josm.gui.MapFrame;30 33 import org.openstreetmap.josm.tools.ImageProvider; 34 import org.openstreetmap.josm.tools.Logging; 31 35 import org.openstreetmap.josm.tools.Shortcut; 32 36 import org.xml.sax.SAXException; … … 41 45 protected TracerServer server = new TracerServer(); 42 46 43 public TracerAction( MapFrame mapFrame) {44 super(tr("Tracer"), "tracer-sml", tr("Tracer."), Shortcut.registerShortcut("tools:tracer", tr("Tool: {0}", tr("Tracer")), KeyEvent.VK_T, Shortcut.DIRECT), mapFrame,getCursor());47 public TracerAction() { 48 super(tr("Tracer"), "tracer-sml", tr("Tracer."), Shortcut.registerShortcut("tools:tracer", tr("Tool: {0}", tr("Tracer")), KeyEvent.VK_T, Shortcut.DIRECT), getCursor()); 45 49 } 46 50 … … 51 55 } 52 56 super.enterMode(); 53 Main .map.mapView.setCursor(getCursor());54 Main .map.mapView.addMouseListener(this);57 MainApplication.getMap().mapView.setCursor(getCursor()); 58 MainApplication.getMap().mapView.addMouseListener(this); 55 59 } 56 60 … … 58 62 public void exitMode() { 59 63 super.exitMode(); 60 Main .map.mapView.removeMouseListener(this);64 MainApplication.getMap().mapView.removeMouseListener(this); 61 65 } 62 66 … … 70 74 * Positional data 71 75 */ 72 final LatLon pos = Main .map.mapView.getLatLon(clickPoint.x, clickPoint.y);76 final LatLon pos = MainApplication.getMap().mapView.getLatLon(clickPoint.x, clickPoint.y); 73 77 74 78 try { … … 92 96 executeTraceThread.start(); 93 97 } catch (Exception e) { 94 e.printStackTrace();98 Logging.error(e); 95 99 } 96 100 } … … 111 115 return; 112 116 } 117 118 DataSet ds = MainApplication.getLayerManager().getEditDataSet(); 113 119 114 120 // make nodes a way … … 120 126 firstNode = node; 121 127 } 122 commands.add(new AddCommand(node)); 128 commands.add(new AddCommand(ds, node)); 123 129 way.addNode(node); 124 130 } … … 126 132 127 133 tagBuilding(way); 128 commands.add(new AddCommand(way)); 134 commands.add(new AddCommand(ds, way)); 129 135 130 136 // connect to other buildings … … 137 143 138 144 if (shift) { 139 Main.getLayerManager().getEditDataSet().addSelected(way);145 ds.addSelected(way); 140 146 } else { 141 Main.getLayerManager().getEditDataSet().setSelected(way);147 ds.setSelected(way); 142 148 } 143 149 } else { … … 168 174 @Override 169 175 public void mousePressed(MouseEvent e) { 170 if (!Main .map.mapView.isActiveLayerDrawable()) {176 if (!MainApplication.getMap().mapView.isActiveLayerDrawable()) { 171 177 return; 172 178 } -
applications/editors/josm/plugins/tracer/src/org/openstreetmap/josm/plugins/tracer/TracerPlugin.java
r29771 r33813 7 7 package org.openstreetmap.josm.plugins.tracer; 8 8 9 import org.openstreetmap.josm. Main;9 import org.openstreetmap.josm.gui.MainApplication; 10 10 import org.openstreetmap.josm.gui.MainMenu; 11 11 import org.openstreetmap.josm.plugins.Plugin; … … 16 16 public TracerPlugin(PluginInformation info) { 17 17 super(info); 18 MainMenu.add(Main .main.menu.moreToolsMenu, new TracerAction(Main.map));18 MainMenu.add(MainApplication.getMenu().moreToolsMenu, new TracerAction()); 19 19 } 20 20
Note:
See TracChangeset
for help on using the changeset viewer.