Changeset 6872 in josm for trunk/src


Ignore:
Timestamp:
2014-02-19T00:23:48+01:00 (11 years ago)
Author:
Don-vip
Message:

fix #9695 - ignore barrier in overlapping ways test

File:
1 edited

Legend:

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

    r6870 r6872  
    2222import org.openstreetmap.josm.data.osm.Way;
    2323import org.openstreetmap.josm.data.osm.WaySegment;
     24import org.openstreetmap.josm.data.preferences.CollectionProperty;
    2425import org.openstreetmap.josm.data.validation.Severity;
    2526import org.openstreetmap.josm.data.validation.Test;
     
    3233
    3334/**
    34  * Tests if there are overlapping ways
     35 * Tests if there are overlapping ways.
    3536 *
    3637 * @author frsantos
     
    4950    protected static final int OVERLAPPING_AREA = 120;
    5051    protected static final int DUPLICATE_WAY_SEGMENT = 121;
     52
     53    protected static final CollectionProperty IGNORED_KEYS = new CollectionProperty(
     54            "overlapping-ways.ignored-keys", Arrays.asList("barrier", "building"));
    5155
    5256    /** Constructor */
     
    154158        // see ticket #9598 - only report if at least 3 segments are shared
    155159        for (TestError error : preliminaryErrors) {
    156             if (error.getHighlighted().size() / error.getPrimitives().size() >= 3
    157                     && !Utils.exists(error.getPrimitives(), Predicates.hasKey("building"))) {
    158                 errors.add(error);
     160            if (error.getHighlighted().size() / error.getPrimitives().size() >= 3) {
     161                boolean ignore = false;
     162                for (String ignoredKey : IGNORED_KEYS.get()) {
     163                    if (Utils.exists(error.getPrimitives(), Predicates.hasKey(ignoredKey))) {
     164                        ignore = true;
     165                        break;
     166                    }
     167                }
     168                if (!ignore) {
     169                    errors.add(error);
     170                }
    159171            }
    160172        }
Note: See TracChangeset for help on using the changeset viewer.