Changeset 6826 in josm


Ignore:
Timestamp:
2014-02-08T00:20:41+01:00 (5 years ago)
Author:
Don-vip
Message:

fix #9685 - validator: Incomplete test for "house number without street"

File:
1 edited

Legend:

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

    r6330 r6826  
    8383    }
    8484
    85     @Override
    86     public void visit(Node n) {
    87         List<Relation> associatedStreets = getAndCheckAssociatedStreets(n);
     85    protected void checkHouseNumbersWithoutStreet(OsmPrimitive p) {
     86        List<Relation> associatedStreets = getAndCheckAssociatedStreets(p);
    8887        // Find house number without proper location (neither addr:street, associatedStreet, addr:place or addr:interpolation)
    89         if (n.hasKey(ADDR_HOUSE_NUMBER) && !n.hasKey(ADDR_STREET) && !n.hasKey(ADDR_PLACE)) {
     88        if (p.hasKey(ADDR_HOUSE_NUMBER) && !p.hasKey(ADDR_STREET) && !p.hasKey(ADDR_PLACE)) {
    9089            for (Relation r : associatedStreets) {
    9190                if (r.hasTag("type", ASSOCIATED_STREET)) {
     
    9392                }
    9493            }
    95             for (Way w : OsmPrimitive.getFilteredList(n.getReferrers(), Way.class)) {
     94            for (Way w : OsmPrimitive.getFilteredList(p.getReferrers(), Way.class)) {
    9695                if (w.hasKey(ADDR_INTERPOLATION) && w.hasKey(ADDR_STREET)) {
    9796                    return;
     
    9998            }
    10099            // No street found
    101             errors.add(new AddressError(HOUSE_NUMBER_WITHOUT_STREET, n, tr("House number without street")));
    102         }
     100            errors.add(new AddressError(HOUSE_NUMBER_WITHOUT_STREET, p, tr("House number without street")));
     101        }
     102    }
     103
     104    @Override
     105    public void visit(Node n) {
     106        checkHouseNumbersWithoutStreet(n);
    103107    }
    104108
    105109    @Override
    106110    public void visit(Way w) {
    107         getAndCheckAssociatedStreets(w);
     111        checkHouseNumbersWithoutStreet(w);
    108112    }
    109113
    110114    @Override
    111115    public void visit(Relation r) {
    112         getAndCheckAssociatedStreets(r);
     116        checkHouseNumbersWithoutStreet(r);
    113117        if (r.hasTag("type", ASSOCIATED_STREET)) {
    114118            // Used to count occurences of each house number in order to find duplicates
     
    202206                    }
    203207                } else {
    204                     Main.warn("Addresses test skipped chunck "+chunk+" for street part "+streetPart+" because p1 or p2 is null"); 
     208                    Main.warn("Addresses test skipped chunck "+chunk+" for street part "+streetPart+" because p1 or p2 is null");
    205209                }
    206210            }
Note: See TracChangeset for help on using the changeset viewer.