Changeset 3992 in josm


Ignore:
Timestamp:
2011-03-14T00:27:46+01:00 (14 years ago)
Author:
bastiK
Message:

applied #6107 - MapCSS enhancement (patch by anonymous)

Location:
trunk/src/org/openstreetmap/josm/gui/mappaint
Files:
4 edited

Legend:

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

    r3967 r3992  
    8080        Keyword textPos = c.get("text-position", null, Keyword.class);
    8181        if (textPos == null || Utils.equal(textPos.val, "center")) {
    82             text = TextElement.create(c, PaintColors.AREA_TEXT.get());
     82            text = TextElement.create(c, PaintColors.AREA_TEXT.get(), true);
    8383        }
    8484       
  • trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java

    r3967 r3992  
    185185            Keyword textPos = c.get("text-position", null, Keyword.class);
    186186            if (textPos == null || equal(textPos.val, "line")) {
    187                 text = TextElement.create(c, PaintColors.TEXT.get());
     187                text = TextElement.create(c, PaintColors.TEXT.get(), false);
    188188            }
    189189        }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java

    r3987 r3992  
    177177        }
    178178
    179         if (icon == null && symbol == null && !allowOnlyText)
    180             return null;
    181 
    182179        NodeTextElement text = null;
    183         TextElement te = TextElement.create(c, DEFAULT_TEXT_COLOR);
     180        TextElement te = TextElement.create(c, DEFAULT_TEXT_COLOR, symbol == null && icon == null);
    184181        // optimization: if we neither have a symbol, nor an icon, nor a text element
    185182        // we don't have to check for the remaining style properties and we don't
  • trunk/src/org/openstreetmap/josm/gui/mappaint/TextElement.java

    r3987 r3992  
    8080     * @return the label composition strategy
    8181     */
    82     protected static LabelCompositionStrategy buildLabelCompositionStrategy(Cascade c){
     82    protected static LabelCompositionStrategy buildLabelCompositionStrategy(Cascade c, boolean defaultAnnotate){
    8383        Keyword textKW = c.get("text", null, Keyword.class, true);
    8484        if (textKW == null) {
    8585            String textKey = c.get("text", null, String.class);
    86             if (textKey == null) return null;
     86            if (textKey == null)
     87                return defaultAnnotate ? AUTO_LABEL_COMPOSITION_STRATEGY : null;
    8788            return new TagLookupCompositionStrategy(textKey);
    8889        } else if (textKW.val.equals("auto"))
     
    102103     * @throws IllegalArgumentException thrown if {@code defaultTextColor} is null
    103104     */
    104     public static TextElement create(Cascade c, Color defaultTextColor)  throws IllegalArgumentException{
     105    public static TextElement create(Cascade c, Color defaultTextColor, boolean defaultAnnotate)  throws IllegalArgumentException{
    105106        CheckParameterUtil.ensureParameterNotNull(defaultTextColor);
    106107
    107         LabelCompositionStrategy strategy = buildLabelCompositionStrategy(c);
     108        LabelCompositionStrategy strategy = buildLabelCompositionStrategy(c, defaultAnnotate);
    108109        Font font = ElemStyle.getFont(c);
    109110
Note: See TracChangeset for help on using the changeset viewer.