Changeset 4415 in josm


Ignore:
Timestamp:
Sep 11, 2011 8:50:21 PM (21 months ago)
Author:
bastiK
Message:

fixed #6817 - mapcss stylesheet not rendered correctly in 4399

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

Legend:

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

    r4319 r4415  
    7070        Pair<StyleList, Range> p = getImpl(osm, scale, nc); 
    7171        if (osm instanceof Node && isDefaultNodes()) { 
    72             boolean hasNonModifier = false; 
    73             for (ElemStyle s : p.a) { 
    74                 if (!s.isModifier) { 
    75                     hasNonModifier = true; 
    76                     break; 
    77                 } 
    78             } 
    79             if (!hasNonModifier) { 
    80                 p.a = new StyleList(p.a, NodeElemStyle.SIMPLE_NODE_ELEMSTYLE); 
    81                 if (BoxTextElemStyle.SIMPLE_NODE_TEXT_ELEMSTYLE.text.labelCompositionStrategy.compose(osm) != null) { 
    82                     p.a = new StyleList(p.a, BoxTextElemStyle.SIMPLE_NODE_TEXT_ELEMSTYLE); 
     72            if (p.a.isEmpty()) { 
     73                if (TextElement.AUTO_LABEL_COMPOSITION_STRATEGY.compose(osm) != null) { 
     74                    p.a = NodeElemStyle.DEFAULT_NODE_STYLELIST_TEXT; 
     75                } else { 
     76                    p.a = NodeElemStyle.DEFAULT_NODE_STYLELIST; 
     77                } 
     78            } else { 
     79                boolean hasNonModifier = false; 
     80                boolean hasText = false; 
     81                for (ElemStyle s : p.a) { 
     82                    if (s instanceof BoxTextElemStyle) { 
     83                        hasText = true; 
     84                    } else { 
     85                        if (!s.isModifier) { 
     86                            hasNonModifier = true; 
     87                        } 
     88                    } 
     89                } 
     90                if (!hasNonModifier) { 
     91                    p.a = new StyleList(p.a, NodeElemStyle.SIMPLE_NODE_ELEMSTYLE); 
     92                    if (!hasText) { 
     93                        if (TextElement.AUTO_LABEL_COMPOSITION_STRATEGY.compose(osm) != null) { 
     94                            p.a = new StyleList(p.a, BoxTextElemStyle.SIMPLE_NODE_TEXT_ELEMSTYLE); 
     95                        } 
     96                    } 
    8397                } 
    8498            } 
     
    93107            if (!hasProperLineStyle) { 
    94108                AreaElemStyle area = Utils.find(p.a, AreaElemStyle.class); 
    95                 LineElemStyle line = null; 
    96                 line = (area == null ? LineElemStyle.UNTAGGED_WAY : LineElemStyle.createSimpleLineStyle(area.color, true)); 
     109                LineElemStyle line = area == null ? LineElemStyle.UNTAGGED_WAY : LineElemStyle.createSimpleLineStyle(area.color, true); 
    97110                p.a = new StyleList(p.a, line); 
    98111            } 
     
    308321                    sl.add(nodeStyle); 
    309322                    addIfNotNull(sl, BoxTextElemStyle.create(env, nodeStyle.getBox())); 
     323                } else { 
     324                    addIfNotNull(sl, BoxTextElemStyle.create(env, NodeElemStyle.SIMPLE_NODE_ELEMSTYLE.getBox())); 
    310325                } 
    311326            } else if (osm instanceof Relation) { 
  • trunk/src/org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java

    r4327 r4415  
    1919import org.openstreetmap.josm.data.osm.visitor.paint.MapPainter; 
    2020import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference; 
     21import org.openstreetmap.josm.gui.mappaint.StyleCache.StyleList; 
    2122import org.openstreetmap.josm.tools.Pair; 
    2223import org.openstreetmap.josm.tools.Utils; 
     
    9192        if (SIMPLE_NODE_ELEMSTYLE == null) throw new AssertionError(); 
    9293    } 
     94 
     95    public static final StyleList DEFAULT_NODE_STYLELIST = new StyleList(NodeElemStyle.SIMPLE_NODE_ELEMSTYLE); 
     96    public static final StyleList DEFAULT_NODE_STYLELIST_TEXT = new StyleList(NodeElemStyle.SIMPLE_NODE_ELEMSTYLE, BoxTextElemStyle.SIMPLE_NODE_TEXT_ELEMSTYLE); 
    9397 
    9498    protected NodeElemStyle(Cascade c, ImageIcon icon, Integer iconAlpha, Symbol symbol) { 
  • trunk/src/org/openstreetmap/josm/gui/mappaint/TextElement.java

    r4310 r4415  
    2020 */ 
    2121public class TextElement { 
    22     static private final LabelCompositionStrategy AUTO_LABEL_COMPOSITION_STRATEGY = new DeriveLabelFromNameTagsCompositionStrategy(); 
     22    static public final LabelCompositionStrategy AUTO_LABEL_COMPOSITION_STRATEGY = new DeriveLabelFromNameTagsCompositionStrategy(); 
    2323 
    2424    /** the strategy for building the actual label value for a given a {@link OsmPrimitive}. 
Note: See TracChangeset for help on using the changeset viewer.