org.openstreetmap.josm.data.validation.tests
Class PowerLines

java.lang.Object
  extended by org.openstreetmap.josm.data.osm.visitor.AbstractVisitor
      extended by org.openstreetmap.josm.data.validation.Test
          extended by org.openstreetmap.josm.data.validation.tests.PowerLines
All Implemented Interfaces:
Visitor

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
protected  class PowerLines.PowerLineError
           
 
Field Summary
protected  java.util.List<PowerLines.PowerLineError> potentialErrors
           
static java.util.Collection<java.lang.String> POWER_ALLOWED_TAGS
           
static java.util.Collection<java.lang.String> POWER_LINE_TAGS
           
protected static int POWER_LINES
           
static java.util.Collection<java.lang.String> POWER_STATION_TAGS
           
static java.util.Collection<java.lang.String> POWER_TOWER_TAGS
           
protected  java.util.List<OsmPrimitive> powerStations
           
protected  java.util.Map<Way,java.lang.String> towerPoleTagMap
           
 
Fields inherited from class org.openstreetmap.josm.data.validation.Test
checkBeforeUpload, checkEnabled, description, enabled, errors, isBeforeUpload, name, partialSelection, progressMonitor, testBeforeUpload
 
Constructor Summary
PowerLines()
           
 
Method Summary
 void endTest()
          Notification of the end of the test.
 Command fixError(TestError testError)
          Fixes the error with the appropriate command
 boolean isFixable(TestError testError)
          Returns true if the given error can be fixed automatically
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, java.util.Collection<java.lang.String> values)
           
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.
 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, deletePrimitivesIfNeeded, getErrors, getName, initialize, isBuilding, isCanceled, ok, setBeforeUpload, setPartialSelection, startTest, testBeforeUpload, visit, visit
 
Methods inherited from class org.openstreetmap.josm.data.osm.visitor.AbstractVisitor
visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POWER_LINES

protected static final int POWER_LINES
See Also:
Constant Field Values

POWER_LINE_TAGS

public static final java.util.Collection<java.lang.String> POWER_LINE_TAGS

POWER_TOWER_TAGS

public static final java.util.Collection<java.lang.String> POWER_TOWER_TAGS

POWER_STATION_TAGS

public static final java.util.Collection<java.lang.String> POWER_STATION_TAGS

POWER_ALLOWED_TAGS

public static final java.util.Collection<java.lang.String> POWER_ALLOWED_TAGS

towerPoleTagMap

protected final java.util.Map<Way,java.lang.String> towerPoleTagMap

potentialErrors

protected final java.util.List<PowerLines.PowerLineError> potentialErrors

powerStations

protected final java.util.List<OsmPrimitive> powerStations
Constructor Detail

PowerLines

public PowerLines()
Method Detail

visit

public void visit(Way w)
Description copied from interface: Visitor
Visiting call for lines.

Specified by:
visit in interface Visitor
Overrides:
visit in class Test
Parameters:
w - The way to inspect.

visit

public void visit(Relation r)
Description copied from interface: Visitor
Visiting call for relations.

Specified by:
visit in interface Visitor
Overrides:
visit in class Test
Parameters:
r - The relation to inspect.

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 Test.progressMonitor (most overrides call super.endTest() to do this).

Overrides:
endTest in class Test

isInPowerStation

protected final boolean isInPowerStation(Node n)

fixError

public Command fixError(TestError testError)
Description copied from class: Test
Fixes the error with the appropriate command

Overrides:
fixError in class Test
Returns:
The command to fix the error

isFixable

public boolean isFixable(TestError testError)
Description copied from class: Test
Returns true if the given error can be fixed automatically

Overrides:
isFixable in class Test
Parameters:
testError - The error to check if can be fixed
Returns:
true if the error can be fixed

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:
w - The way 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:
w - 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:
w - The node to be tested
Returns:
True if power key is set and equal to switch/tranformer/busbar/generator

isPowerIn

private static final boolean isPowerIn(OsmPrimitive p,
                                       java.util.Collection<java.lang.String> values)


JOSM