Ignore:
Timestamp:
2009-04-08T02:23:40+02:00 (15 years ago)
Author:
juangui
Message:

Added a different color for routing inactive layer. Fixed layer context menu entries.

Location:
applications/editors/josm/plugins/routing/src/com/innovant/josm
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/routing/src/com/innovant/josm/jrt/core/PreferencesKeys.java

    r14287 r14423  
    2828
    2929public enum PreferencesKeys {
    30         KEY_ROUTE_COLOR ("routing.route.color"),
     30        KEY_ACTIVE_ROUTE_COLOR ("routing.active.route.color"),
     31        KEY_INACTIVE_ROUTE_COLOR ("routing.inactive.route.color"),
    3132        KEY_ROUTE_WIDTH ("routing.route.width"),
    3233        KEY_ROUTE_SELECT ("routing.route.select");
    33        
     34
    3435        public final String key;
    3536        PreferencesKeys (String key) {
    3637                this.key=key;
    3738        }
    38        
     39
    3940        public String getKey() {return key;};
    4041}
  • applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/RoutingLayer.java

    r14404 r14423  
    208208        Collection<Component> components = new ArrayList<Component>();
    209209        components.add(new JMenuItem(new LayerListDialog.ShowHideLayerAction(this)));
    210         components.add(new JMenuItem(new LayerListDialog.ShowHideMarkerText(this)));
     210//        components.add(new JMenuItem(new LayerListDialog.ShowHideMarkerText(this)));
    211211        components.add(new JMenuItem(new LayerListDialog.DeleteLayerAction(this)));
    212212        components.add(new JSeparator());
     
    223223        @Override
    224224        public String getToolTipText() {
    225                 if (routingModel.getRouteEdges() != null) {
    226                         // If there's a calculated route
    227                 return "Showing calculated route. You can still add route nodes and compute a new route or delete layer to start a new route";
    228                 } else if (routingModel.getSelectedNodes() != null) {
    229                         // If there are some route nodes but not a calculated route
    230                 return "Keep selecting route nodes and compute route";
    231                 }
    232         return "Select as many route nodes as you want and compute route";
     225                String tooltip = this.routingModel.routingGraph.getVertexCount() + " vertices, "
     226                                + this.routingModel.routingGraph.getEdgeCount() + " edges";
     227                return tooltip;
    233228        }
    234229
     
    257252        @Override
    258253        public void paint(Graphics g, MapView mv) {
     254                boolean isActiveLayer = (mv.getActiveLayer().equals(this));
    259255                // Get routing nodes (start, middle, end)
    260256        List<Node> nodes = routingModel.getSelectedNodes();
     
    265261
    266262        // Get path stroke color from preferences
    267 //              Main.pref.hasKey(PreferencesKeys.KEY_ROUTE_COLOR.key);
    268         String colorString = Main.pref.get(PreferencesKeys.KEY_ROUTE_COLOR.key);
    269         if(colorString.length() == 0) {
    270             colorString = ColorHelper.color2html(Color.RED);
    271             // FIXME add after good color is found: Main.pref.put(KEY_ROUTE_COLOR, colorString);
     263        // Color is different for active and inactive layers
     264        String colorString;
     265        if (isActiveLayer) {
     266                if (Main.pref.hasKey(PreferencesKeys.KEY_ACTIVE_ROUTE_COLOR.key))
     267                                colorString = Main.pref.get(PreferencesKeys.KEY_ACTIVE_ROUTE_COLOR.key);
     268                else {
     269                        colorString = ColorHelper.color2html(Color.RED);
     270                        Main.pref.put(PreferencesKeys.KEY_ACTIVE_ROUTE_COLOR.key, colorString);
     271                }
     272        } else {
     273                if (Main.pref.hasKey(PreferencesKeys.KEY_INACTIVE_ROUTE_COLOR.key))
     274                        colorString = Main.pref.get(PreferencesKeys.KEY_INACTIVE_ROUTE_COLOR.key);
     275                else {
     276                        colorString = ColorHelper.color2html(Color.decode("#dd2222"));
     277                        Main.pref.put(PreferencesKeys.KEY_INACTIVE_ROUTE_COLOR.key, colorString);
     278                }
    272279        }
    273280        Color color = ColorHelper.html2color(colorString);
     
    275282        // Get path stroke width from preferences
    276283        String widthString = Main.pref.get(PreferencesKeys.KEY_ROUTE_WIDTH.key);
    277         if(widthString.length() == 0) {
     284        if (widthString.length() == 0) {
    278285            widthString = "8";
    279286            // FIXME add after good width is found: Main.pref.put(KEY_ROUTE_WIDTH, widthString);
  • applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/RoutingPlugin.java

    r14404 r14423  
    132132        public RoutingPlugin() {
    133133                super();
    134                 //FIXME: maybe check if plugin already exists
    135134                plugin = this; // Assign reference to the plugin class
    136135                DOMConfigurator.configure("log4j.xml");
     
    250249                        for (int i=0;i<layersArray.length;i++) {
    251250                                if (layersArray[i].getDataLayer().equals(oldLayer)) {
    252                                         // Move layer to the top
    253                                         Main.map.mapView.moveLayer(layersArray[i], 0);
    254251                                        try {
    255252                                                // Remove layer
  • applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/actions/AddRouteNodeAction.java

    r14404 r14423  
    7171                // TODO Use constructor with shortcut
    7272                super(tr("Routing"), "add",
    73                                 tr("Click to add route nodes."),
     73                                tr("Click to add destination."),
    7474                                mapFrame, ImageProvider.getCursor("crosshair", null));
    7575        this.routingDialog = RoutingPlugin.getInstance().getRoutingDialog();
  • applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/actions/MoveRouteNodeAction.java

    r14404 r14423  
    8686                // TODO Use constructor with shortcut
    8787                super(tr("Routing"), "move",
    88                                 tr("Click and drag to move route nodes."),
     88                                tr("Click and drag to move destination"),
    8989                                mapFrame, ImageProvider.getCursor("normal", "move"));
    9090        this.routingDialog = RoutingPlugin.getInstance().getRoutingDialog();
  • applications/editors/josm/plugins/routing/src/com/innovant/josm/plugin/routing/actions/RemoveRouteNodeAction.java

    r14404 r14423  
    7575                // TODO Use constructor with shortcut
    7676                super(tr("Routing"), "remove",
    77                                 tr("Remove route nodes"),
     77                                tr("Click to remove destination"),
    7878                                mapFrame, ImageProvider.getCursor("normal", "delete"));
    7979        this.routingDialog = RoutingPlugin.getInstance().getRoutingDialog();
Note: See TracChangeset for help on using the changeset viewer.