Changeset 13810 in josm for trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
- Timestamp:
- 2018-05-21T20:42:27+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
r13636 r13810 12 12 import java.util.Optional; 13 13 14 import org.openstreetmap.josm.data.osm.IPrimitive; 14 15 import org.openstreetmap.josm.data.osm.Node; 15 import org.openstreetmap.josm.data.osm.OsmPrimitive;16 16 import org.openstreetmap.josm.data.osm.Relation; 17 17 import org.openstreetmap.josm.data.osm.Way; … … 45 45 * There are several steps to derive the list of elements for display: 46 46 * <ol> 47 * <li>{@link #generateStyles( OsmPrimitive, double, boolean)} applies the47 * <li>{@link #generateStyles(IPrimitive, double, boolean)} applies the 48 48 * {@link StyleSource}s one after another to get a key-value map of MapCSS 49 49 * properties. Then a preliminary set of StyleElements is derived from the 50 50 * properties map.</li> 51 * <li>{@link #getImpl( OsmPrimitive, double, NavigatableComponent)} handles the51 * <li>{@link #getImpl(IPrimitive, double, NavigatableComponent)} handles the 52 52 * different forms of multipolygon tagging.</li> 53 * <li>{@link #getStyleCacheWithRange( OsmPrimitive, double, NavigatableComponent)}53 * <li>{@link #getStyleCacheWithRange(IPrimitive, double, NavigatableComponent)} 54 54 * adds a default StyleElement for primitives that would be invisible otherwise. 55 55 * (For example untagged nodes and ways.)</li> … … 131 131 * @param nc display component 132 132 * @return list of styles 133 */ 134 public StyleElementList get(OsmPrimitive osm, double scale, NavigatableComponent nc) { 133 * @since 13810 (signature) 134 */ 135 public StyleElementList get(IPrimitive osm, double scale, NavigatableComponent nc) { 135 136 return getStyleCacheWithRange(osm, scale, nc).a; 136 137 } … … 145 146 * @param nc navigatable component 146 147 * @return pair containing style list and range 147 */ 148 public Pair<StyleElementList, Range> getStyleCacheWithRange(OsmPrimitive osm, double scale, NavigatableComponent nc) { 148 * @since 13810 (signature) 149 */ 150 public Pair<StyleElementList, Range> getStyleCacheWithRange(IPrimitive osm, double scale, NavigatableComponent nc) { 149 151 if (!osm.isCachedStyleUpToDate() || scale <= 0) { 150 152 osm.setCachedStyle(StyleCache.EMPTY_STYLECACHE); … … 232 234 * @return pair containing style list and range 233 235 */ 234 private Pair<StyleElementList, Range> getImpl( OsmPrimitive osm, double scale, NavigatableComponent nc) {236 private Pair<StyleElementList, Range> getImpl(IPrimitive osm, double scale, NavigatableComponent nc) { 235 237 if (osm instanceof Node) 236 238 return generateStyles(osm, scale, false); … … 242 244 243 245 // FIXME: Maybe in the future outer way styles apply to outers ignoring the multipolygon? 244 for ( OsmPrimitive referrer : osm.getReferrers()) {246 for (IPrimitive referrer : osm.getReferrers()) { 245 247 Relation r = (Relation) referrer; 246 248 if (!drawMultipolygon || !r.isMultipolygon() || !r.isUsable()) { … … 310 312 if (!isDefaultLines()) return p; 311 313 312 for ( OsmPrimitive referrer : osm.getReferrers()) {314 for (IPrimitive referrer : osm.getReferrers()) { 313 315 Relation ref = (Relation) referrer; 314 316 if (!drawMultipolygon || !ref.isMultipolygon() || !ref.isUsable()) { … … 362 364 * outer ways of a multipolygon. 363 365 * @return the generated styles and the valid range as a pair 364 */ 365 public Pair<StyleElementList, Range> generateStyles(OsmPrimitive osm, double scale, boolean pretendWayIsClosed) { 366 * @since 13810 (signature) 367 */ 368 public Pair<StyleElementList, Range> generateStyles(IPrimitive osm, double scale, boolean pretendWayIsClosed) { 366 369 367 370 List<StyleElement> sl = new ArrayList<>(); … … 522 525 * outer ways of a multipolygon. 523 526 * @return first AreaElement found or {@code null}. 524 */ 525 public static AreaElement getAreaElemStyle(OsmPrimitive p, boolean pretendWayIsClosed) { 527 * @since 13810 (signature) 528 */ 529 public static AreaElement getAreaElemStyle(IPrimitive p, boolean pretendWayIsClosed) { 526 530 MapCSSStyleSource.STYLE_SOURCE_LOCK.readLock().lock(); 527 531 try { … … 545 549 * outer ways of a multipolygon. 546 550 * @return {@code true} if primitive has an AreaElement 547 */ 548 public static boolean hasAreaElemStyle(OsmPrimitive p, boolean pretendWayIsClosed) { 551 * @since 13810 (signature) 552 */ 553 public static boolean hasAreaElemStyle(IPrimitive p, boolean pretendWayIsClosed) { 549 554 return getAreaElemStyle(p, pretendWayIsClosed) != null; 550 555 } … … 558 563 * @return {@code true} if primitive has area elements, but no line elements 559 564 * @since 12700 560 */ 561 public static boolean hasOnlyAreaElements(OsmPrimitive p) { 565 * @since 13810 (signature) 566 */ 567 public static boolean hasOnlyAreaElements(IPrimitive p) { 562 568 MapCSSStyleSource.STYLE_SOURCE_LOCK.readLock().lock(); 563 569 try {
Note:
See TracChangeset
for help on using the changeset viewer.