Changeset 29586 in osm for applications/editors/josm/plugins/routing/src/com
- Timestamp:
- 2013-05-12T17:45:58+02:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/RoutingLayer.java
r27760 r29586 275 275 if(routingModel != null) { 276 276 if(routingModel.routingGraph != null && routingModel.routingGraph.getGraph() != null) { 277 Color color2 = ColorHelper.html2color("#00ff00"); /* just green for now */278 277 Set<OsmEdge> graphEdges = routingModel.routingGraph.getGraph().edgeSet(); 279 OsmEdge firstedge = (OsmEdge) graphEdges.toArray()[0]; 280 Point from = mv.getPoint(firstedge.fromEastNorth()); 281 g.drawRect(from.x-4, from.y+4, from.x+4, from.y-4); 282 for(OsmEdge edge : graphEdges) { 283 drawGraph(g, mv, edge, color2, width); 278 if (!graphEdges.isEmpty()) { 279 Color color2 = ColorHelper.html2color("#00ff00"); /* just green for now */ 280 OsmEdge firstedge = (OsmEdge) graphEdges.toArray()[0]; 281 Point from = mv.getPoint(firstedge.fromEastNorth()); 282 g.drawRect(from.x-4, from.y+4, from.x+4, from.y-4); 283 for(OsmEdge edge : graphEdges) { 284 drawGraph(g, mv, edge, color2, width); 285 } 284 286 } 285 287 } -
applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/RoutingPlugin.java
r29525 r29586 175 175 public void addLayer() { 176 176 OsmDataLayer osmLayer = Main.map.mapView.getEditLayer(); 177 RoutingLayer layer = new RoutingLayer(tr("Routing") + " [" + osmLayer.getName() + "]", osmLayer); 178 layers.add(layer); 179 Main.main.addLayer(layer); 177 if (osmLayer != null) { 178 RoutingLayer layer = new RoutingLayer(tr("Routing") + " [" + osmLayer.getName() + "]", osmLayer); 179 layers.add(layer); 180 Main.main.addLayer(layer); 181 } 180 182 } 181 183 -
applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/actions/AddRouteNodeAction.java
r27288 r29586 37 37 import org.openstreetmap.josm.data.osm.Node; 38 38 import org.openstreetmap.josm.gui.MapFrame; 39 import org.openstreetmap.josm.gui.layer.Layer; 39 40 import org.openstreetmap.josm.tools.ImageProvider; 40 41 import org.openstreetmap.josm.gui.layer.Layer;42 41 43 42 import com.innovant.josm.plugin.routing.RoutingLayer; 44 43 import com.innovant.josm.plugin.routing.RoutingPlugin; 45 import com.innovant.josm.plugin.routing.gui.RoutingDialog;46 44 47 45 /** … … 53 51 */ 54 52 public class AddRouteNodeAction extends MapMode { 55 /** 56 * Serial. 57 */ 58 private static final long serialVersionUID = 1L; 53 59 54 /** 60 55 * Logger. 61 56 */ 62 57 static Logger logger = Logger.getLogger(AddRouteNodeAction.class); 63 /**64 * Routing Dialog.65 */66 private RoutingDialog routingDialog;67 58 68 59 /** … … 75 66 tr("Click to add destination."), 76 67 mapFrame, ImageProvider.getCursor("crosshair", null)); 77 this.routingDialog = RoutingPlugin.getInstance().getRoutingDialog();78 68 } 79 69 … … 102 92 logger.debug("selected node " + node); 103 93 layer.getRoutingModel().addNode(node); 104 routingDialog.addNode(node);94 RoutingPlugin.getInstance().getRoutingDialog().addNode(node); 105 95 } 106 96 } -
applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/actions/MoveRouteNodeAction.java
r27288 r29586 56 56 */ 57 57 public class MoveRouteNodeAction extends MapMode { 58 /**59 * Serial.60 */61 private static final long serialVersionUID = 1L;62 58 63 59 /** … … 70 66 */ 71 67 static Logger logger = Logger.getLogger(RoutingLayer.class); 72 73 /**74 * Routing Dialog.75 */76 private RoutingDialog routingDialog;77 68 78 69 /** … … 90 81 tr("Click and drag to move destination"), 91 82 mapFrame, ImageProvider.getCursor("normal", "move")); 92 this.routingDialog = RoutingPlugin.getInstance().getRoutingDialog();93 83 } 94 84 … … 141 131 RoutingLayer layer = (RoutingLayer)Main.map.mapView.getActiveLayer(); 142 132 RoutingModel routingModel = layer.getRoutingModel(); 133 RoutingDialog routingDialog = RoutingPlugin.getInstance().getRoutingDialog(); 143 134 // Search for nearest highway node 144 135 Node node = null; -
applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/actions/RemoveRouteNodeAction.java
r27288 r29586 38 38 import org.openstreetmap.josm.data.osm.Node; 39 39 import org.openstreetmap.josm.gui.MapFrame; 40 import org.openstreetmap.josm.gui.layer.Layer; 40 41 import org.openstreetmap.josm.tools.ImageProvider; 41 import org.openstreetmap.josm.gui.layer.Layer;42 42 43 43 import com.innovant.josm.plugin.routing.RoutingLayer; 44 44 import com.innovant.josm.plugin.routing.RoutingModel; 45 45 import com.innovant.josm.plugin.routing.RoutingPlugin; 46 import com.innovant.josm.plugin.routing.gui.RoutingDialog;47 46 48 47 /** … … 54 53 */ 55 54 public class RemoveRouteNodeAction extends MapMode { 56 /**57 * Serial.58 */59 private static final long serialVersionUID = 1L;60 55 61 56 /** … … 68 63 */ 69 64 static Logger logger = Logger.getLogger(RoutingLayer.class); 70 /**71 * Routing Dialog.72 */73 private RoutingDialog routingDialog;74 65 75 66 public RemoveRouteNodeAction(MapFrame mapFrame) { … … 78 69 tr("Click to remove destination"), 79 70 mapFrame, ImageProvider.getCursor("normal", "delete")); 80 this.routingDialog = RoutingPlugin.getInstance().getRoutingDialog();81 71 } 82 72 … … 114 104 logger.debug("Removing node " + nl.get(index)); 115 105 routingModel.removeNode(index); 116 routingDialog.removeNode(index);106 RoutingPlugin.getInstance().getRoutingDialog().removeNode(index); 117 107 Main.map.repaint(); 118 108 } else {
Note:
See TracChangeset
for help on using the changeset viewer.