Ticket #6107: 2lines-extended.patch
| File 2lines-extended.patch, 3.9 KB (added by , 15 years ago) |
|---|
-
src/org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java
176 176 symbol = createSymbol(env); 177 177 } 178 178 179 if (icon == null && symbol == null && !allowOnlyText)180 return null;181 182 179 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); 184 181 // optimization: if we neither have a symbol, nor an icon, nor a text element 185 182 // we don't have to check for the remaining style properties and we don't 186 183 // have to allocate a node element style. -
src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java
184 184 if (!casing) { 185 185 Keyword textPos = c.get("text-position", null, Keyword.class); 186 186 if (textPos == null || equal(textPos.val, "line")) { 187 text = TextElement.create(c, PaintColors.TEXT.get() );187 text = TextElement.create(c, PaintColors.TEXT.get(), false); 188 188 } 189 189 } 190 190 -
src/org/openstreetmap/josm/gui/mappaint/AreaElemStyle.java
79 79 TextElement text = null; 80 80 Keyword textPos = c.get("text-position", null, Keyword.class); 81 81 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); 83 83 } 84 84 85 85 if (color != null) -
src/org/openstreetmap/josm/gui/mappaint/TextElement.java
79 79 * @param c the style properties 80 80 * @return the label composition strategy 81 81 */ 82 protected static LabelCompositionStrategy buildLabelCompositionStrategy(Cascade c ){82 protected static LabelCompositionStrategy buildLabelCompositionStrategy(Cascade c, boolean defaultAnnotate){ 83 83 Keyword textKW = c.get("text", null, Keyword.class, true); 84 84 if (textKW == null) { 85 85 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; 87 88 return new TagLookupCompositionStrategy(textKey); 88 89 } else if (textKW.val.equals("auto")) 89 90 return AUTO_LABEL_COMPOSITION_STRATEGY; … … 101 102 * properties for text rendering 102 103 * @throws IllegalArgumentException thrown if {@code defaultTextColor} is null 103 104 */ 104 public static TextElement create(Cascade c, Color defaultTextColor ) throws IllegalArgumentException{105 public static TextElement create(Cascade c, Color defaultTextColor, boolean defaultAnnotate) throws IllegalArgumentException{ 105 106 CheckParameterUtil.ensureParameterNotNull(defaultTextColor); 106 107 107 LabelCompositionStrategy strategy = buildLabelCompositionStrategy(c );108 LabelCompositionStrategy strategy = buildLabelCompositionStrategy(c, defaultAnnotate); 108 109 Font font = ElemStyle.getFont(c); 109 110 110 111 float xOffset = 0;
