Changeset 11718 in josm


Ignore:
Timestamp:
2017-03-13T14:18:11+01:00 (3 months ago)
Author:
michael2402
Message:

Allow renderer to draw area text / area icon even if no background was specified in this style layer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaElement.java

    r11700 r11718  
    3333    /**
    3434     * If fillImage == null, color is the fill-color, otherwise
    35      * an arbitrary color value sampled from the fillImage
     35     * an arbitrary color value sampled from the fillImage.
     36     *
     37     * The color may be fully transparent to indicate that the are should not be filled.
    3638     */
    3739    public Color color;
     
    118120        }
    119121
     122        TextLabel text = null;
     123        Keyword textPos = c.get(TEXT_POSITION, null, Keyword.class);
     124        if (textPos == null || "center".equals(textPos.val)) {
     125            text = TextLabel.create(env, PaintColors.AREA_TEXT.get(), true);
     126        }
     127        MapImage iconImage = NodeElement.createIcon(env);
     128        RotationAngle rotationAngle = NodeElement.createRotationAngle(env);
     129
     130        if (iconImage != null || text != null) {
     131            // fake a transparent color.
     132            color = new Color(0, 0, 0, 0);
     133        }
     134
    120135        if (color != null) {
    121 
    122             TextLabel text = null;
    123             Keyword textPos = c.get(TEXT_POSITION, null, Keyword.class);
    124             if (textPos == null || "center".equals(textPos.val)) {
    125                 text = TextLabel.create(env, PaintColors.AREA_TEXT.get(), true);
    126             }
    127 
    128136            Float extent = c.get(FILL_EXTENT, null, float.class);
    129137            Float extentThreshold = c.get(FILL_EXTENT_THRESHOLD, null, float.class);
    130 
    131             MapImage iconImage = NodeElement.createIcon(env);
    132             RotationAngle rotationAngle = NodeElement.createRotationAngle(env);
    133138
    134139            return new AreaElement(c, color, fillImage, extent, extentThreshold, text, iconImage, rotationAngle);
Note: See TracChangeset for help on using the changeset viewer.