Changeset 4415 in josm
- Timestamp:
- 2011-09-11T20:50:21+02:00 (13 years ago)
- 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 70 70 Pair<StyleList, Range> p = getImpl(osm, scale, nc); 71 71 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 } 83 97 } 84 98 } … … 93 107 if (!hasProperLineStyle) { 94 108 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); 97 110 p.a = new StyleList(p.a, line); 98 111 } … … 308 321 sl.add(nodeStyle); 309 322 addIfNotNull(sl, BoxTextElemStyle.create(env, nodeStyle.getBox())); 323 } else { 324 addIfNotNull(sl, BoxTextElemStyle.create(env, NodeElemStyle.SIMPLE_NODE_ELEMSTYLE.getBox())); 310 325 } 311 326 } else if (osm instanceof Relation) { -
trunk/src/org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java
r4327 r4415 19 19 import org.openstreetmap.josm.data.osm.visitor.paint.MapPainter; 20 20 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference; 21 import org.openstreetmap.josm.gui.mappaint.StyleCache.StyleList; 21 22 import org.openstreetmap.josm.tools.Pair; 22 23 import org.openstreetmap.josm.tools.Utils; … … 91 92 if (SIMPLE_NODE_ELEMSTYLE == null) throw new AssertionError(); 92 93 } 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); 93 97 94 98 protected NodeElemStyle(Cascade c, ImageIcon icon, Integer iconAlpha, Symbol symbol) { -
trunk/src/org/openstreetmap/josm/gui/mappaint/TextElement.java
r4310 r4415 20 20 */ 21 21 public class TextElement { 22 static p rivatefinal LabelCompositionStrategy AUTO_LABEL_COMPOSITION_STRATEGY = new DeriveLabelFromNameTagsCompositionStrategy();22 static public final LabelCompositionStrategy AUTO_LABEL_COMPOSITION_STRATEGY = new DeriveLabelFromNameTagsCompositionStrategy(); 23 23 24 24 /** the strategy for building the actual label value for a given a {@link OsmPrimitive}.
Note:
See TracChangeset
for help on using the changeset viewer.