Package org.locationtech.jts.noding
Class FastNodingValidator
- java.lang.Object
-
- org.locationtech.jts.noding.FastNodingValidator
-
public class FastNodingValidator extends java.lang.ObjectValidates that a collection ofSegmentStrings is correctly noded. Indexing is used to improve performance. In the most common use case, validation stops after a single non-noded intersection is detected, but the class can be requested to detect all intersections by using thesetFindAllIntersections(boolean)method.The validator does not check for a-b-a topology collapse situations.
The validator does not check for endpoint-interior vertex intersections. This should not be a problem, since the JTS noders should be able to compute intersections between vertices correctly.
The client may either test the
isValid()condition, or request that a suitableTopologyExceptionbe thrown.- Version:
- 1.7
-
-
Field Summary
Fields Modifier and Type Field Description private booleanfindAllIntersectionsprivate booleanisValidprivate LineIntersectorliprivate InteriorIntersectionFindersegIntprivate java.util.CollectionsegStrings
-
Constructor Summary
Constructors Constructor Description FastNodingValidator(java.util.Collection segStrings)Creates a new noding validator for a given set of linework.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcheckInteriorIntersections()voidcheckValid()Checks for an intersection and throws a TopologyException if one is found.static java.util.ListcomputeIntersections(java.util.Collection segStrings)private voidexecute()java.lang.StringgetErrorMessage()Returns an error message indicating the segments containing the intersection.java.util.ListgetIntersections()Gets a list of all intersections found.booleanisValid()Checks for an intersection and reports if one is found.voidsetFindAllIntersections(boolean findAllIntersections)
-
-
-
Field Detail
-
li
private LineIntersector li
-
segStrings
private java.util.Collection segStrings
-
findAllIntersections
private boolean findAllIntersections
-
segInt
private InteriorIntersectionFinder segInt
-
isValid
private boolean isValid
-
-
Constructor Detail
-
FastNodingValidator
public FastNodingValidator(java.util.Collection segStrings)
Creates a new noding validator for a given set of linework.- Parameters:
segStrings- a collection ofSegmentStrings
-
-
Method Detail
-
computeIntersections
public static java.util.List computeIntersections(java.util.Collection segStrings)
-
setFindAllIntersections
public void setFindAllIntersections(boolean findAllIntersections)
-
getIntersections
public java.util.List getIntersections()
Gets a list of all intersections found. Intersections are represented asCoordinates. List is empty if none were found.- Returns:
- a list of Coordinate
-
isValid
public boolean isValid()
Checks for an intersection and reports if one is found.- Returns:
- true if the arrangement contains an interior intersection
-
getErrorMessage
public java.lang.String getErrorMessage()
Returns an error message indicating the segments containing the intersection.- Returns:
- an error message documenting the intersection location
-
checkValid
public void checkValid()
Checks for an intersection and throws a TopologyException if one is found.- Throws:
TopologyException- if an intersection is found
-
execute
private void execute()
-
checkInteriorIntersections
private void checkInteriorIntersections()
-
-