Ignore:
Timestamp:
2024-08-07T22:51:27+02:00 (2 months ago)
Author:
taylor.smock
Message:

Fix #23843: Paint nodes in routing layer in the correct location

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/RoutingLayer.java

    r36085 r36303  
    4747public class RoutingLayer extends Layer {
    4848
     49    /**
     50     * Preference keys for routing
     51     */
    4952    public enum PreferencesKeys {
    5053        KEY_ACTIVE_ROUTE_COLOR(marktr("routing active route")),
     
    6366    }
    6467
     68    private static final String ROUTING = "routing";
     69
    6570    /**
    6671     * Constant
     
    9398        super(name);
    9499        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");
    98103        this.dataLayer = dataLayer;
    99104        this.routingModel = new RoutingModel(dataLayer.data);
    100105        Logging.trace("Routing Layer created.");
    101106
    102         this.routingModel.routingGraph.createGraph();    /* construct the graph right after we we create the layer */
     107        this.routingModel.routingGraph.createGraph();    /* construct the graph right after we create the layer */
    103108        invalidate();                            /* update MapView */
    104109    }
     
    206211        // Get path stroke width from preferences
    207212        String widthString = Config.getPref().get(PreferencesKeys.KEY_ROUTE_WIDTH.getKey());
    208         if (widthString.length() == 0) {
     213        if (widthString.isEmpty()) {
    209214            widthString = "2";                        /* I think 2 is better  */
    210215            // FIXME add after good width is found: Config.getPref().put(KEY_ROUTE_WIDTH, widthString);
     
    268273
    269274    @Override
    270     public void destroy() {
     275    public synchronized void destroy() {
    271276        routingModel.reset();
    272277        //      layerAdded = false;
     
    290295        g2d.drawLine(from.x, from.y, to.x, to.y);
    291296        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;
    293298            g.drawLine(to.x, to.y, (int) (to.x + 10*Math.cos(t-ARROW_PHI)), (int) (to.y + 10*Math.sin(t-ARROW_PHI)));
    294299            g.drawLine(to.x, to.y, (int) (to.x + 10*Math.cos(t+ARROW_PHI)), (int) (to.y + 10*Math.sin(t+ARROW_PHI)));
     
    309314        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // Anti-alias!
    310315        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);
    312317
    313318        g2d.setStroke(oldStroke);
Note: See TracChangeset for help on using the changeset viewer.