Class PowerLines
java.lang.Object
org.openstreetmap.josm.data.validation.Test
org.openstreetmap.josm.data.validation.tests.PowerLines
- All Implemented Interfaces:
OsmPrimitiveVisitor
Checks for
- nodes in power lines/minor_lines that do not have a power=tower/pole/portal tag
- nodes where the reference numbering not consistent
- ways where are unusually long segments without line support feature
- ways where the line type is possibly misused
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static enumPower line support features ref=* numbering direction.(package private) static classDetects continuous reference numbering sequences.private static classHelper class for reference numbering test.Nested classes/interfaces inherited from class org.openstreetmap.josm.data.validation.Test
Test.TagTest -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<Node,Set<OsmPrimitive>> private static final StringValues forbuildingkey interpreted as power stationsprivate final Map<Point2D,List<WaySegment>> All waterway segments, grouped by cellsprivate final Collection<Way>private doubleprivate doubleprivate static final Stringprivate final Set<WaySegment>private final Map<Node,Set<OsmPrimitive>> private static final Stringprotected static final intValues forpowerkey interpreted as allowed power itemsValues forpowerkey interpreted as power lines or cablesValues forpowerkey interpreted as power linesprotected static final intprotected static final intprotected static final intValues forpowerkey interpreted as power stationsprotected static final intValues forpowerkey interpreted as power towersprotected static final intprivate final List<OsmPrimitive>protected static final Stringprivate final Set<OsmPrimitive>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 -
Method Summary
Modifier and TypeMethodDescriptionprivate voidAdd segments to the appropriate cellsprivate static doublecalculateIntersectingLen(Node ref, Set<ILatLon> crossingNodes) The summarized length (in metres) of a way where a power line hangs over a water area.voidclear()Free resources.private static booleanCheck if primitive has a tag that marks it as a water area or boundary of a water area.(package private) static booleandetectDiscontinuity(Way way, Set<OsmPrimitive> nRefDiscontinuities, List<Set<Node>> sRefDiscontinuities) Detects ref=* numbering discontinuities in the given way.voidendTest()Notification of the end of the test.private static voidfindCrossings(Map<Point2D, List<WaySegment>> ways, Way parent, Set<Way> crossingWays, Set<ILatLon> crossingPositions) Searches for way intersections, which intersect thepairattribute.private Collection<? extends OsmPrimitive>getAllPrimitives(Map.Entry<Node, Set<OsmPrimitive>> entry) Combine the node and the related objects.private static booleanisBuildingIn(OsmPrimitive p, Collection<String> values) Helper function to check if building tag is a certain value.private static booleanisConnectedToStationLine(Node n, Way w) Determines if the current node connected to a line which usually used inside power stations.private static booleanChecks if the way continues as a power=minor_line.protected final booleanChecks if the given node is inside a power station.private static booleanChecks if the given primitive denotes a power=minor_line.private static booleanisPowerIn(OsmPrimitive p, Collection<String> values) Helper function to check if power tag is a certain value.protected static booleanDetermines if the specified node denotes a power infrastructure allowed on a power line.protected static booleanisPowerLine(Way w) Determines if the specified way denotes a power line.protected static booleanDetermines if the specified way denotes a power line or cable.protected static booleanDetermines if the specified primitive denotes a power station.protected static booleanisPowerTower(Node n) Determines if the specified node denotes a power support feature.private static booleanisRelatedToPower(Way way) private static booleanisSegmentAlign(PowerLines.SegmentInfo reference, PowerLines.SegmentInfo candidate) Checks if parameter segments align.private voidThe base powerline checksvoidstartTest(ProgressMonitor progressMonitor) Start the test using a given progress monitorvoidVisiting call for points.voidVisiting call for relations.voidVisiting call for lines.Methods inherited from class org.openstreetmap.josm.data.validation.Test
addGui, deletePrimitivesIfNeeded, fixError, getErrors, getName, getSource, initialize, isBuilding, isCanceled, isFixable, isPrimitiveUsable, isResidentialArea, ok, removeIrrelevantErrors, setBeforeUpload, setPartialSelection, setShowElements, testBeforeUpload, visit
-
Field Details
-
MINOR_LINE
- See Also:
-
BUILDING
- See Also:
-
POWER
- See Also:
-
POWER_SUPPORT
- See Also:
-
POWER_CONNECTION
- See Also:
-
POWER_SEGMENT_LENGTH
- See Also:
-
POWER_LOCAL_REF_CONTINUITY
- See Also:
-
POWER_WAY_REF_CONTINUITY
- See Also:
-
POWER_LINE_TYPE
- See Also:
-
PREFIX
-
POWER_LINE_TAGS
Values forpowerkey interpreted as power lines -
POWER_TOWER_TAGS
Values forpowerkey interpreted as power towers -
POWER_STATION_TAGS
Values forpowerkey interpreted as power stations -
BUILDING_STATION_TAGS
Values forbuildingkey interpreted as power stations -
POWER_INFRASTRUCTURE_TAGS
Values forpowerkey interpreted as allowed power items -
POWER_LINE_OR_CABLE_TAGS
Values forpowerkey interpreted as power lines or cables -
hillyCompensation
-
hillyThreshold
-
badConnections
-
missingTags
-
wrongLineType
-
missingNodes
-
refDiscontinuities
-
segmentRefDiscontinuities
-
powerStations
-
foundPowerLines
-
cellSegmentsWater
All waterway segments, grouped by cells
-
-
Constructor Details
-
PowerLines
public PowerLines()Constructs a newPowerLinestest.
-
-
Method Details
-
visit
Description copied from interface:OsmPrimitiveVisitorVisiting call for points.- Specified by:
visitin interfaceOsmPrimitiveVisitor- Overrides:
visitin classTest- Parameters:
n- The node to inspect.
-
visit
Description copied from interface:OsmPrimitiveVisitorVisiting call for lines.- Specified by:
visitin interfaceOsmPrimitiveVisitor- Overrides:
visitin classTest- Parameters:
w- The way to inspect.
-
addWaterWaySegments
Add segments to the appropriate cells- Parameters:
w- The way to add segments from
-
visit
Description copied from interface:OsmPrimitiveVisitorVisiting call for relations.- Specified by:
visitin interfaceOsmPrimitiveVisitor- Overrides:
visitin classTest- Parameters:
r- The relation to inspect.
-
startTest
Description copied from class:TestStart the test using a given progress monitor -
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). -
getAllPrimitives
private Collection<? extends OsmPrimitive> getAllPrimitives(Map.Entry<Node, Set<OsmPrimitive>> entry) Combine the node and the related objects.- Parameters:
entry- a map entry with a node and related objects- Returns:
- set containing the node and the related objects
-
powerlineChecks
The base powerline checks- Parameters:
w- The powerline to check
-
calculateIntersectingLen
The summarized length (in metres) of a way where a power line hangs over a water area.- Parameters:
ref- Reference pointcrossingNodes- Crossing nodes, unordered- Returns:
- The summarized length (in metres) of a way where a power line hangs over a water area
-
findCrossings
private static void findCrossings(Map<Point2D, List<WaySegment>> ways, Way parent, Set<Way> crossingWays, Set<ILatLon> crossingPositions) Searches for way intersections, which intersect thepairattribute.- Parameters:
ways- collection of ways to search for crossingsparent- parent powerline way to find crossings forcrossingWays- found crossing wayscrossingPositions- collection of the crossing positions Inspired byutilsplugin2/selection/NodeWayUtils.java#addWaysIntersectingWay()
-
detectDiscontinuity
static boolean detectDiscontinuity(Way way, Set<OsmPrimitive> nRefDiscontinuities, List<Set<Node>> sRefDiscontinuities) Detects ref=* numbering discontinuities in the given way.- Parameters:
way- checked waynRefDiscontinuities- single node ref=* discontinuitiessRefDiscontinuities- continuous node ref=* discontinuities- Returns:
trueif warning needs to be issued for the whole way
-
isSegmentAlign
private static boolean isSegmentAlign(PowerLines.SegmentInfo reference, PowerLines.SegmentInfo candidate) Checks if parameter segments align. Thereferenceis expected to be at least as long as thecandidate.- Parameters:
reference- Reference segment to check againstcandidate- Candidate segment- Returns:
trueif the two segments ref=* numbering align
-
isRelatedToPower
-
isConnectedToStationLine
Determines if the current node connected to a line which usually used inside power stations.- Parameters:
n- node to checkw- parent way ofn- Returns:
trueifnconnected to power=line + line=*
-
isContinuesAsMinorLine
Checks if the way continues as a power=minor_line.- Parameters:
way- Way to be checked- Returns:
trueif the way continues as a power=minor_line
-
isMinorLine
Checks if the given primitive denotes a power=minor_line.- Parameters:
p- primitive to be checked- Returns:
trueif the given primitive denotes a power=minor_line
-
concernsWaterArea
Check if primitive has a tag that marks it as a water area or boundary of a water area.- Parameters:
p- the primitive- Returns:
trueif primitive has a tag that marks it as a water area or boundary of a water area
-
isInPowerStation
Checks if the given node is inside a power station.- Parameters:
n- Node to be checked- Returns:
- true if the given node is inside a power station
-
isPowerLine
Determines if the specified way denotes a power line.- Parameters:
w- The way to be tested- Returns:
trueif power key is set and equal to line/minor_line
-
isPowerLineOrCable
Determines if the specified way denotes a power line or cable.- Parameters:
w- The way to be tested- Returns:
trueif power key is set and equal to line,minor_line or cable
-
isPowerStation
Determines if the specified primitive denotes a power station.- Parameters:
p- The primitive to be tested- Returns:
trueif power key is set and equal to generator/substation/plant
-
isPowerTower
Determines if the specified node denotes a power support feature.- Parameters:
n- The node to be tested- Returns:
trueif power key is set and equal to pole/tower/portal/catenary_mast
-
isPowerInfrastructure
Determines if the specified node denotes a power infrastructure allowed on a power line.- Parameters:
n- The node to be tested- Returns:
trueif power key is set and equal to compensator/converter/generator/insulator /switch/switchgear/terminal/transformer
-
isPowerIn
Helper function to check if power tag is a certain value.- Parameters:
p- The primitive to be testedvalues- List of possible values- Returns:
trueif power key is set and equal to possible values
-
isBuildingIn
Helper function to check if building tag is a certain value.- Parameters:
p- The primitive to be testedvalues- List of possible values- Returns:
trueif power key is set and equal to possible values
-
clear
Description copied from class:TestFree resources.
-