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>
ignoreHighways
Specific highway types to ignoreprivate java.util.Collection<java.lang.String>
ignoreRailway
Specific railway types to ignoreprivate double
maxAngle
The maximum angle for sharp angles (degrees)private double
maxLength
The length that at least one way segment must be shorter than (meters)private static int
SHARP_ANGLES
The code for a sharp angleprivate static int
SHARPANGLESCODE
-
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 newIntersectionIssues
object
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkAngle(Node node1, Node node2, Node node3, int i, Way way, boolean last)
void
checkWayForSharpAngles(Way way)
Check nodes in a way for sharp anglesprivate void
createNearlyOverlappingError(double angle, Way way, OsmPrimitive primitive)
private Severity
getSeverity(double angle)
private void
processSharpAngleForErrorCreation(double angle, int i, Way way, boolean last, Node pointNode)
void
setMaxAngle(double angle)
Set the maximum anglevoid
setMaxLength(double length)
Set the maximum length for the shortest segmentboolean
shouldBeTestedForSharpAngles(Way way)
Check whether a way should be checked for sharp anglesvoid
startTest(ProgressMonitor progressMonitor)
Start the test using a given progress monitorvoid
visit(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 newIntersectionIssues
object
-
-
Method Detail
-
startTest
public void startTest(ProgressMonitor progressMonitor)
Description copied from class:Test
Start the test using a given progress monitor
-
visit
public void visit(Way way)
Description copied from interface:OsmPrimitiveVisitor
Visiting call for lines.- Specified by:
visit
in interfaceOsmPrimitiveVisitor
- Overrides:
visit
in 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:
true
if 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.
-
-