Changeset 9278 in josm
- Timestamp:
- 2016-01-03T15:50:53+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 added
- 8 edited
- 10 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r9243 r9278 59 59 import org.openstreetmap.josm.data.osm.visitor.paint.relations.MultipolygonCache; 60 60 import org.openstreetmap.josm.gui.NavigatableComponent; 61 import org.openstreetmap.josm.gui.mappaint.AreaElemStyle;62 import org.openstreetmap.josm.gui.mappaint.BoxTextElemStyle;63 import org.openstreetmap.josm.gui.mappaint.BoxTextElemStyle.HorizontalTextAlignment;64 import org.openstreetmap.josm.gui.mappaint.BoxTextElemStyle.VerticalTextAlignment;65 import org.openstreetmap.josm.gui.mappaint.ElemStyle;66 61 import org.openstreetmap.josm.gui.mappaint.ElemStyles; 67 import org.openstreetmap.josm.gui.mappaint.MapImage;68 62 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; 69 import org.openstreetmap.josm.gui.mappaint.NodeElemStyle;70 import org.openstreetmap.josm.gui.mappaint.NodeElemStyle.Symbol;71 import org.openstreetmap.josm.gui.mappaint.RepeatImageElemStyle.LineImageAlignment;72 63 import org.openstreetmap.josm.gui.mappaint.StyleCache.StyleList; 73 import org.openstreetmap.josm.gui.mappaint.TextElement;74 64 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource; 75 65 import org.openstreetmap.josm.gui.mappaint.mapcss.Selector; 66 import org.openstreetmap.josm.gui.mappaint.styleelement.AreaElement; 67 import org.openstreetmap.josm.gui.mappaint.styleelement.BoxTextElement; 68 import org.openstreetmap.josm.gui.mappaint.styleelement.BoxTextElement.HorizontalTextAlignment; 69 import org.openstreetmap.josm.gui.mappaint.styleelement.BoxTextElement.VerticalTextAlignment; 70 import org.openstreetmap.josm.gui.mappaint.styleelement.MapImage; 71 import org.openstreetmap.josm.gui.mappaint.styleelement.NodeElement; 72 import org.openstreetmap.josm.gui.mappaint.styleelement.NodeElement.Symbol; 73 import org.openstreetmap.josm.gui.mappaint.styleelement.RepeatImageElement.LineImageAlignment; 74 import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement; 75 import org.openstreetmap.josm.gui.mappaint.styleelement.TextLabel; 76 76 import org.openstreetmap.josm.tools.CompositeList; 77 77 import org.openstreetmap.josm.tools.Geometry; … … 190 190 191 191 private static class StyleRecord implements Comparable<StyleRecord> { 192 private final ElemStylestyle;192 private final StyleElement style; 193 193 private final OsmPrimitive osm; 194 194 private final int flags; 195 195 196 StyleRecord( ElemStylestyle, OsmPrimitive osm, int flags) {196 StyleRecord(StyleElement style, OsmPrimitive osm, int flags) { 197 197 this.style = style; 198 198 this.osm = osm; … … 223 223 224 224 // simple node on top of icons and shapes 225 if (this.style == NodeElem Style.SIMPLE_NODE_ELEMSTYLE && other.style != NodeElemStyle.SIMPLE_NODE_ELEMSTYLE)225 if (this.style == NodeElement.SIMPLE_NODE_ELEMSTYLE && other.style != NodeElement.SIMPLE_NODE_ELEMSTYLE) 226 226 return 1; 227 if (this.style != NodeElem Style.SIMPLE_NODE_ELEMSTYLE && other.style == NodeElemStyle.SIMPLE_NODE_ELEMSTYLE)227 if (this.style != NodeElement.SIMPLE_NODE_ELEMSTYLE && other.style == NodeElement.SIMPLE_NODE_ELEMSTYLE) 228 228 return -1; 229 229 … … 418 418 * @param text text style to use 419 419 */ 420 private void displayText(GlyphVector gv, String s, int x, int y, boolean disabled, Text Elementtext) {420 private void displayText(GlyphVector gv, String s, int x, int y, boolean disabled, TextLabel text) { 421 421 if (gv == null && s.isEmpty()) return; 422 422 if (isInactiveMode || disabled) { … … 472 472 */ 473 473 protected void drawArea(OsmPrimitive osm, Path2D.Double path, Color color, 474 MapImage fillImage, Float extent, Path2D.Double pfClip, boolean disabled, Text Elementtext) {474 MapImage fillImage, Float extent, Path2D.Double pfClip, boolean disabled, TextLabel text) { 475 475 476 476 Shape area = path.createTransformedShape(nc.getAffineTransform()); … … 525 525 } 526 526 527 private void drawAreaText(OsmPrimitive osm, Text Elementtext, Shape area) {527 private void drawAreaText(OsmPrimitive osm, TextLabel text, Shape area) { 528 528 if (text != null && isShowNames()) { 529 529 // abort if we can't compose the label to be rendered … … 612 612 * @param text The text to write on the area. 613 613 */ 614 public void drawArea(Relation r, Color color, MapImage fillImage, Float extent, Float extentThreshold, boolean disabled, Text Elementtext) {614 public void drawArea(Relation r, Color color, MapImage fillImage, Float extent, Float extentThreshold, boolean disabled, TextLabel text) { 615 615 Multipolygon multipolygon = MultipolygonCache.getInstance().get(nc, r); 616 616 if (!r.isDisabled() && !multipolygon.getOuterWays().isEmpty()) { … … 648 648 * @param text The text to write on the area. 649 649 */ 650 public void drawArea(Way w, Color color, MapImage fillImage, Float extent, Float extentThreshold, boolean disabled, Text Elementtext) {650 public void drawArea(Way w, Color color, MapImage fillImage, Float extent, Float extentThreshold, boolean disabled, TextLabel text) { 651 651 Path2D.Double pfClip = null; 652 652 if (extent != null) { … … 678 678 } 679 679 680 public void drawBoxText(Node n, BoxTextElem Stylebs) {680 public void drawBoxText(Node n, BoxTextElement bs) { 681 681 if (!isShowNames() || bs == null) 682 682 return; 683 683 684 684 Point p = nc.getPoint(n); 685 Text Elementtext = bs.text;685 TextLabel text = bs.text; 686 686 String s = text.labelCompositionStrategy.compose(n); 687 687 if (s == null) return; … … 1204 1204 * @param text The text definition (font/.../text content) to draw. 1205 1205 */ 1206 public void drawTextOnPath(Way way, Text Elementtext) {1206 public void drawTextOnPath(Way way, TextLabel text) { 1207 1207 if (way == null || text == null) 1208 1208 return; … … 1826 1826 public void add(Node osm, int flags) { 1827 1827 StyleList sl = styles.get(osm, circum, nc); 1828 for ( ElemStyles : sl) {1828 for (StyleElement s : sl) { 1829 1829 output.add(new StyleRecord(s, osm, flags)); 1830 1830 } … … 1833 1833 public void add(Relation osm, int flags) { 1834 1834 StyleList sl = styles.get(osm, circum, nc); 1835 for ( ElemStyles : sl) {1836 if (drawMultipolygon && drawArea && s instanceof AreaElem Style&& (flags & FLAG_DISABLED) == 0) {1835 for (StyleElement s : sl) { 1836 if (drawMultipolygon && drawArea && s instanceof AreaElement && (flags & FLAG_DISABLED) == 0) { 1837 1837 output.add(new StyleRecord(s, osm, flags)); 1838 } else if (drawRestriction && s instanceof NodeElem Style) {1838 } else if (drawRestriction && s instanceof NodeElement) { 1839 1839 output.add(new StyleRecord(s, osm, flags)); 1840 1840 } … … 1844 1844 public void add(Way osm, int flags) { 1845 1845 StyleList sl = styles.get(osm, circum, nc); 1846 for ( ElemStyles : sl) {1847 if (!(drawArea && (flags & FLAG_DISABLED) == 0) && s instanceof AreaElem Style) {1846 for (StyleElement s : sl) { 1847 if (!(drawArea && (flags & FLAG_DISABLED) == 0) && s instanceof AreaElement) { 1848 1848 continue; 1849 1849 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java
r9087 r9278 31 31 import org.openstreetmap.josm.data.validation.TestError; 32 32 import org.openstreetmap.josm.gui.DefaultNameFormatter; 33 import org.openstreetmap.josm.gui.mappaint.AreaElem Style;33 import org.openstreetmap.josm.gui.mappaint.styleelement.AreaElement; 34 34 import org.openstreetmap.josm.gui.mappaint.ElemStyles; 35 35 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; … … 182 182 183 183 if (styles != null && !"boundary".equals(r.get("type"))) { 184 AreaElem Stylearea = ElemStyles.getAreaElemStyle(r, false);184 AreaElement area = ElemStyles.getAreaElemStyle(r, false); 185 185 boolean areaStyle = area != null; 186 186 // If area style was not found for relation then use style of ways … … 206 206 if (area != null) { 207 207 for (Way wInner : polygon.getInnerWays()) { 208 AreaElem StyleareaInner = ElemStyles.getAreaElemStyle(wInner, false);208 AreaElement areaInner = ElemStyles.getAreaElemStyle(wInner, false); 209 209 210 210 if (areaInner != null && area.equals(areaInner)) { … … 218 218 } 219 219 for (Way wOuter : polygon.getOuterWays()) { 220 AreaElem StyleareaOuter = ElemStyles.getAreaElemStyle(wOuter, false);220 AreaElement areaOuter = ElemStyles.getAreaElemStyle(wOuter, false); 221 221 if (areaOuter != null) { 222 222 List<OsmPrimitive> l = new ArrayList<>(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialog.java
r9078 r9278 39 39 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 40 40 import org.openstreetmap.josm.gui.mappaint.Cascade; 41 import org.openstreetmap.josm.gui.mappaint. ElemStyle;41 import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement; 42 42 import org.openstreetmap.josm.gui.mappaint.ElemStyles; 43 43 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; … … 363 363 txtMappaint.append(tr("\n\nList of generated Styles:\n")); 364 364 StyleList sl = elemstyles.get(osm, scale, nc); 365 for ( ElemStyles : sl) {365 for (StyleElement s : sl) { 366 366 txtMappaint.append(" * ").append(s).append('\n'); 367 367 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
r9239 r9278 23 23 import org.openstreetmap.josm.gui.mappaint.StyleCache.StyleList; 24 24 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource; 25 import org.openstreetmap.josm.gui.mappaint.styleelement.AreaElement; 26 import org.openstreetmap.josm.gui.mappaint.styleelement.BoxTextElement; 27 import org.openstreetmap.josm.gui.mappaint.styleelement.LineElement; 28 import org.openstreetmap.josm.gui.mappaint.styleelement.LineTextElement; 29 import org.openstreetmap.josm.gui.mappaint.styleelement.NodeElement; 30 import org.openstreetmap.josm.gui.mappaint.styleelement.RepeatImageElement; 31 import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement; 32 import org.openstreetmap.josm.gui.mappaint.styleelement.TextLabel; 25 33 import org.openstreetmap.josm.gui.util.GuiHelper; 26 34 import org.openstreetmap.josm.tools.Pair; … … 97 105 if (osm instanceof Node && isDefaultNodes()) { 98 106 if (p.a.isEmpty()) { 99 if (Text Element.AUTO_LABEL_COMPOSITION_STRATEGY.compose(osm) != null) {100 p.a = NodeElem Style.DEFAULT_NODE_STYLELIST_TEXT;107 if (TextLabel.AUTO_LABEL_COMPOSITION_STRATEGY.compose(osm) != null) { 108 p.a = NodeElement.DEFAULT_NODE_STYLELIST_TEXT; 101 109 } else { 102 p.a = NodeElem Style.DEFAULT_NODE_STYLELIST;110 p.a = NodeElement.DEFAULT_NODE_STYLELIST; 103 111 } 104 112 } else { 105 113 boolean hasNonModifier = false; 106 114 boolean hasText = false; 107 for ( ElemStyles : p.a) {108 if (s instanceof BoxTextElem Style) {115 for (StyleElement s : p.a) { 116 if (s instanceof BoxTextElement) { 109 117 hasText = true; 110 118 } else { … … 115 123 } 116 124 if (!hasNonModifier) { 117 p.a = new StyleList(p.a, NodeElem Style.SIMPLE_NODE_ELEMSTYLE);125 p.a = new StyleList(p.a, NodeElement.SIMPLE_NODE_ELEMSTYLE); 118 126 if (!hasText) { 119 if (Text Element.AUTO_LABEL_COMPOSITION_STRATEGY.compose(osm) != null) {120 p.a = new StyleList(p.a, BoxTextElem Style.SIMPLE_NODE_TEXT_ELEMSTYLE);127 if (TextLabel.AUTO_LABEL_COMPOSITION_STRATEGY.compose(osm) != null) { 128 p.a = new StyleList(p.a, BoxTextElement.SIMPLE_NODE_TEXT_ELEMSTYLE); 121 129 } 122 130 } … … 125 133 } else if (osm instanceof Way && isDefaultLines()) { 126 134 boolean hasProperLineStyle = false; 127 for ( ElemStyles : p.a) {135 for (StyleElement s : p.a) { 128 136 if (s.isProperLineStyle()) { 129 137 hasProperLineStyle = true; … … 132 140 } 133 141 if (!hasProperLineStyle) { 134 AreaElem Stylearea = Utils.find(p.a, AreaElemStyle.class);135 LineElem Styleline = area == null ? LineElemStyle.UNTAGGED_WAY : LineElemStyle.createSimpleLineStyle(area.color, true);142 AreaElement area = Utils.find(p.a, AreaElement.class); 143 LineElement line = area == null ? LineElement.UNTAGGED_WAY : LineElement.createSimpleLineStyle(area.color, true); 136 144 p.a = new StyleList(p.a, line); 137 145 } … … 197 205 boolean hasIndependentLineStyle = false; 198 206 if (!isOuterWayOfSomeMP) { // do this only one time 199 List< ElemStyle> tmp = new ArrayList<>(p.a.size());200 for ( ElemStyles : p.a) {201 if (s instanceof AreaElem Style) {202 wayColor = ((AreaElem Style) s).color;207 List<StyleElement> tmp = new ArrayList<>(p.a.size()); 208 for (StyleElement s : p.a) { 209 if (s instanceof AreaElement) { 210 wayColor = ((AreaElement) s).color; 203 211 } else { 204 212 tmp.add(s); … … 217 225 mpElemStyles = getStyleCacheWithRange(r, scale, nc); 218 226 } 219 ElemStylempLine = null;220 for ( ElemStyles : mpElemStyles.a) {227 StyleElement mpLine = null; 228 for (StyleElement s : mpElemStyles.a) { 221 229 if (s.isProperLineStyle()) { 222 230 mpLine = s; … … 229 237 break; 230 238 } else if (wayColor == null && isDefaultLines()) { 231 AreaElem StylempArea = Utils.find(mpElemStyles.a, AreaElemStyle.class);239 AreaElement mpArea = Utils.find(mpElemStyles.a, AreaElement.class); 232 240 if (mpArea != null) { 233 241 wayColor = mpArea.color; … … 240 248 if (isDefaultLines()) { 241 249 boolean hasLineStyle = false; 242 for ( ElemStyles : p.a) {250 for (StyleElement s : p.a) { 243 251 if (s.isProperLineStyle()) { 244 252 hasLineStyle = true; … … 247 255 } 248 256 if (!hasLineStyle) { 249 p.a = new StyleList(p.a, LineElem Style.createSimpleLineStyle(wayColor, true));257 p.a = new StyleList(p.a, LineElement.createSimpleLineStyle(wayColor, true)); 250 258 } 251 259 } … … 265 273 p = generateStyles(osm, scale, false); 266 274 boolean hasIndependentElemStyle = false; 267 for ( ElemStyles : p.a) {268 if (s.isProperLineStyle() || s instanceof AreaElem Style) {275 for (StyleElement s : p.a) { 276 if (s.isProperLineStyle() || s instanceof AreaElement) { 269 277 hasIndependentElemStyle = true; 270 278 break; … … 277 285 mpElemStyles = get(ref, scale, nc); 278 286 } 279 for ( ElemStylempS : mpElemStyles) {280 if (mpS instanceof AreaElem Style) {281 mpColor = ((AreaElem Style) mpS).color;287 for (StyleElement mpS : mpElemStyles) { 288 if (mpS instanceof AreaElement) { 289 mpColor = ((AreaElement) mpS).color; 282 290 break; 283 291 } 284 292 } 285 p.a = new StyleList(p.a, LineElem Style.createSimpleLineStyle(mpColor, true));293 p.a = new StyleList(p.a, LineElement.createSimpleLineStyle(mpColor, true)); 286 294 } 287 295 return p; … … 292 300 Pair<StyleList, Range> p = generateStyles(osm, scale, true); 293 301 if (drawMultipolygon && ((Relation) osm).isMultipolygon()) { 294 if (!Utils.exists(p.a, AreaElem Style.class) && Main.pref.getBoolean("multipolygon.deprecated.outerstyle", true)) {302 if (!Utils.exists(p.a, AreaElement.class) && Main.pref.getBoolean("multipolygon.deprecated.outerstyle", true)) { 295 303 // look at outer ways to find area style 296 304 Multipolygon multipolygon = MultipolygonCache.getInstance().get(nc, (Relation) osm); … … 298 306 Pair<StyleList, Range> wayStyles = generateStyles(w, scale, false); 299 307 p.b = Range.cut(p.b, wayStyles.b); 300 ElemStylearea = Utils.find(wayStyles.a, AreaElemStyle.class);308 StyleElement area = Utils.find(wayStyles.a, AreaElement.class); 301 309 if (area != null) { 302 310 p.a = new StyleList(p.a, area); … … 326 334 public Pair<StyleList, Range> generateStyles(OsmPrimitive osm, double scale, boolean pretendWayIsClosed) { 327 335 328 List< ElemStyle> sl = new ArrayList<>();336 List<StyleElement> sl = new ArrayList<>(); 329 337 MultiCascade mc = new MultiCascade(); 330 338 Environment env = new Environment(osm, mc, null, null); … … 342 350 env.layer = e.getKey(); 343 351 if (osm instanceof Way) { 344 addIfNotNull(sl, AreaElem Style.create(env));345 addIfNotNull(sl, RepeatImageElem Style.create(env));346 addIfNotNull(sl, LineElem Style.createLine(env));347 addIfNotNull(sl, LineElem Style.createLeftCasing(env));348 addIfNotNull(sl, LineElem Style.createRightCasing(env));349 addIfNotNull(sl, LineElem Style.createCasing(env));350 addIfNotNull(sl, LineTextElem Style.create(env));352 addIfNotNull(sl, AreaElement.create(env)); 353 addIfNotNull(sl, RepeatImageElement.create(env)); 354 addIfNotNull(sl, LineElement.createLine(env)); 355 addIfNotNull(sl, LineElement.createLeftCasing(env)); 356 addIfNotNull(sl, LineElement.createRightCasing(env)); 357 addIfNotNull(sl, LineElement.createCasing(env)); 358 addIfNotNull(sl, LineTextElement.create(env)); 351 359 } else if (osm instanceof Node) { 352 NodeElem StylenodeStyle = NodeElemStyle.create(env);360 NodeElement nodeStyle = NodeElement.create(env); 353 361 if (nodeStyle != null) { 354 362 sl.add(nodeStyle); 355 addIfNotNull(sl, BoxTextElem Style.create(env, nodeStyle.getBoxProvider()));363 addIfNotNull(sl, BoxTextElement.create(env, nodeStyle.getBoxProvider())); 356 364 } else { 357 addIfNotNull(sl, BoxTextElem Style.create(env, NodeElemStyle.SIMPLE_NODE_ELEMSTYLE_BOXPROVIDER));365 addIfNotNull(sl, BoxTextElement.create(env, NodeElement.SIMPLE_NODE_ELEMSTYLE_BOXPROVIDER)); 358 366 } 359 367 } else if (osm instanceof Relation) { 360 368 if (((Relation) osm).isMultipolygon()) { 361 addIfNotNull(sl, AreaElem Style.create(env));362 addIfNotNull(sl, RepeatImageElem Style.create(env));363 addIfNotNull(sl, LineElem Style.createLine(env));364 addIfNotNull(sl, LineElem Style.createCasing(env));365 addIfNotNull(sl, LineTextElem Style.create(env));369 addIfNotNull(sl, AreaElement.create(env)); 370 addIfNotNull(sl, RepeatImageElement.create(env)); 371 addIfNotNull(sl, LineElement.createLine(env)); 372 addIfNotNull(sl, LineElement.createCasing(env)); 373 addIfNotNull(sl, LineTextElement.create(env)); 366 374 } else if ("restriction".equals(osm.get("type"))) { 367 addIfNotNull(sl, NodeElem Style.create(env));375 addIfNotNull(sl, NodeElement.create(env)); 368 376 } 369 377 } … … 448 456 449 457 /** 450 * Returns the first AreaElem Stylefor a given primitive.458 * Returns the first AreaElement for a given primitive. 451 459 * @param p the OSM primitive 452 460 * @param pretendWayIsClosed For styles that require the way to be closed, 453 461 * we pretend it is. This is useful for generating area styles from the (segmented) 454 462 * outer ways of a multipolygon. 455 * @return first AreaElem Stylefound or {@code null}.456 */ 457 public static AreaElem StylegetAreaElemStyle(OsmPrimitive p, boolean pretendWayIsClosed) {463 * @return first AreaElement found or {@code null}. 464 */ 465 public static AreaElement getAreaElemStyle(OsmPrimitive p, boolean pretendWayIsClosed) { 458 466 MapCSSStyleSource.STYLE_SOURCE_LOCK.readLock().lock(); 459 467 try { 460 468 if (MapPaintStyles.getStyles() == null) 461 469 return null; 462 for ( ElemStyles : MapPaintStyles.getStyles().generateStyles(p, 1.0, pretendWayIsClosed).a) {463 if (s instanceof AreaElem Style)464 return (AreaElem Style) s;470 for (StyleElement s : MapPaintStyles.getStyles().generateStyles(p, 1.0, pretendWayIsClosed).a) { 471 if (s instanceof AreaElement) 472 return (AreaElement) s; 465 473 } 466 474 return null; … … 471 479 472 480 /** 473 * Determines whether primitive has an AreaElem Style.481 * Determines whether primitive has an AreaElement. 474 482 * @param p the OSM primitive 475 483 * @param pretendWayIsClosed For styles that require the way to be closed, 476 484 * we pretend it is. This is useful for generating area styles from the (segmented) 477 485 * outer ways of a multipolygon. 478 * @return {@code true} if primitive has an AreaElem Style486 * @return {@code true} if primitive has an AreaElement 479 487 */ 480 488 public static boolean hasAreaElemStyle(OsmPrimitive p, boolean pretendWayIsClosed) { … … 483 491 484 492 /** 485 * Determines whether primitive has <b>only</b> an AreaElem Style.493 * Determines whether primitive has <b>only</b> an AreaElement. 486 494 * @param p the OSM primitive 487 * @return {@code true} if primitive has only an AreaElem Style495 * @return {@code true} if primitive has only an AreaElement 488 496 * @since 7486 489 497 */ … … 497 505 return false; 498 506 } 499 for ( ElemStyles : styles) {500 if (!(s instanceof AreaElem Style)) {507 for (StyleElement s : styles) { 508 if (!(s instanceof AreaElement)) { 501 509 return false; 502 510 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
r9239 r9278 29 29 import org.openstreetmap.josm.gui.mappaint.StyleCache.StyleList; 30 30 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource; 31 import org.openstreetmap.josm.gui.mappaint.styleelement.MapImage; 32 import org.openstreetmap.josm.gui.mappaint.styleelement.NodeElement; 33 import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement; 31 34 import org.openstreetmap.josm.gui.mappaint.xml.XmlStyleSource; 32 35 import org.openstreetmap.josm.gui.preferences.SourceEntry; … … 192 195 } 193 196 if (styleList != null) { 194 for ( ElemStylestyle : styleList) {195 if (style instanceof NodeElem Style) {196 MapImage mapImage = ((NodeElem Style) style).mapImage;197 for (StyleElement style : styleList) { 198 if (style instanceof NodeElement) { 199 MapImage mapImage = ((NodeElement) style).mapImage; 197 200 if (mapImage != null) { 198 201 if (includeDeprecatedIcon || mapImage.name == null || !"misc/deprecated.png".equals(mapImage.name)) { -
trunk/src/org/openstreetmap/josm/gui/mappaint/StyleCache.java
r9239 r9278 10 10 11 11 import org.openstreetmap.josm.data.osm.Storage; 12 import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement; 12 13 import org.openstreetmap.josm.tools.Pair; 13 14 … … 16 17 * Splits the range of possible scale values (0 < scale < +Infinity) into multiple 17 18 * subranges, for each scale range it keeps a list of styles. 18 * Immutable class, equals & hashCode is required (the same for StyleList, ElemStyle19 *and its subclasses).19 * Immutable class, equals & hashCode is required (the same for StyleList, StyleElement 20 and its subclasses). 20 21 */ 21 22 public final class StyleCache { … … 46 47 * List of Styles, immutable 47 48 */ 48 public static class StyleList implements Iterable< ElemStyle> {49 private final List< ElemStyle> lst;49 public static class StyleList implements Iterable<StyleElement> { 50 private final List<StyleElement> lst; 50 51 51 52 /** … … 56 57 } 57 58 58 public StyleList( ElemStyle... init) {59 public StyleList(StyleElement... init) { 59 60 lst = new ArrayList<>(Arrays.asList(init)); 60 61 } 61 62 62 public StyleList(Collection< ElemStyle> sl) {63 public StyleList(Collection<StyleElement> sl) { 63 64 lst = new ArrayList<>(sl); 64 65 } 65 66 66 public StyleList(StyleList sl, ElemStyles) {67 public StyleList(StyleList sl, StyleElement s) { 67 68 lst = new ArrayList<>(sl.lst); 68 69 lst.add(s); … … 70 71 71 72 @Override 72 public Iterator< ElemStyle> iterator() {73 public Iterator<StyleElement> iterator() { 73 74 return lst.iterator(); 74 75 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java
r8882 r9278 38 38 import org.openstreetmap.josm.gui.mappaint.Cascade; 39 39 import org.openstreetmap.josm.gui.mappaint.Environment; 40 import org.openstreetmap.josm.gui.mappaint.LineElemStyle;41 40 import org.openstreetmap.josm.gui.mappaint.MultiCascade; 42 41 import org.openstreetmap.josm.gui.mappaint.Range; … … 56 55 import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException; 57 56 import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.TokenMgrError; 57 import org.openstreetmap.josm.gui.mappaint.styleelement.LineElement; 58 58 import org.openstreetmap.josm.gui.preferences.SourceEntry; 59 59 import org.openstreetmap.josm.io.CachedFile; … … 113 113 } 114 114 } 115 for (LineElem Style.LineType lt : LineElemStyle.LineType.values()) {115 for (LineElement.LineType lt : LineElement.LineType.values()) { 116 116 SUPPORTED_KEYS.add(lt.prefix + StyleKeys.COLOR); 117 117 SUPPORTED_KEYS.add(lt.prefix + StyleKeys.DASHES); -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/AreaElement.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; … … 12 12 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors; 13 13 import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer; 14 import org.openstreetmap.josm.gui.mappaint.Cascade; 15 import org.openstreetmap.josm.gui.mappaint.Environment; 16 import org.openstreetmap.josm.gui.mappaint.Keyword; 14 17 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference; 15 18 import org.openstreetmap.josm.tools.CheckParameterUtil; 16 19 import org.openstreetmap.josm.tools.Utils; 17 20 18 public class AreaElem StyleextendsElemStyle{21 public class AreaElement extends StyleElement { 19 22 20 23 /** … … 24 27 public Color color; 25 28 public MapImage fillImage; 26 public Text Elementtext;29 public TextLabel text; 27 30 public Float extent; 28 31 public Float extentThreshold; 29 32 30 protected AreaElem Style(Cascade c, Color color, MapImage fillImage, Float extent, Float extentThreshold, TextElementtext) {33 protected AreaElement(Cascade c, Color color, MapImage fillImage, Float extent, Float extentThreshold, TextLabel text) { 31 34 super(c, 1f); 32 35 CheckParameterUtil.ensureParameterNotNull(color); … … 38 41 } 39 42 40 public static AreaElem Stylecreate(final Environment env) {43 public static AreaElement create(final Environment env) { 41 44 final Cascade c = env.mc.getCascade(env.layer); 42 45 MapImage fillImage = null; … … 76 79 } 77 80 78 Text Elementtext = null;81 TextLabel text = null; 79 82 Keyword textPos = c.get(TEXT_POSITION, null, Keyword.class); 80 83 if (textPos == null || "center".equals(textPos.val)) { 81 text = Text Element.create(env, PaintColors.AREA_TEXT.get(), true);84 text = TextLabel.create(env, PaintColors.AREA_TEXT.get(), true); 82 85 } 83 86 … … 86 89 87 90 if (color != null) 88 return new AreaElem Style(c, color, fillImage, extent, extentThreshold, text);91 return new AreaElement(c, color, fillImage, extent, extentThreshold, text); 89 92 else 90 93 return null; … … 118 121 if (!super.equals(obj)) 119 122 return false; 120 AreaElem Styleother = (AreaElemStyle) obj;123 AreaElement other = (AreaElement) obj; 121 124 // we should get the same image object due to caching 122 125 if (!Objects.equals(fillImage, other.fillImage)) -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/BoxTextElement.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; … … 10 10 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors; 11 11 import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer; 12 import org.openstreetmap.josm.gui.mappaint.Cascade; 13 import org.openstreetmap.josm.gui.mappaint.Environment; 14 import org.openstreetmap.josm.gui.mappaint.Keyword; 15 import org.openstreetmap.josm.gui.mappaint.MultiCascade; 12 16 import org.openstreetmap.josm.tools.CheckParameterUtil; 13 17 … … 15 19 * Text style attached to a style with a bounding box, like an icon or a symbol. 16 20 */ 17 public class BoxTextElem StyleextendsElemStyle{21 public class BoxTextElement extends StyleElement { 18 22 19 23 public enum HorizontalTextAlignment { LEFT, CENTER, RIGHT } … … 85 89 public static final Rectangle ZERO_BOX = new Rectangle(0, 0, 0, 0); 86 90 87 public Text Elementtext;91 public TextLabel text; 88 92 // Either boxProvider or box is not null. If boxProvider is different from 89 93 // null, this means, that the box can still change in future, otherwise … … 94 98 public VerticalTextAlignment vAlign; 95 99 96 public BoxTextElem Style(Cascade c, TextElementtext, BoxProvider boxProvider, Rectangle box,100 public BoxTextElement(Cascade c, TextLabel text, BoxProvider boxProvider, Rectangle box, 97 101 HorizontalTextAlignment hAlign, VerticalTextAlignment vAlign) { 98 102 super(c, 5f); … … 107 111 } 108 112 109 public static BoxTextElem Stylecreate(Environment env, BoxProvider boxProvider) {113 public static BoxTextElement create(Environment env, BoxProvider boxProvider) { 110 114 return create(env, boxProvider, null); 111 115 } 112 116 113 public static BoxTextElem Stylecreate(Environment env, Rectangle box) {117 public static BoxTextElement create(Environment env, Rectangle box) { 114 118 return create(env, null, box); 115 119 } 116 120 117 public static BoxTextElem Stylecreate(Environment env, BoxProvider boxProvider, Rectangle box) {121 public static BoxTextElement create(Environment env, BoxProvider boxProvider, Rectangle box) { 118 122 initDefaultParameters(); 119 123 Cascade c = env.mc.getCascade(env.layer); 120 124 121 Text Elementtext = TextElement.create(env, DEFAULT_TEXT_COLOR, false);125 TextLabel text = TextLabel.create(env, DEFAULT_TEXT_COLOR, false); 122 126 if (text == null) return null; 123 127 // Skip any primitives that don't have text to draw. (Styles are recreated for any tag change.) 124 128 // The concrete text to render is not cached in this object, but computed for each 125 // repaint. This way, one BoxTextElem Styleobject can be used by multiple primitives (to save memory).129 // repaint. This way, one BoxTextElement object can be used by multiple primitives (to save memory). 126 130 if (text.labelCompositionStrategy.compose(env.osm) == null) return null; 127 131 … … 154 158 } 155 159 156 return new BoxTextElem Style(c, text, boxProvider, box, hAlign, vAlign);160 return new BoxTextElement(c, text, boxProvider, box, hAlign, vAlign); 157 161 } 158 162 … … 169 173 } 170 174 171 public static final BoxTextElem StyleSIMPLE_NODE_TEXT_ELEMSTYLE;175 public static final BoxTextElement SIMPLE_NODE_TEXT_ELEMSTYLE; 172 176 static { 173 177 MultiCascade mc = new MultiCascade(); … … 176 180 Node n = new Node(); 177 181 n.put("name", "dummy"); 178 SIMPLE_NODE_TEXT_ELEMSTYLE = create(new Environment(n, mc, "default", null), NodeElem Style.SIMPLE_NODE_ELEMSTYLE.getBoxProvider());182 SIMPLE_NODE_TEXT_ELEMSTYLE = create(new Environment(n, mc, "default", null), NodeElement.SIMPLE_NODE_ELEMSTYLE.getBoxProvider()); 179 183 if (SIMPLE_NODE_TEXT_ELEMSTYLE == null) throw new AssertionError(); 180 184 } … … 207 211 if (obj == null || getClass() != obj.getClass()) 208 212 return false; 209 final BoxTextElem Styleother = (BoxTextElemStyle) obj;213 final BoxTextElement other = (BoxTextElement) obj; 210 214 if (!text.equals(other.text)) return false; 211 215 if (boxProvider != null) { -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LabelCompositionStrategy.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.util.ArrayList; -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LineElement.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.BasicStroke; … … 14 14 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors; 15 15 import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer; 16 import org.openstreetmap.josm.gui.mappaint.Cascade; 17 import org.openstreetmap.josm.gui.mappaint.Environment; 18 import org.openstreetmap.josm.gui.mappaint.Keyword; 19 import org.openstreetmap.josm.gui.mappaint.MultiCascade; 16 20 import org.openstreetmap.josm.gui.mappaint.mapcss.Instruction.RelativeFloat; 17 21 import org.openstreetmap.josm.tools.Utils; 18 22 19 public class LineElem StyleextendsElemStyle{20 21 public static LineElem StylecreateSimpleLineStyle(Color color, boolean isAreaEdge) {23 public class LineElement extends StyleElement { 24 25 public static LineElement createSimpleLineStyle(Color color, boolean isAreaEdge) { 22 26 MultiCascade mc = new MultiCascade(); 23 27 Cascade c = mc.getOrCreateCascade("default"); … … 31 35 } 32 36 33 public static final LineElem StyleUNTAGGED_WAY = createSimpleLineStyle(null, false);37 public static final LineElement UNTAGGED_WAY = createSimpleLineStyle(null, false); 34 38 35 39 private BasicStroke line; … … 56 60 } 57 61 58 protected LineElem Style(Cascade c, float default_major_z_index, BasicStroke line, Color color, BasicStroke dashesLine,62 protected LineElement(Cascade c, float default_major_z_index, BasicStroke line, Color color, BasicStroke dashesLine, 59 63 Color dashesBackground, float offset, float realWidth) { 60 64 super(c, default_major_z_index); … … 67 71 } 68 72 69 public static LineElem StylecreateLine(Environment env) {73 public static LineElement createLine(Environment env) { 70 74 return createImpl(env, LineType.NORMAL); 71 75 } 72 76 73 public static LineElem StylecreateLeftCasing(Environment env) {74 LineElem StyleleftCasing = createImpl(env, LineType.LEFT_CASING);77 public static LineElement createLeftCasing(Environment env) { 78 LineElement leftCasing = createImpl(env, LineType.LEFT_CASING); 75 79 if (leftCasing != null) { 76 80 leftCasing.isModifier = true; … … 79 83 } 80 84 81 public static LineElem StylecreateRightCasing(Environment env) {82 LineElem StylerightCasing = createImpl(env, LineType.RIGHT_CASING);85 public static LineElement createRightCasing(Environment env) { 86 LineElement rightCasing = createImpl(env, LineType.RIGHT_CASING); 83 87 if (rightCasing != null) { 84 88 rightCasing.isModifier = true; … … 87 91 } 88 92 89 public static LineElem StylecreateCasing(Environment env) {90 LineElem Stylecasing = createImpl(env, LineType.CASING);93 public static LineElement createCasing(Environment env) { 94 LineElement casing = createImpl(env, LineType.CASING); 91 95 if (casing != null) { 92 96 casing.isModifier = true; … … 95 99 } 96 100 97 private static LineElem StylecreateImpl(Environment env, LineType type) {101 private static LineElement createImpl(Environment env, LineType type) { 98 102 Cascade c = env.mc.getCascade(env.layer); 99 103 Cascade c_def = env.mc.getCascade("default"); … … 260 264 } 261 265 262 return new LineElem Style(c, type.defaultMajorZIndex, line, color, dashesLine, dashesBackground, offset, realWidth);266 return new LineElement(c, type.defaultMajorZIndex, line, color, dashesLine, dashesBackground, offset, realWidth); 263 267 } 264 268 … … 332 336 if (!super.equals(obj)) 333 337 return false; 334 final LineElem Styleother = (LineElemStyle) obj;338 final LineElement other = (LineElement) obj; 335 339 return Objects.equals(line, other.line) && 336 340 Objects.equals(color, other.color) && -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LineTextElement.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.util.Objects; … … 9 9 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors; 10 10 import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer; 11 import org.openstreetmap.josm.gui.mappaint.Cascade; 12 import org.openstreetmap.josm.gui.mappaint.Environment; 13 import org.openstreetmap.josm.gui.mappaint.Keyword; 11 14 12 public class LineTextElem StyleextendsElemStyle{15 public class LineTextElement extends StyleElement { 13 16 14 private final Text Elementtext;17 private final TextLabel text; 15 18 16 protected LineTextElem Style(Cascade c, TextElementtext) {19 protected LineTextElement(Cascade c, TextLabel text) { 17 20 super(c, 4.9f); 18 21 this.text = text; 19 22 } 20 23 21 public static LineTextElem Stylecreate(final Environment env) {24 public static LineTextElement create(final Environment env) { 22 25 final Cascade c = env.mc.getCascade(env.layer); 23 26 … … 26 29 return null; 27 30 28 Text Elementtext = TextElement.create(env, PaintColors.TEXT.get(), false);31 TextLabel text = TextLabel.create(env, PaintColors.TEXT.get(), false); 29 32 if (text == null) 30 33 return null; 31 return new LineTextElem Style(c, text);34 return new LineTextElement(c, text); 32 35 } 33 36 … … 45 48 if (!super.equals(obj)) 46 49 return false; 47 final LineTextElem Styleother = (LineTextElemStyle) obj;50 final LineTextElement other = (LineTextElement) obj; 48 51 return Objects.equals(text, other.text); 49 52 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/MapImage.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.Graphics; … … 11 11 12 12 import org.openstreetmap.josm.Main; 13 import org.openstreetmap.josm.gui.mappaint.BoxTextElemStyle.BoxProvider; 14 import org.openstreetmap.josm.gui.mappaint.BoxTextElemStyle.BoxProviderResult; 13 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; 14 import org.openstreetmap.josm.gui.mappaint.StyleSource; 15 import org.openstreetmap.josm.gui.mappaint.styleelement.BoxTextElement.BoxProvider; 16 import org.openstreetmap.josm.gui.mappaint.styleelement.BoxTextElement.BoxProviderResult; 15 17 import org.openstreetmap.josm.gui.util.GuiHelper; 16 18 import org.openstreetmap.josm.tools.ImageProvider; -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.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.BasicStroke; … … 14 14 import org.openstreetmap.josm.data.osm.visitor.paint.MapPaintSettings; 15 15 import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer; 16 import org.openstreetmap.josm.gui.mappaint.BoxTextElemStyle.BoxProvider; 17 import org.openstreetmap.josm.gui.mappaint.BoxTextElemStyle.SimpleBoxProvider; 16 import org.openstreetmap.josm.gui.mappaint.Cascade; 17 import org.openstreetmap.josm.gui.mappaint.Environment; 18 import org.openstreetmap.josm.gui.mappaint.Keyword; 18 19 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference; 20 import org.openstreetmap.josm.gui.mappaint.MultiCascade; 19 21 import org.openstreetmap.josm.gui.mappaint.StyleCache.StyleList; 22 import org.openstreetmap.josm.gui.mappaint.styleelement.BoxTextElement.BoxProvider; 23 import org.openstreetmap.josm.gui.mappaint.styleelement.BoxTextElement.SimpleBoxProvider; 20 24 import org.openstreetmap.josm.gui.util.RotationAngle; 21 25 import org.openstreetmap.josm.tools.Utils; … … 24 28 * applies for Nodes and turn restriction relations 25 29 */ 26 public class NodeElem StyleextendsElemStyle implements StyleKeys{30 public class NodeElement extends StyleElement { 27 31 public final MapImage mapImage; 28 32 public final RotationAngle mapImageAngle; … … 81 85 } 82 86 83 public static final NodeElem StyleSIMPLE_NODE_ELEMSTYLE;87 public static final NodeElement SIMPLE_NODE_ELEMSTYLE; 84 88 public static final BoxProvider SIMPLE_NODE_ELEMSTYLE_BOXPROVIDER; 85 89 static { … … 91 95 } 92 96 93 public static final StyleList DEFAULT_NODE_STYLELIST = new StyleList(NodeElem Style.SIMPLE_NODE_ELEMSTYLE);94 public static final StyleList DEFAULT_NODE_STYLELIST_TEXT = new StyleList(NodeElem Style.SIMPLE_NODE_ELEMSTYLE,95 BoxTextElem Style.SIMPLE_NODE_TEXT_ELEMSTYLE);96 97 protected NodeElem Style(Cascade c, MapImage mapImage, Symbol symbol, float default_major_z_index, RotationAngle rotationAngle) {97 public static final StyleList DEFAULT_NODE_STYLELIST = new StyleList(NodeElement.SIMPLE_NODE_ELEMSTYLE); 98 public static final StyleList DEFAULT_NODE_STYLELIST_TEXT = new StyleList(NodeElement.SIMPLE_NODE_ELEMSTYLE, 99 BoxTextElement.SIMPLE_NODE_TEXT_ELEMSTYLE); 100 101 protected NodeElement(Cascade c, MapImage mapImage, Symbol symbol, float default_major_z_index, RotationAngle rotationAngle) { 98 102 super(c, default_major_z_index); 99 103 this.mapImage = mapImage; … … 102 106 } 103 107 104 public static NodeElem Stylecreate(Environment env) {108 public static NodeElement create(Environment env) { 105 109 return create(env, 4f, false); 106 110 } 107 111 108 private static NodeElem Stylecreate(Environment env, float default_major_z_index, boolean allowDefault) {112 private static NodeElement create(Environment env, float default_major_z_index, boolean allowDefault) { 109 113 Cascade c = env.mc.getCascade(env.layer); 110 114 … … 140 144 if (!allowDefault && symbol == null && mapImage == null) return null; 141 145 142 return new NodeElem Style(c, mapImage, symbol, default_major_z_index, rotationAngle);146 return new NodeElement(c, mapImage, symbol, default_major_z_index, rotationAngle); 143 147 } 144 148 … … 374 378 return false; 375 379 376 final NodeElem Styleother = (NodeElemStyle) obj;380 final NodeElement other = (NodeElement) obj; 377 381 // we should get the same image object due to caching 378 382 if (!Objects.equals(mapImage, other.mapImage)) -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/RepeatImageElement.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 org.openstreetmap.josm.data.osm.OsmPrimitive; … … 6 6 import org.openstreetmap.josm.data.osm.visitor.paint.MapPaintSettings; 7 7 import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer; 8 import org.openstreetmap.josm.gui.mappaint.Cascade; 9 import org.openstreetmap.josm.gui.mappaint.Environment; 10 import org.openstreetmap.josm.gui.mappaint.Keyword; 8 11 import org.openstreetmap.josm.tools.CheckParameterUtil; 9 12 10 public class RepeatImageElem StyleextendsElemStyle implements StyleKeys{13 public class RepeatImageElement extends StyleElement { 11 14 12 15 public enum LineImageAlignment { TOP, CENTER, BOTTOM } … … 18 21 public LineImageAlignment align; 19 22 20 public RepeatImageElem Style(Cascade c, MapImage pattern, float offset, float spacing, float phase, LineImageAlignment align) {23 public RepeatImageElement(Cascade c, MapImage pattern, float offset, float spacing, float phase, LineImageAlignment align) { 21 24 super(c, 2.9f); 22 25 CheckParameterUtil.ensureParameterNotNull(pattern); … … 29 32 } 30 33 31 public static RepeatImageElem Stylecreate(Environment env) {32 MapImage pattern = NodeElem Style.createIcon(env, REPEAT_IMAGE_KEYS);34 public static RepeatImageElement create(Environment env) { 35 MapImage pattern = NodeElement.createIcon(env, REPEAT_IMAGE_KEYS); 33 36 if (pattern == null) 34 37 return null; … … 46 49 } 47 50 48 return new RepeatImageElem Style(c, pattern, offset, spacing, phase, align);51 return new RepeatImageElement(c, pattern, offset, spacing, phase, align); 49 52 } 50 53 … … 67 70 if (!super.equals(obj)) 68 71 return false; 69 final RepeatImageElem Styleother = (RepeatImageElemStyle) obj;72 final RepeatImageElement other = (RepeatImageElement) obj; 70 73 if (!this.pattern.equals(other.pattern)) return false; 71 74 if (this.offset != other.offset) return false; -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/StyleElement.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.Font; … … 10 10 import org.openstreetmap.josm.data.osm.visitor.paint.MapPaintSettings; 11 11 import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer; 12 import org.openstreetmap.josm.gui.mappaint.Cascade; 13 import org.openstreetmap.josm.gui.mappaint.Keyword; 14 import org.openstreetmap.josm.gui.mappaint.StyleKeys; 12 15 import org.openstreetmap.josm.gui.mappaint.mapcss.Instruction.RelativeFloat; 13 16 14 public abstract class ElemStyleimplements StyleKeys {17 public abstract class StyleElement implements StyleKeys { 15 18 16 19 protected static final int ICON_IMAGE_IDX = 0; … … 30 33 // primitive; true, if it is a highlight or modifier 31 34 32 public ElemStyle(float major_z_index, float z_index, float object_z_index, boolean isModifier) {35 public StyleElement(float major_z_index, float z_index, float object_z_index, boolean isModifier) { 33 36 this.majorZIndex = major_z_index; 34 37 this.zIndex = z_index; … … 37 40 } 38 41 39 protected ElemStyle(Cascade c, float default_major_z_index) {42 protected StyleElement(Cascade c, float default_major_z_index) { 40 43 majorZIndex = c.get(MAJOR_Z_INDEX, default_major_z_index, Float.class); 41 44 zIndex = c.get(Z_INDEX, 0f, Float.class); … … 208 211 @Override 209 212 public boolean equals(Object o) { 210 if (!(o instanceof ElemStyle))213 if (!(o instanceof StyleElement)) 211 214 return false; 212 ElemStyle s = (ElemStyle) o;215 StyleElement s = (StyleElement) o; 213 216 return isModifier == s.isModifier && 214 217 majorZIndex == s.majorZIndex && -
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 Elementother = (TextElement) obj;218 final TextLabel other = (TextLabel) obj; 215 219 return Objects.equals(labelCompositionStrategy, other.labelCompositionStrategy) && 216 220 Objects.equals(font, other.font) && -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r9265 r9278 59 59 import org.openstreetmap.josm.data.osm.OsmPrimitive; 60 60 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 61 import org.openstreetmap.josm.gui.mappaint.ElemStyle;62 import org.openstreetmap.josm.gui.mappaint.MapImage;63 61 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; 64 import org.openstreetmap.josm.gui.mappaint.NodeElemStyle;65 62 import org.openstreetmap.josm.gui.mappaint.Range; 66 63 import org.openstreetmap.josm.gui.mappaint.StyleCache.StyleList; 64 import org.openstreetmap.josm.gui.mappaint.styleelement.MapImage; 65 import org.openstreetmap.josm.gui.mappaint.styleelement.StyleElement; 67 66 import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset; 68 67 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets; … … 82 81 import com.kitfox.svg.SVGDiagram; 83 82 import com.kitfox.svg.SVGUniverse; 83 import org.openstreetmap.josm.gui.mappaint.styleelement.NodeElement; 84 84 85 85 /** … … 1300 1300 if (primitive instanceof org.openstreetmap.josm.data.osm.Node) { 1301 1301 Pair<StyleList, Range> nodeStyles = MapPaintStyles.getStyles().generateStyles(primitive, 100, false); 1302 for ( ElemStylestyle : nodeStyles.a) {1303 if (style instanceof NodeElem Style) {1304 NodeElem StylenodeStyle = (NodeElemStyle) style;1302 for (StyleElement style : nodeStyles.a) { 1303 if (style instanceof NodeElement) { 1304 NodeElement nodeStyle = (NodeElement) style; 1305 1305 MapImage icon = nodeStyle.mapImage; 1306 1306 if (icon != null) {
Note:
See TracChangeset
for help on using the changeset viewer.