Changeset 3291 in josm


Ignore:
Timestamp:
2010-06-01T19:20:46+02:00 (13 years ago)
Author:
stoecker
Message:

fix #4414 - draw selected relation and selected elements a bit different

Location:
trunk/src/org/openstreetmap/josm
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPaintSettings.java

    r3185 r3291  
    3030    private boolean fillConnectionNode;
    3131    private Color selectedColor;
     32    private Color relationSelectedColor;
    3233    private Color highlightColor;
    3334    private Color inactiveColor;
     
    4950
    5051        selectedColor = PaintColors.SELECTED.get();
     52        relationSelectedColor = PaintColors.RELATIONSELECTED.get();
    5153        highlightColor = PaintColors.HIGHLIGHT.get();
    5254        inactiveColor = PaintColors.INACTIVE.get();
     
    100102    public Color getSelectedColor() {
    101103        return selectedColor;
     104    }
     105
     106    public Color getRelationSelectedColor() {
     107        return relationSelectedColor;
    102108    }
    103109
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPaintVisitor.java

    r3269 r3291  
    129129
    130130        if (isZoomOk(nodeStyle)) {
    131             nodeStyle.paintPrimitive(n, paintSettings, painter, n.isSelected());
     131            nodeStyle.paintPrimitive(n, paintSettings, painter, n.isSelected(),
     132            false);
    132133        }
    133134    }
     
    178179
    179180        if(wayStyle instanceof LineElemStyle) {
    180             wayStyle.paintPrimitive(w, paintSettings, painter, data.isSelected(w));
     181            wayStyle.paintPrimitive(w, paintSettings, painter, data.isSelected(w), false);
    181182        } else if (wayStyle instanceof AreaElemStyle) {
    182183            AreaElemStyle areaStyle = (AreaElemStyle) wayStyle;
     
    189190                }
    190191            }
    191             areaStyle.getLineStyle().paintPrimitive(w, paintSettings, painter, data.isSelected(w));
     192            areaStyle.getLineStyle().paintPrimitive(w, paintSettings, painter, data.isSelected(w), false);
    192193        }
    193194    }
     
    201202                Way way = (Way)osm;
    202203                AreaElemStyle areaStyle = (AreaElemStyle)style;
    203                 areaStyle.getLineStyle().paintPrimitive(way, paintSettings, painter, true);
     204                areaStyle.getLineStyle().paintPrimitive(way, paintSettings, painter, true, true);
    204205                if(area) {
    205                     painter.drawArea(getPolygon(way), (areaselected ? paintSettings.getSelectedColor() : areaStyle.color), painter.getAreaName(way));
     206                    painter.drawArea(getPolygon(way), (areaselected ? paintSettings.getRelationSelectedColor() : areaStyle.color), painter.getAreaName(way));
    206207                }
    207208            } else {
    208                 style.paintPrimitive(osm, paintSettings, painter, true);
     209                style.paintPrimitive(osm, paintSettings, painter, true, true);
    209210            }
    210211        }
     
    212213        {
    213214            if(isZoomOk(style)) {
    214                 style.paintPrimitive(osm, paintSettings, painter, true);
     215                style.paintPrimitive(osm, paintSettings, painter, true, true);
    215216            }
    216217        }
     
    497498
    498499                    boolean selected = pd.selected || data.isSelected(r);
    499                     painter.drawArea(p, selected ? paintSettings.getSelectedColor() : areaStyle.color, painter.getAreaName(r));
     500                    painter.drawArea(p, selected ? paintSettings.getRelationSelectedColor()
     501                    : areaStyle.color, painter.getAreaName(r));
    500502                    visible = true;
    501503                }
     
    514516                    if(zoomok && (wInner.mappaintDrawnCode != paintid || multipolygon.getOuterWays().isEmpty())) {
    515517                        ((AreaElemStyle)wayStyle).getLineStyle().paintPrimitive(wInner, paintSettings, painter, (data.isSelected(wInner)
    516                                 || data.isSelected(r)));
     518                                || data.isSelected(r)), r.isSelected());
    517519                    }
    518520                    wInner.mappaintDrawnCode = paintid;
     
    546548                    if(zoomok)
    547549                    {
    548                         ((AreaElemStyle)wayStyle).getLineStyle().paintPrimitive(wOuter, paintSettings, painter, (data.isSelected(wOuter) || data.isSelected(r)));
     550                        ((AreaElemStyle)wayStyle).getLineStyle().paintPrimitive(wOuter, paintSettings, painter, (data.isSelected(wOuter) || data.isSelected(r)), r.isSelected());
    549551                    }
    550552                    wOuter.mappaintDrawnCode = paintid;
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPainter.java

    r3269 r3291  
    3939    private final Color textColor;
    4040    private final Color selectedColor;
     41    private final Color relationSelectedColor;
    4142    private final Color areaTextColor;
    4243    private final Color nodeColor;
     
    6465        this.textColor = PaintColors.TEXT.get();
    6566        this.selectedColor = PaintColors.SELECTED.get();
     67        this.relationSelectedColor = PaintColors.RELATIONSELECTED.get();
    6668        this.areaTextColor = PaintColors.AREA_TEXT.get();
    6769        this.nodeColor = PaintColors.NODE.get();
     
    181183    }
    182184
    183     public void drawNodeIcon(Node n, ImageIcon icon, boolean selected, String name) {
     185    public void drawNodeIcon(Node n, ImageIcon icon, boolean selected, boolean member, String name) {
    184186        Point p = nc.getPoint(n);
    185187        if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) return;
     
    200202        if (selected)
    201203        {
    202             g.setColor (  selectedColor );
     204            g.setColor (  member ? relationSelectedColor : selectedColor );
    203205            g.drawRect (p.x-w/2-2, p.y-h/2-2, w+4, h+4);
    204206        }
     
    298300
    299301        if (selected) {
    300             g.setColor(selectedColor);
     302            g.setColor(relationSelectedColor);
    301303            g.drawRect((int)(pVia.x+vx+vx2)-w/2-2,(int)(pVia.y+vy+vy2)-h/2-2, w+4, h+4);
    302304        }
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/PaintColors.java

    r3180 r3291  
    1313    INACTIVE(marktr("inactive"), Color.darkGray),
    1414    SELECTED(marktr("selected"), Color.red),
     15    RELATIONSELECTED(marktr("Relation: selected"), Color.magenta),
    1516    NODE(marktr("Node: standard"), Color.yellow),
    1617    CONNECTION(marktr("Node: connection"), Color.yellow),
  • trunk/src/org/openstreetmap/josm/gui/DefaultNameFormatter.java

    r3286 r3291  
    169169            name = tr("incomplete");
    170170        } else {
    171             name = relation.get("type");
     171            name = tr(relation.get("type"));
    172172            if (name == null) {
    173173                name = (relation.get("public_transport") != null) ? tr("public transport") : "";
  • trunk/src/org/openstreetmap/josm/gui/mappaint/AreaElemStyle.java

    r2675 r3291  
    4848
    4949    @Override
    50     public void paintPrimitive(OsmPrimitive primitive, MapPaintSettings paintSettings, MapPainter painter, boolean selected) {
     50    public void paintPrimitive(OsmPrimitive primitive, MapPaintSettings paintSettings, MapPainter painter, boolean selected, boolean member) {
    5151        // TODO
    5252        /*Way way = (Way)primitive;
  • trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyle.java

    r2679 r3291  
    5353    }
    5454
    55     public abstract void paintPrimitive(OsmPrimitive primitive, MapPaintSettings paintSettings, MapPainter painter, boolean selected);
     55    public abstract void paintPrimitive(OsmPrimitive primitive, MapPaintSettings paintSettings, MapPainter painter, boolean selected, boolean member);
    5656}
  • trunk/src/org/openstreetmap/josm/gui/mappaint/IconElemStyle.java

    r3222 r3291  
    3939    }
    4040    @Override
    41     public void paintPrimitive(OsmPrimitive primitive, MapPaintSettings settings, MapPainter painter, boolean selected) {
     41    public void paintPrimitive(OsmPrimitive primitive, MapPaintSettings settings, MapPainter painter, boolean selected, boolean member) {
    4242        if (painter.isShowIcons()) {
    4343            Node n = (Node) primitive;
    4444            String name = painter.isShowNames() && annotate?painter.getNodeName(n):null;
    45             painter.drawNodeIcon(n, (painter.isInactive() || n.isDisabled())?getDisabledIcon():icon, selected, name);
     45            painter.drawNodeIcon(n, (painter.isInactive() || n.isDisabled())?getDisabledIcon():icon, selected, member, name);
    4646        } else {
    47             SimpleNodeElemStyle.INSTANCE.paintPrimitive(primitive, settings, painter, selected);
     47            SimpleNodeElemStyle.INSTANCE.paintPrimitive(primitive, settings, painter, selected, member);
    4848        }
    4949
  • trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java

    r3191 r3291  
    139139
    140140    @Override
    141     public void paintPrimitive(OsmPrimitive primitive, MapPaintSettings paintSettings, MapPainter painter, boolean selected) {
     141    public void paintPrimitive(OsmPrimitive primitive, MapPaintSettings paintSettings, MapPainter painter, boolean selected, boolean member) {
    142142        Way w = (Way)primitive;
    143143        /* show direction arrows, if draw.segment.relevant_directions_only is not set,
     
    180180            myColor = paintSettings.getHighlightColor();
    181181        } else if (selected) {
    182             myColor = paintSettings.getSelectedColor();
     182            myColor = member ? paintSettings.getRelationSelectedColor() : paintSettings.getSelectedColor();
    183183        } else if(w.isDisabled()) {
    184184            myColor = paintSettings.getInactiveColor();
     
    189189            for(LineElemStyle s : overlays) {
    190190                if(!s.over) {
    191                     painter.drawWay(w, s.color != null && selected ? myColor: s.color, s.getWidth(myWidth),
     191                    painter.drawWay(w, (s.color == null || selected) ? myColor: s.color, s.getWidth(myWidth),
    192192                            s.getDashed(), s.dashedColor, false, false, false);
    193193                }
     
    202202            for(LineElemStyle s : overlays) {
    203203                if(s.over) {
    204                     painter.drawWay(w, s.color != null && selected ? myColor : s.color, s.getWidth(myWidth),
     204                    painter.drawWay(w, (s.color == null || selected) ? myColor : s.color, s.getWidth(myWidth),
    205205                            s.getDashed(), s.dashedColor, false, false, false);
    206206                }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/SimpleNodeElemStyle.java

    r3180 r3291  
    2323    @Override
    2424    public void paintPrimitive(OsmPrimitive primitive, MapPaintSettings settings, MapPainter painter,
    25             boolean selected) {
     25            boolean selected, boolean member) {
    2626        Node n = (Node)primitive;
    2727        String name = painter.isShowNames()?painter.getNodeName(n):null;
     
    3737                color = settings.getInactiveColor();
    3838            } else if (selected) {
    39                 color = settings.getSelectedColor();
     39                color = member ? settings.getRelationSelectedColor() : settings.getSelectedColor();
    4040            } else if (n.isConnectionNode()) {
    4141                if (n.isTagged()) {
Note: See TracChangeset for help on using the changeset viewer.