Ignore:
Timestamp:
2011-02-09T19:13:04+01:00 (14 years ago)
Author:
bastiK
Message:

mapcss: improve shape & area style generation

File:
1 edited

Legend:

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

    r3871 r3879  
    211211    }
    212212
    213     public void drawNodeSymbol(Node n, Symbol s, boolean selected, boolean member, TextElement text) {
     213    public void drawNodeSymbol(Node n, Symbol s, Color fillColor, Color strokeColor, TextElement text) {
    214214        Point p = nc.getPoint(n);
    215215        if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) return;
    216216        int radius = s.size / 2;
    217217
    218         if (s.fillColor != null) {
    219             if (inactive || n.isDisabled()) {
    220                 g.setColor(inactiveColor);
    221             } else {
    222                 g.setColor(s.fillColor);
    223             }
     218        if (fillColor != null) {
     219            g.setColor(fillColor);
    224220            switch (s.symbol) {
    225221                case SQUARE:
     
    235231        if (s.stroke != null) {
    236232            g.setStroke(s.stroke);
    237             if (inactive || n.isDisabled()) {
    238                 g.setColor(inactiveColor);
    239             } else {
    240                 g.setColor(s.strokeColor);
    241             }
     233            g.setColor(strokeColor);
    242234            switch (s.symbol) {
    243235                case SQUARE:
     
    353345    }
    354346
    355     public void drawArea(Way w, Color color, BufferedImage fillImage, String name) {
     347    public void drawArea(Way w, Color color, BufferedImage fillImage, float fillImageAlpha, String name) {
    356348        Polygon polygon = getPolygon(w);
    357         drawArea(polygon, color, fillImage, name);
    358     }
    359 
    360     protected void drawArea(Polygon polygon, Color color, BufferedImage fillImage, String name) {
     349        drawArea(polygon, color, fillImage, fillImageAlpha, name);
     350    }
     351
     352    protected void drawArea(Polygon polygon, Color color, BufferedImage fillImage, float fillImageAlpha, String name) {
    361353
    362354        if (fillImage == null) {
     
    367359                    new Rectangle(polygon.xpoints[0], polygon.ypoints[0], fillImage.getWidth(), fillImage.getHeight()));
    368360            g.setPaint(texture);
    369             if (color.getAlpha() != 255) {
    370                 g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, Utils.color_int2float(color.getAlpha())));
     361            if (fillImageAlpha != 1f) {
     362                g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, fillImageAlpha));
    371363            }
    372364            g.fill(polygon);
     
    411403    }
    412404
    413     public void drawArea(Relation r, Color color, BufferedImage fillImage, String name) {
     405    public void drawArea(Relation r, Color color, BufferedImage fillImage, float fillImageAlpha, String name) {
    414406        Multipolygon multipolygon = new Multipolygon(nc);
    415407        multipolygon.load(r);
     
    420412                    continue;
    421413                }
    422                 drawArea(p, color, fillImage, getAreaName(r));
     414                drawArea(p, color, fillImage, fillImageAlpha, getAreaName(r));
    423415            }
    424416        }
Note: See TracChangeset for help on using the changeset viewer.