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 Collection<String>
ignoreHighways
Specific highway types to ignoreprivate double
maxAngle
The maximum angle for sharp anglesprivate double
maxLength
The length that at least one way segment must be shorter thanprivate 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 void
addIgnoredHighway(String highway)
Add a highway to ignoreprivate 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 or not a way should be checked for sharp anglesvoid
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, setBeforeUpload, setPartialSelection, setShowElements, startTest, 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
-
maxLength
private double maxLength
The length that at least one way segment must be shorter than
-
ignoreHighways
private final Collection<String> ignoreHighways
Specific highway types to ignore
-
-
Constructor Detail
-
SharpAngles
public SharpAngles()
Construct a newIntersectionIssues
object
-
-
Method Detail
-
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 or not 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
-
addIgnoredHighway
public void addIgnoredHighway(String highway)
Add a highway to ignore- Parameters:
highway
- The highway type to ignore (e.g., if you want to ignore residential roads, use "residential")
-
setMaxAngle
public void setMaxAngle(double angle)
Set the maximum angle- Parameters:
angle
- The maximum angle in degrees.
-
-