Class PowerLines
- java.lang.Object
-
- org.openstreetmap.josm.data.validation.Test
-
- org.openstreetmap.josm.data.validation.tests.PowerLines
-
- All Implemented Interfaces:
OsmPrimitiveVisitor
public class PowerLines extends Test
Checks for nodes in power lines/minor_lines that do not have a power=tower/pole tag.
See #7812 for discussions about this test.
-
-
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 private Set<Node>
badConnections
(package private) static Collection<String>
BUILDING_STATION_TAGS
Values forbuilding
key interpreted as power stationsprivate Set<Node>
missingTowerOrPole
(package private) static Collection<String>
POWER_ALLOWED_TAGS
Values forpower
key interpreted as allowed power itemsprotected static int
POWER_CONNECTION
(package private) static Collection<String>
POWER_LINE_TAGS
Values forpower
key interpreted as power linesprotected static int
POWER_LINES
Test identifier(package private) static Collection<String>
POWER_STATION_TAGS
Values forpower
key interpreted as power stations(package private) static Collection<String>
POWER_TOWER_TAGS
Values forpower
key interpreted as power towersprivate List<OsmPrimitive>
powerStations
-
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 PowerLines()
Constructs a newPowerLines
test.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
clearCollections()
void
endTest()
Notification of the end of the test.private static boolean
isBuildingIn(OsmPrimitive p, Collection<String> values)
Helper function to check if building tag is a certain value.protected boolean
isInPowerStation(Node n)
protected static boolean
isPowerAllowed(Node n)
Determines if the specified node denotes a power infrastructure allowed on a power line.private static boolean
isPowerIn(OsmPrimitive p, Collection<String> values)
Helper function to check if power tag is a certain value.protected static boolean
isPowerLine(Way w)
Determines if the specified way denotes a power line.protected static boolean
isPowerStation(OsmPrimitive p)
Determines if the specified primitive denotes a power station.protected static boolean
isPowerTower(Node n)
Determines if the specified node denotes a power tower/pole.private static boolean
isRelatedToPower(Way way)
void
startTest(ProgressMonitor progressMonitor)
Start the test using a given progress monitorvoid
visit(Node n)
Visiting call for points.void
visit(Relation r)
Visiting call for relations.void
visit(Way w)
Visiting call for lines.-
Methods inherited from class org.openstreetmap.josm.data.validation.Test
addGui, clear, deletePrimitivesIfNeeded, fixError, getErrors, getName, getSource, initialize, isBuilding, isCanceled, isFixable, isPrimitiveUsable, isResidentialArea, ok, setBeforeUpload, setPartialSelection, setShowElements, testBeforeUpload, visit
-
-
-
-
Field Detail
-
POWER_LINES
protected static final int POWER_LINES
Test identifier- See Also:
- Constant Field Values
-
POWER_CONNECTION
protected static final int POWER_CONNECTION
- See Also:
- Constant Field Values
-
POWER_LINE_TAGS
static final Collection<String> POWER_LINE_TAGS
Values forpower
key interpreted as power lines
-
POWER_TOWER_TAGS
static final Collection<String> POWER_TOWER_TAGS
Values forpower
key interpreted as power towers
-
POWER_STATION_TAGS
static final Collection<String> POWER_STATION_TAGS
Values forpower
key interpreted as power stations
-
BUILDING_STATION_TAGS
static final Collection<String> BUILDING_STATION_TAGS
Values forbuilding
key interpreted as power stations
-
POWER_ALLOWED_TAGS
static final Collection<String> POWER_ALLOWED_TAGS
Values forpower
key interpreted as allowed power items
-
badConnections
private final Set<Node> badConnections
-
missingTowerOrPole
private final Set<Node> missingTowerOrPole
-
powerStations
private final List<OsmPrimitive> powerStations
-
-
Constructor Detail
-
PowerLines
public PowerLines()
Constructs a newPowerLines
test.
-
-
Method Detail
-
visit
public void visit(Way w)
Description copied from interface:OsmPrimitiveVisitor
Visiting call for lines.- Specified by:
visit
in interfaceOsmPrimitiveVisitor
- Overrides:
visit
in classTest
- Parameters:
w
- The way to inspect.
-
visit
public void visit(Node n)
Description copied from interface:OsmPrimitiveVisitor
Visiting call for points.- Specified by:
visit
in interfaceOsmPrimitiveVisitor
- Overrides:
visit
in classTest
- Parameters:
n
- The node to inspect.
-
isRelatedToPower
private static boolean isRelatedToPower(Way way)
-
visit
public void visit(Relation r)
Description copied from interface:OsmPrimitiveVisitor
Visiting call for relations.- Specified by:
visit
in interfaceOsmPrimitiveVisitor
- Overrides:
visit
in classTest
- Parameters:
r
- The relation to inspect.
-
startTest
public void startTest(ProgressMonitor progressMonitor)
Description copied from class:Test
Start the test using a given progress monitor
-
endTest
public void endTest()
Description copied from class:Test
Notification 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).
-
isInPowerStation
protected final boolean isInPowerStation(Node n)
-
isPowerLine
protected static final boolean isPowerLine(Way w)
Determines if the specified way denotes a power line.- Parameters:
w
- The way to be tested- Returns:
true
if power key is set and equal to line/minor_line
-
isPowerStation
protected static final boolean isPowerStation(OsmPrimitive p)
Determines if the specified primitive denotes a power station.- Parameters:
p
- The primitive to be tested- Returns:
true
if power key is set and equal to station/sub_station/plant
-
isPowerTower
protected static final boolean isPowerTower(Node n)
Determines if the specified node denotes a power tower/pole.- Parameters:
n
- The node to be tested- Returns:
true
if power key is set and equal to tower/pole
-
isPowerAllowed
protected static final boolean isPowerAllowed(Node n)
Determines if the specified node denotes a power infrastructure allowed on a power line.- Parameters:
n
- The node to be tested- Returns:
- True if power key is set and equal to switch/tranformer/busbar/generator
-
isPowerIn
private static boolean isPowerIn(OsmPrimitive p, Collection<String> values)
Helper function to check if power tag is a certain value.- Parameters:
p
- The primitive to be testedvalues
- List of possible values- Returns:
true
if power key is set and equal to possible values
-
isBuildingIn
private static boolean isBuildingIn(OsmPrimitive p, Collection<String> values)
Helper function to check if building tag is a certain value.- Parameters:
p
- The primitive to be testedvalues
- List of possible values- Returns:
true
if power key is set and equal to possible values
-
clearCollections
private void clearCollections()
-
-