Changeset 10009 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2016-03-18T01:12:00+01:00 (8 years ago)
Author:
Don-vip
Message:

fix #12634 - Make filled area of validation layer transparent (patch by michael2402)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/PaintVisitor.java

    r9371 r10009  
    121121        if (!paintedPoints.contains(pp)) {
    122122            Point p = mv.getPoint(n);
     123
     124            if (selected) {
     125                g.setColor(getHighlightColor());
     126                g.fillOval(p.x - 5, p.y - 5, 10, 10);
     127            }
    123128            g.setColor(color);
    124 
    125             if (selected) {
    126                 g.fillOval(p.x - 5, p.y - 5, 10, 10);
    127             } else {
    128                 g.drawOval(p.x - 5, p.y - 5, 10, 10);
    129             }
     129            g.drawOval(p.x - 5, p.y - 5, 10, 10);
    130130            paintedPoints.add(pp);
    131131        }
     
    140140     */
    141141    protected void drawSegment(Point p1, Point p2, Color color) {
    142         g.setColor(color);
    143142
    144143        double t = Math.atan2(p2.x - p1.x, p2.y - p1.y);
     
    147146        int deg = (int) Math.toDegrees(t);
    148147        if (selected) {
     148            g.setColor(getHighlightColor());
    149149            int[] x = new int[] {(int) (p1.x + cosT), (int) (p2.x + cosT),
    150150                                 (int) (p2.x - cosT), (int) (p1.x - cosT)};
     
    154154            g.fillArc(p1.x - 5, p1.y - 5, 10, 10, deg,  180);
    155155            g.fillArc(p2.x - 5, p2.y - 5, 10, 10, deg, -180);
    156         } else {
    157             g.drawLine((int) (p1.x + cosT), (int) (p1.y - sinT),
    158                        (int) (p2.x + cosT), (int) (p2.y - sinT));
    159             g.drawLine((int) (p1.x - cosT), (int) (p1.y + sinT),
    160                        (int) (p2.x - cosT), (int) (p2.y + sinT));
    161             g.drawArc(p1.x - 5, p1.y - 5, 10, 10, deg,  180);
    162             g.drawArc(p2.x - 5, p2.y - 5, 10, 10, deg, -180);
    163         }
     156        }
     157        g.setColor(color);
     158        g.drawLine((int) (p1.x + cosT), (int) (p1.y - sinT),
     159                (int) (p2.x + cosT), (int) (p2.y - sinT));
     160        g.drawLine((int) (p1.x - cosT), (int) (p1.y + sinT),
     161                (int) (p2.x - cosT), (int) (p2.y + sinT));
     162        g.drawArc(p1.x - 5, p1.y - 5, 10, 10, deg,  180);
     163        g.drawArc(p2.x - 5, p2.y - 5, 10, 10, deg, -180);
    164164    }
    165165
     
    259259
    260260    /**
     261     * Gets the color to draw highlight markers with.
     262     * @return The color.
     263     */
     264    private Color getHighlightColor() {
     265        return new Color(color.getRed(), color.getGreen(), color.getBlue(), (int) (color.getAlpha() * .4));
     266    }
     267
     268    /**
    261269     * Clears the internal painted objects collections.
    262270     */
Note: See TracChangeset for help on using the changeset viewer.