Changeset 4007 in josm for trunk/src/org/openstreetmap/josm/gui/mappaint/TextElement.java
- Timestamp:
- 2011-03-27T13:41:58+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/TextElement.java
r4003 r4007 9 9 import org.openstreetmap.josm.data.osm.OsmPrimitive; 10 10 import org.openstreetmap.josm.gui.mappaint.LabelCompositionStrategy.DeriveLabelFromNameTagsCompositionStrategy; 11 import org.openstreetmap.josm.gui.mappaint.LabelCompositionStrategy.StaticLabelCompositionStrategy; 11 12 import org.openstreetmap.josm.gui.mappaint.LabelCompositionStrategy.TagLookupCompositionStrategy; 13 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.TagKeyReference; 12 14 import org.openstreetmap.josm.tools.CheckParameterUtil; 13 15 import org.openstreetmap.josm.tools.Utils; … … 81 83 */ 82 84 protected static LabelCompositionStrategy buildLabelCompositionStrategy(Cascade c, boolean defaultAnnotate){ 83 Keyword textKW = c.get("text", null, Keyword.class, true); 84 if (textKW == null) { 85 String textKey = c.get("text", null, String.class); 86 if (textKey == null) 87 return defaultAnnotate ? AUTO_LABEL_COMPOSITION_STRATEGY : null; 88 return new TagLookupCompositionStrategy(textKey); 89 } else if (textKW.val.equals("auto")) 85 /* 86 * If the cascade includes a TagKeyReference we will lookup the rendered label 87 * from a tag value. 88 */ 89 TagKeyReference tkr = c.get("text", null, TagKeyReference.class, true); 90 if (tkr != null) 91 return new TagLookupCompositionStrategy(tkr.key); 92 93 /* 94 * Check whether the label composition strategy is given by 95 * a keyword 96 */ 97 Keyword keyword = c.get("text", null, Keyword.class, true); 98 if (equal(keyword, Keyword.AUTO)) 90 99 return AUTO_LABEL_COMPOSITION_STRATEGY; 91 else 92 return new TagLookupCompositionStrategy(textKW.val); 100 101 /* 102 * Do we have a static text label? 103 */ 104 String text = c.get("text", null, String.class, true); 105 if (text != null) 106 return new StaticLabelCompositionStrategy(text); 107 return defaultAnnotate ? AUTO_LABEL_COMPOSITION_STRATEGY : null; 93 108 } 94 109
Note:
See TracChangeset
for help on using the changeset viewer.
