Changeset 3979 in josm for trunk/src/org/openstreetmap/josm/gui
- Timestamp:
- 2011-03-12T10:27:24+01:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/mappaint
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java
r3969 r3979 6 6 import java.awt.BasicStroke; 7 7 import java.awt.Color; 8 import java.awt.Font;9 8 import java.awt.Stroke; 10 9 … … 93 92 public VerticalTextAlignment vAlign; 94 93 95 public NodeTextElement( String textKey, HorizontalTextAlignment hAlign, VerticalTextAlignment vAlign, Font font, int xOffset, int yOffset, Color color) {96 super(text Key, font, xOffset, yOffset, color);94 public NodeTextElement(TextElement text, HorizontalTextAlignment hAlign, VerticalTextAlignment vAlign) { 95 super(text); 97 96 CheckParameterUtil.ensureParameterNotNull(hAlign); 98 97 CheckParameterUtil.ensureParameterNotNull(vAlign); … … 192 191 vAlign = VerticalTextAlignment.BELOW; 193 192 } 194 text = new NodeTextElement(te .textKey, hAlign, vAlign, te.font, te.xOffset, te.yOffset, te.color);193 text = new NodeTextElement(te, hAlign, vAlign); 195 194 } 196 195 -
trunk/src/org/openstreetmap/josm/gui/mappaint/TextElement.java
r3967 r3979 10 10 11 11 import org.openstreetmap.josm.tools.CheckParameterUtil; 12 import org.openstreetmap.josm.tools.Utils; 12 13 13 14 public class TextElement { … … 19 20 public int yOffset; 20 21 public Color color; 22 public Float haloRadius; 23 public Color haloColor; 21 24 22 public TextElement(String textKey, Font font, int xOffset, int yOffset, Color color ) {25 public TextElement(String textKey, Font font, int xOffset, int yOffset, Color color, Float haloRadius, Color haloColor) { 23 26 CheckParameterUtil.ensureParameterNotNull(font); 24 27 CheckParameterUtil.ensureParameterNotNull(color); … … 28 31 this.yOffset = yOffset; 29 32 this.color = color; 33 this.haloRadius = haloRadius; 34 this.haloColor = haloColor; 35 } 36 37 public TextElement(TextElement other) { 38 this.textKey = other.textKey; 39 this.font = other.font; 40 this.xOffset = other.xOffset; 41 this.yOffset = other.yOffset; 42 this.color = other.color; 43 this.haloColor = other.haloColor; 44 this.haloRadius = other.haloRadius; 30 45 } 31 46 … … 58 73 59 74 Color color = c.get("text-color", defTextColor, Color.class); 60 61 return new TextElement(textKey, font, (int) xOffset, - (int) yOffset, color); 75 float alpha = c.get("text-opacity", 1f, Float.class); 76 color = new Color(color.getRed(), color.getGreen(), 77 color.getBlue(), Utils.color_float2int(alpha)); 78 79 Float haloRadius = c.get("text-halo-radius", null, Float.class); 80 if (haloRadius != null && haloRadius <= 0) { 81 haloRadius = null; 82 } 83 Color haloColor = null; 84 if (haloRadius != null) { 85 haloColor = c.get("text-halo-color", Utils.complement(color), Color.class); 86 float haloAlpha = c.get("text-halo-opacity", 1f, Float.class); 87 haloColor = new Color(haloColor.getRed(), haloColor.getGreen(), 88 haloColor.getBlue(), Utils.color_float2int(haloAlpha)); 89 } 90 91 return new TextElement(textKey, font, (int) xOffset, - (int) yOffset, color, haloRadius, haloColor); 62 92 } 63 93 … … 71 101 xOffset == other.xOffset && 72 102 yOffset == other.yOffset && 73 equal(color, other.color); 103 equal(color, other.color) && 104 equal(haloRadius, other.haloRadius) && 105 equal(haloColor, other.haloColor); 74 106 } 75 107 … … 82 114 hash = 79 * hash + yOffset; 83 115 hash = 79 * hash + color.hashCode(); 116 hash = 79 * hash + (haloRadius != null ? Float.floatToIntBits(haloRadius) : 0); 117 hash = 79 * hash + (haloColor != null ? haloColor.hashCode() : 0); 84 118 return hash; 85 119 }
Note:
See TracChangeset
for help on using the changeset viewer.