Class Addresses
- java.lang.Object
-
- org.openstreetmap.josm.data.validation.Test
-
- org.openstreetmap.josm.data.validation.tests.Addresses
-
- All Implemented Interfaces:
OsmPrimitiveVisitor
public class Addresses extends Test
Performs validation tests on addresses (addr:housenumber) and associatedStreet relations.- Since:
- 5644
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.data.validation.Test
Test.TagTest
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringADDR_CITYprotected static java.lang.StringADDR_FLATSprotected static java.lang.StringADDR_HOUSE_NAMEprotected static java.lang.StringADDR_HOUSE_NUMBERprotected static java.lang.StringADDR_INTERPOLATIONprotected static java.lang.StringADDR_NEIGHBOURHOODprotected static java.lang.StringADDR_PLACEprotected static java.lang.StringADDR_POSTCODEprotected static java.lang.StringADDR_STREETprotected static java.lang.StringADDR_SUBURBprotected static java.lang.StringADDR_UNITprotected static java.lang.StringASSOCIATED_STREETprivate javax.swing.JCheckBoxcheckboxIncludeBldgPOIprotected static intDUPLICATE_HOUSE_NUMBERprivate static java.lang.StringHOUSEprotected static intHOUSE_NUMBER_TOO_FARprotected static intHOUSE_NUMBER_WITHOUT_STREETprivate java.util.Set<java.lang.String>ignoredAddressesprivate booleanincludeBldgAndPOIprivate java.util.Map<java.lang.String,java.util.Collection<OsmPrimitive>>knownAddressesprotected static DoublePropertyMAX_DUPLICATE_DISTANCEprotected static DoublePropertyMAX_STREET_DISTANCEprotected static intMULTIPLE_STREET_NAMESprotected static intMULTIPLE_STREET_RELATIONSprotected static java.lang.StringNAME_TAGprotected static intOBSOLETE_RELATIONprivate static BooleanPropertyPREF_INCLUDE_BLDG_POIprivate static java.lang.StringSTREET-
Fields inherited from class org.openstreetmap.josm.data.validation.Test
checkBeforeUpload, checkEnabled, description, enabled, errors, IN_DOWNLOADED_AREA, IN_DOWNLOADED_AREA_STRICT, isBeforeUpload, name, partialSelection, progressMonitor, stopwatch, testBeforeUpload
-
-
Constructor Summary
Constructors Constructor Description Addresses()Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddGui(javax.swing.JPanel testPanel)Allow the tester to manage its own preferencesprotected voidcheckDistance(OsmPrimitive house, java.util.Collection<Way> street)protected java.util.List<TestError>checkForDuplicate(OsmPrimitive p)protected TestErrorcheckHouseNumbersWithoutStreet(OsmPrimitive p)Checks for house numbers for which the street is unknown.private voidcheckIfObsolete(Relation r)Check if an associatedStreet Relation is obsolete.private voidcollectAddress(OsmPrimitive p)adds the OsmPrimitive to the address map if it complies to the restrictionsvoidendTest()Notification of the end of the test.(package private) static java.util.List<java.lang.String>expandHouseNumber(java.lang.String houseNumber)Split addr:housenumber on , and ; (common separators)CommandfixError(TestError testError)remove obsolete relation.protected java.util.List<Relation>getAndCheckAssociatedStreets(OsmPrimitive p)(package private) static doublegetDistance(OsmPrimitive a, OsmPrimitive b)returns rough distance between two OsmPrimitives(package private) static java.util.List<java.lang.String>getSimplifiedAddresses(OsmPrimitive p)(package private) static booleanhasAddress(OsmPrimitive p)protected voidinitAddressMap(OsmPrimitive primitive)booleanisFixable(TestError testError)Returns true if the given error can be fixed automaticallyprivate static booleanisInWarnCountry(RelationMember m, java.lang.String[] countryCodes)(package private) static booleanisPOI(OsmPrimitive p)booleanok()Called when the used submits the preferencesvoidstartTest(ProgressMonitor progressMonitor)Start the test using a given progress monitorvoidvisit(Node n)Visiting call for points.voidvisit(Relation r)Visiting call for relations.voidvisit(Way w)Visiting call for lines.-
Methods inherited from class org.openstreetmap.josm.data.validation.Test
clear, deletePrimitivesIfNeeded, getErrors, getName, getSource, initialize, isBuilding, isCanceled, isPrimitiveUsable, isResidentialArea, removeIrrelevantErrors, setBeforeUpload, setPartialSelection, setShowElements, testBeforeUpload, visit
-
-
-
-
Field Detail
-
HOUSE_NUMBER_WITHOUT_STREET
protected static final int HOUSE_NUMBER_WITHOUT_STREET
- See Also:
- Constant Field Values
-
DUPLICATE_HOUSE_NUMBER
protected static final int DUPLICATE_HOUSE_NUMBER
- See Also:
- Constant Field Values
-
MULTIPLE_STREET_NAMES
protected static final int MULTIPLE_STREET_NAMES
- See Also:
- Constant Field Values
-
MULTIPLE_STREET_RELATIONS
protected static final int MULTIPLE_STREET_RELATIONS
- See Also:
- Constant Field Values
-
HOUSE_NUMBER_TOO_FAR
protected static final int HOUSE_NUMBER_TOO_FAR
- See Also:
- Constant Field Values
-
OBSOLETE_RELATION
protected static final int OBSOLETE_RELATION
- See Also:
- Constant Field Values
-
MAX_DUPLICATE_DISTANCE
protected static final DoubleProperty MAX_DUPLICATE_DISTANCE
-
MAX_STREET_DISTANCE
protected static final DoubleProperty MAX_STREET_DISTANCE
-
ADDR_HOUSE_NUMBER
protected static final java.lang.String ADDR_HOUSE_NUMBER
- See Also:
- Constant Field Values
-
ADDR_INTERPOLATION
protected static final java.lang.String ADDR_INTERPOLATION
- See Also:
- Constant Field Values
-
ADDR_NEIGHBOURHOOD
protected static final java.lang.String ADDR_NEIGHBOURHOOD
- See Also:
- Constant Field Values
-
ADDR_PLACE
protected static final java.lang.String ADDR_PLACE
- See Also:
- Constant Field Values
-
ADDR_STREET
protected static final java.lang.String ADDR_STREET
- See Also:
- Constant Field Values
-
ADDR_SUBURB
protected static final java.lang.String ADDR_SUBURB
- See Also:
- Constant Field Values
-
ADDR_CITY
protected static final java.lang.String ADDR_CITY
- See Also:
- Constant Field Values
-
ADDR_UNIT
protected static final java.lang.String ADDR_UNIT
- See Also:
- Constant Field Values
-
ADDR_FLATS
protected static final java.lang.String ADDR_FLATS
- See Also:
- Constant Field Values
-
ADDR_HOUSE_NAME
protected static final java.lang.String ADDR_HOUSE_NAME
- See Also:
- Constant Field Values
-
ADDR_POSTCODE
protected static final java.lang.String ADDR_POSTCODE
- See Also:
- Constant Field Values
-
ASSOCIATED_STREET
protected static final java.lang.String ASSOCIATED_STREET
- See Also:
- Constant Field Values
-
NAME_TAG
protected static final java.lang.String NAME_TAG
- See Also:
- Constant Field Values
-
HOUSE
private static final java.lang.String HOUSE
- See Also:
- Constant Field Values
-
STREET
private static final java.lang.String STREET
- See Also:
- Constant Field Values
-
PREF_INCLUDE_BLDG_POI
private static final BooleanProperty PREF_INCLUDE_BLDG_POI
-
checkboxIncludeBldgPOI
private final javax.swing.JCheckBox checkboxIncludeBldgPOI
-
includeBldgAndPOI
private boolean includeBldgAndPOI
-
knownAddresses
private java.util.Map<java.lang.String,java.util.Collection<OsmPrimitive>> knownAddresses
-
ignoredAddresses
private java.util.Set<java.lang.String> ignoredAddresses
-
-
Constructor Detail
-
Addresses
public Addresses()
Constructor
-
-
Method Detail
-
getAndCheckAssociatedStreets
protected java.util.List<Relation> getAndCheckAssociatedStreets(OsmPrimitive p)
-
checkHouseNumbersWithoutStreet
protected TestError checkHouseNumbersWithoutStreet(OsmPrimitive p)
Checks for house numbers for which the street is unknown.- Parameters:
p- primitive to test- Returns:
- error found, or null
-
isPOI
static boolean isPOI(OsmPrimitive p)
-
hasAddress
static boolean hasAddress(OsmPrimitive p)
-
collectAddress
private void collectAddress(OsmPrimitive p)
adds the OsmPrimitive to the address map if it complies to the restrictions- Parameters:
p- OsmPrimitive that has an address
-
initAddressMap
protected void initAddressMap(OsmPrimitive primitive)
-
startTest
public void startTest(ProgressMonitor progressMonitor)
Description copied from class:TestStart the test using a given progress monitor
-
endTest
public void endTest()
Description copied from class:TestNotification of the end of the test. The tester may perform additional actions and destroy the used structures.If you override this method, don't forget to cleanup
progressMonitor(most overrides callsuper.endTest()to do this).
-
checkForDuplicate
protected java.util.List<TestError> checkForDuplicate(OsmPrimitive p)
-
getSimplifiedAddresses
static java.util.List<java.lang.String> getSimplifiedAddresses(OsmPrimitive p)
-
expandHouseNumber
static java.util.List<java.lang.String> expandHouseNumber(java.lang.String houseNumber)
Split addr:housenumber on , and ; (common separators)- Parameters:
houseNumber- The housenumber to be split- Returns:
- A list of addr:housenumber equivalents
-
visit
public void visit(Node n)
Description copied from interface:OsmPrimitiveVisitorVisiting call for points.- Specified by:
visitin interfaceOsmPrimitiveVisitor- Overrides:
visitin classTest- Parameters:
n- The node to inspect.
-
visit
public void visit(Way w)
Description copied from interface:OsmPrimitiveVisitorVisiting call for lines.- Specified by:
visitin interfaceOsmPrimitiveVisitor- Overrides:
visitin classTest- Parameters:
w- The way to inspect.
-
visit
public void visit(Relation r)
Description copied from interface:OsmPrimitiveVisitorVisiting call for relations.- Specified by:
visitin interfaceOsmPrimitiveVisitor- Overrides:
visitin classTest- Parameters:
r- The relation to inspect.
-
getDistance
static double getDistance(OsmPrimitive a, OsmPrimitive b)
returns rough distance between two OsmPrimitives- Parameters:
a- primitive ab- primitive b- Returns:
- distance of center of bounding boxes in meters
-
checkDistance
protected void checkDistance(OsmPrimitive house, java.util.Collection<Way> street)
-
checkIfObsolete
private void checkIfObsolete(Relation r)
Check if an associatedStreet Relation is obsolete. This test marks only those relations which are complete and don't contain any information which isn't also tagged on the members. The strategy is to avoid any false positive.- Parameters:
r- the relation
-
isInWarnCountry
private static boolean isInWarnCountry(RelationMember m, java.lang.String[] countryCodes)
-
isFixable
public boolean isFixable(TestError testError)
Description copied from class:TestReturns true if the given error can be fixed automatically
-
addGui
public void addGui(javax.swing.JPanel testPanel)
Description copied from class:TestAllow the tester to manage its own preferences
-
-