Changeset 36303 in osm
- Timestamp:
- 2024-08-07T22:51:27+02:00 (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/RoutingLayer.java
r36085 r36303 47 47 public class RoutingLayer extends Layer { 48 48 49 /** 50 * Preference keys for routing 51 */ 49 52 public enum PreferencesKeys { 50 53 KEY_ACTIVE_ROUTE_COLOR(marktr("routing active route")), … … 63 66 } 64 67 68 private static final String ROUTING = "routing"; 69 65 70 /** 66 71 * Constant … … 93 98 super(name); 94 99 Logging.trace("Creating Routing Layer..."); 95 this.startIcon = ImageProvider.get( "routing", "startflag");96 this.middleIcon = ImageProvider.get( "routing", "middleflag");97 this.endIcon = ImageProvider.get( "routing", "endflag");100 this.startIcon = ImageProvider.get(ROUTING, "startflag"); 101 this.middleIcon = ImageProvider.get(ROUTING, "middleflag"); 102 this.endIcon = ImageProvider.get(ROUTING, "endflag"); 98 103 this.dataLayer = dataLayer; 99 104 this.routingModel = new RoutingModel(dataLayer.data); 100 105 Logging.trace("Routing Layer created."); 101 106 102 this.routingModel.routingGraph.createGraph(); /* construct the graph right after we wecreate the layer */107 this.routingModel.routingGraph.createGraph(); /* construct the graph right after we create the layer */ 103 108 invalidate(); /* update MapView */ 104 109 } … … 206 211 // Get path stroke width from preferences 207 212 String widthString = Config.getPref().get(PreferencesKeys.KEY_ROUTE_WIDTH.getKey()); 208 if (widthString. length() == 0) {213 if (widthString.isEmpty()) { 209 214 widthString = "2"; /* I think 2 is better */ 210 215 // FIXME add after good width is found: Config.getPref().put(KEY_ROUTE_WIDTH, widthString); … … 268 273 269 274 @Override 270 public void destroy() { 275 public synchronized void destroy() { 271 276 routingModel.reset(); 272 277 // layerAdded = false; … … 290 295 g2d.drawLine(from.x, from.y, to.x, to.y); 291 296 if (showDirection) { 292 double t = Math.atan2(to.y -from.y, to.x-from.x) + Math.PI;297 double t = Math.atan2(to.y - (double) from.y, to.x - (double) from.x) + Math.PI; 293 298 g.drawLine(to.x, to.y, (int) (to.x + 10*Math.cos(t-ARROW_PHI)), (int) (to.y + 10*Math.sin(t-ARROW_PHI))); 294 299 g.drawLine(to.x, to.y, (int) (to.x + 10*Math.cos(t+ARROW_PHI)), (int) (to.y + 10*Math.sin(t+ARROW_PHI))); … … 309 314 g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // Anti-alias! 310 315 g2d.drawLine(from.x, from.y, to.x, to.y); 311 g2d.drawRect(to.x - 4, to.y+4, 4, 4);316 g2d.drawRect(to.x - 2, to.y - 2, 4, 4); 312 317 313 318 g2d.setStroke(oldStroke);
Note:
See TracChangeset
for help on using the changeset viewer.