Changeset 9278 in josm for trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/TextLabel.java
- Timestamp:
- 2016-01-03T15:50:53+01:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement
- Files:
-
- 1 added
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/TextLabel.java
r9275 r9278 1 1 // License: GPL. For details, see LICENSE file. 2 package org.openstreetmap.josm.gui.mappaint ;2 package org.openstreetmap.josm.gui.mappaint.styleelement; 3 3 4 4 import java.awt.Color; … … 7 7 8 8 import org.openstreetmap.josm.data.osm.OsmPrimitive; 9 import org.openstreetmap.josm.gui.mappaint. LabelCompositionStrategy.DeriveLabelFromNameTagsCompositionStrategy;10 import org.openstreetmap.josm.gui.mappaint. LabelCompositionStrategy.StaticLabelCompositionStrategy;11 import org.openstreetmap.josm.gui.mappaint. LabelCompositionStrategy.TagLookupCompositionStrategy;9 import org.openstreetmap.josm.gui.mappaint.Cascade; 10 import org.openstreetmap.josm.gui.mappaint.Environment; 11 import org.openstreetmap.josm.gui.mappaint.Keyword; 12 12 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.TagKeyReference; 13 import org.openstreetmap.josm.gui.mappaint.StyleKeys; 14 import org.openstreetmap.josm.gui.mappaint.styleelement.LabelCompositionStrategy.DeriveLabelFromNameTagsCompositionStrategy; 15 import org.openstreetmap.josm.gui.mappaint.styleelement.LabelCompositionStrategy.StaticLabelCompositionStrategy; 16 import org.openstreetmap.josm.gui.mappaint.styleelement.LabelCompositionStrategy.TagLookupCompositionStrategy; 13 17 import org.openstreetmap.josm.tools.CheckParameterUtil; 14 18 import org.openstreetmap.josm.tools.Utils; … … 18 22 * @since 3880 19 23 */ 20 public class Text Elementimplements StyleKeys {24 public class TextLabel implements StyleKeys { 21 25 public static final LabelCompositionStrategy AUTO_LABEL_COMPOSITION_STRATEGY = new DeriveLabelFromNameTagsCompositionStrategy(); 22 26 … … 45 49 * @param haloColor halo color 46 50 */ 47 public Text Element(LabelCompositionStrategy strategy, Font font, int xOffset, int yOffset, Color color, Float haloRadius, Color haloColor) {51 public TextLabel(LabelCompositionStrategy strategy, Font font, int xOffset, int yOffset, Color color, Float haloRadius, Color haloColor) { 48 52 CheckParameterUtil.ensureParameterNotNull(font); 49 53 CheckParameterUtil.ensureParameterNotNull(color); … … 62 66 * @param other the other element. 63 67 */ 64 public Text Element(TextElementother) {68 public TextLabel(TextLabel other) { 65 69 this.labelCompositionStrategy = other.labelCompositionStrategy; 66 70 this.font = other.font; … … 116 120 * @throws IllegalArgumentException if {@code defaultTextColor} is null 117 121 */ 118 public static Text Elementcreate(Environment env, Color defaultTextColor, boolean defaultAnnotate) {122 public static TextLabel create(Environment env, Color defaultTextColor, boolean defaultAnnotate) { 119 123 CheckParameterUtil.ensureParameterNotNull(defaultTextColor); 120 124 Cascade c = env.mc.getCascade(env.layer); … … 124 128 String s = strategy.compose(env.osm); 125 129 if (s == null) return null; 126 Font font = ElemStyle.getFont(c, s);130 Font font = StyleElement.getFont(c, s); 127 131 128 132 float xOffset = 0; … … 157 161 } 158 162 159 return new Text Element(strategy, font, (int) xOffset, -(int) yOffset, color, haloRadius, haloColor);163 return new TextLabel(strategy, font, (int) xOffset, -(int) yOffset, color, haloRadius, haloColor); 160 164 } 161 165 … … 212 216 if (obj == null || getClass() != obj.getClass()) 213 217 return false; 214 final Text Element other = (TextElement) obj;218 final TextLabel other = (TextLabel) obj; 215 219 return Objects.equals(labelCompositionStrategy, other.labelCompositionStrategy) && 216 220 Objects.equals(font, other.font) &&
Note:
See TracChangeset
for help on using the changeset viewer.