Changeset 12700 in josm for trunk/src/org/openstreetmap/josm/gui
- Timestamp:
- 2017-08-30T23:25:16+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java
r12026 r12700 515 515 516 516 /** 517 * Determines whether primitive has <b>only</b> an AreaElement. 517 * Determines whether primitive has area-type {@link StyleElement}s, but 518 * no line-type StyleElements. 519 * 520 * {@link TextElement} is ignored, as it can be both line and area-type. 518 521 * @param p the OSM primitive 519 * @return {@code true} if primitive has only an AreaElement520 * @since 7486521 */ 522 public static boolean hasOnlyArea OrTextStyleElements(OsmPrimitive p) {522 * @return {@code true} if primitive has area elements, but no line elements 523 * @since 12700 524 */ 525 public static boolean hasOnlyAreaElements(OsmPrimitive p) { 523 526 MapCSSStyleSource.STYLE_SOURCE_LOCK.readLock().lock(); 524 527 try { … … 526 529 return false; 527 530 StyleElementList styles = MapPaintStyles.getStyles().generateStyles(p, 1.0, false).a; 528 if (styles.isEmpty()) { 529 return false; 530 } 531 boolean hasAreaElement = false; 531 532 for (StyleElement s : styles) { 532 if (!(s instanceof AreaElement || s instanceof TextElement)) { 533 if (s instanceof TextElement) { 534 continue; 535 } 536 if (s instanceof AreaElement) { 537 hasAreaElement = true; 538 } else { 533 539 return false; 534 540 } 535 541 } 536 return true;542 return hasAreaElement; 537 543 } finally { 538 544 MapCSSStyleSource.STYLE_SOURCE_LOCK.readLock().unlock();
Note:
See TracChangeset
for help on using the changeset viewer.