Changeset 12700 in josm for trunk/src


Ignore:
Timestamp:
2017-08-30T23:25:16+02:00 (7 years ago)
Author:
bastiK
Message:

fixed #15203 - Wrong "Area style way is not closed" message for highway=motorway_junction

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MultipolygonTest.java

    r12663 r12700  
    114114    @Override
    115115    public void visit(Way w) {
    116         if (!w.isArea() && ElemStyles.hasOnlyAreaOrTextStyleElements(w)) {
     116        if (!w.isArea() && ElemStyles.hasOnlyAreaElements(w)) {
    117117            List<Node> nodes = w.getNodes();
    118118            if (nodes.isEmpty()) return; // fix zero nodes bug
  • trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java

    r12026 r12700  
    515515
    516516    /**
    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.
    518521     * @param p the OSM primitive
    519      * @return {@code true} if primitive has only an AreaElement
    520      * @since 7486
    521      */
    522     public static boolean hasOnlyAreaOrTextStyleElements(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) {
    523526        MapCSSStyleSource.STYLE_SOURCE_LOCK.readLock().lock();
    524527        try {
     
    526529                return false;
    527530            StyleElementList styles = MapPaintStyles.getStyles().generateStyles(p, 1.0, false).a;
    528             if (styles.isEmpty()) {
    529                 return false;
    530             }
     531            boolean hasAreaElement = false;
    531532            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 {
    533539                    return false;
    534540                }
    535541            }
    536             return true;
     542            return hasAreaElement;
    537543        } finally {
    538544            MapCSSStyleSource.STYLE_SOURCE_LOCK.readLock().unlock();
Note: See TracChangeset for help on using the changeset viewer.