Changeset 5662 in josm for trunk/src/org/openstreetmap/josm


Ignore:
Timestamp:
2013-01-04T01:49:12+01:00 (11 years ago)
Author:
Don-vip
Message:

fix #8314 for good - Validator: handle of addr:interpolation and incomplete houses in associatedStreet relations

File:
1 edited

Legend:

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

    r5655 r5662  
    4141    protected static final int HOUSE_NUMBER_ON_NON_BUILDING_AREA = 2606;
    4242   
    43     protected static final String ADDR_HOUSE_NUMBER = "addr:housenumber";
    44     protected static final String ADDR_STREET       = "addr:street";
    45     protected static final String ASSOCIATED_STREET = "associatedStreet";
     43    protected static final String ADDR_HOUSE_NUMBER  = "addr:housenumber";
     44    protected static final String ADDR_INTERPOLATION = "addr:interpolation";
     45    protected static final String ADDR_STREET        = "addr:street";
     46    protected static final String ASSOCIATED_STREET  = "associatedStreet";
    4647   
    4748    protected class AddressError extends TestError {
     
    143144            }
    144145            // Report duplicate house numbers
    145             String description_en = marktr("House number '{0}' duplicated");
     146            String description_en = marktr("House number ''{0}'' duplicated");
    146147            for (String key : map.keySet()) {
    147148                List<OsmPrimitive> list = map.get(key);
     
    159160            if (!street.isEmpty()) {
    160161                for (OsmPrimitive house : houses) {
    161                     checkDistance(house, street);
     162                    if (house.isUsable()) {
     163                        checkDistance(house, street);
     164                    }
    162165                }
    163166            }
     
    170173            centroid = ((Node) house).getEastNorth();
    171174        } else if (house instanceof Way) {
    172             centroid = Geometry.getCentroid(((Way)house).getNodes());
     175            List<Node> nodes = ((Way)house).getNodes();
     176            if (house.hasKey(ADDR_INTERPOLATION)) {
     177                for (Node n : nodes) {
     178                    if (n.hasKey(ADDR_HOUSE_NUMBER)) {
     179                        checkDistance(n, street);
     180                    }
     181                }
     182                return;
     183            }
     184            centroid = Geometry.getCentroid(nodes);
    173185        } else {
    174186            return; // TODO handle multipolygon houses ?
Note: See TracChangeset for help on using the changeset viewer.