Class SharpAngles
- java.lang.Object
-
- org.openstreetmap.josm.data.validation.Test
-
- org.openstreetmap.josm.data.validation.tests.SharpAngles
-
- All Implemented Interfaces:
OsmPrimitiveVisitor
public class SharpAngles extends Test
Find highways that have sharp angles- Since:
- 15406
-
-
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 java.util.Collection<java.lang.String>ignoreHighwaysSpecific highway types to ignoreprivate java.util.Collection<java.lang.String>ignoreRailwaySpecific railway types to ignoreprivate doublemaxAngleThe maximum angle for sharp angles (degrees)private doublemaxLengthThe length that at least one way segment must be shorter than (meters)private static intSHARP_ANGLESThe code for a sharp angleprivate static intSHARPANGLESCODE-
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 SharpAngles()Construct a newIntersectionIssuesobject
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcheckAngle(Node node1, Node node2, Node node3, int i, Way way, boolean last)voidcheckWayForSharpAngles(Way way)Check nodes in a way for sharp anglesprivate voidcreateNearlyOverlappingError(double angle, Way way, OsmPrimitive primitive)private SeveritygetSeverity(double angle)private voidprocessSharpAngleForErrorCreation(double angle, int i, Way way, boolean last, Node pointNode)voidsetMaxAngle(double angle)Set the maximum anglevoidsetMaxLength(double length)Set the maximum length for the shortest segmentbooleanshouldBeTestedForSharpAngles(Way way)Check whether a way should be checked for sharp anglesvoidstartTest(ProgressMonitor progressMonitor)Start the test using a given progress monitorvoidvisit(Way way)Visiting call for lines.-
Methods inherited from class org.openstreetmap.josm.data.validation.Test
addGui, clear, deletePrimitivesIfNeeded, endTest, fixError, getErrors, getName, getSource, initialize, isBuilding, isCanceled, isFixable, isPrimitiveUsable, isResidentialArea, ok, removeIrrelevantErrors, setBeforeUpload, setPartialSelection, setShowElements, testBeforeUpload, visit, visit, visit
-
-
-
-
Field Detail
-
SHARPANGLESCODE
private static final int SHARPANGLESCODE
- See Also:
- Constant Field Values
-
SHARP_ANGLES
private static final int SHARP_ANGLES
The code for a sharp angle- See Also:
- Constant Field Values
-
maxAngle
private double maxAngle
The maximum angle for sharp angles (degrees)
-
maxLength
private double maxLength
The length that at least one way segment must be shorter than (meters)
-
ignoreHighways
private java.util.Collection<java.lang.String> ignoreHighways
Specific highway types to ignore
-
ignoreRailway
private java.util.Collection<java.lang.String> ignoreRailway
Specific railway types to ignore
-
-
Constructor Detail
-
SharpAngles
public SharpAngles()
Construct a newIntersectionIssuesobject
-
-
Method Detail
-
startTest
public void startTest(ProgressMonitor progressMonitor)
Description copied from class:TestStart the test using a given progress monitor
-
visit
public void visit(Way way)
Description copied from interface:OsmPrimitiveVisitorVisiting call for lines.- Specified by:
visitin interfaceOsmPrimitiveVisitor- Overrides:
visitin classTest- Parameters:
way- The way to inspect.
-
shouldBeTestedForSharpAngles
public boolean shouldBeTestedForSharpAngles(Way way)
Check whether a way should be checked for sharp angles- Parameters:
way- The way that needs to be checked- Returns:
trueif the way should be checked.
-
checkWayForSharpAngles
public void checkWayForSharpAngles(Way way)
Check nodes in a way for sharp angles- Parameters:
way- A way to check for sharp angles
-
checkAngle
private void checkAngle(Node node1, Node node2, Node node3, int i, Way way, boolean last)
-
processSharpAngleForErrorCreation
private void processSharpAngleForErrorCreation(double angle, int i, Way way, boolean last, Node pointNode)
-
createNearlyOverlappingError
private void createNearlyOverlappingError(double angle, Way way, OsmPrimitive primitive)
-
getSeverity
private Severity getSeverity(double angle)
-
setMaxLength
public void setMaxLength(double length)
Set the maximum length for the shortest segment- Parameters:
length- The max length in meters
-
setMaxAngle
public void setMaxAngle(double angle)
Set the maximum angle- Parameters:
angle- The maximum angle in degrees.
-
-