Package org.locationtech.jts.noding
Class FastNodingValidator
- java.lang.Object
-
- org.locationtech.jts.noding.FastNodingValidator
-
public class FastNodingValidator extends Object
Validates that a collection ofSegmentStrings is correctly noded. Indexing is used to improve performance. By default validation stops after a single non-noded intersection is detected. Alternatively, it can be requested to detect all intersections by usingsetFindAllIntersections(boolean).The validator does not check for topology collapse situations (e.g. where two segment strings are fully co-incident).
The validator checks for the following situations which indicated incorrect noding:
- Proper intersections between segments (i.e. the intersection is interior to both segments)
- Intersections at an interior vertex (i.e. with an endpoint or another interior vertex)
The client may either test the
isValid()condition, or request that a suitableTopologyExceptionbe thrown.- Version:
- 1.7
- See Also:
NodingIntersectionFinder
-
-
Constructor Summary
Constructors Constructor Description FastNodingValidator(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 voidcheckValid()Checks for an intersection and throws a TopologyException if one is found.static ListcomputeIntersections(Collection segStrings)Gets a list of all intersections found.StringgetErrorMessage()Returns an error message indicating the segments containing the intersection.ListgetIntersections()Gets a list of all intersections found.booleanisValid()Checks for an intersection and reports if one is found.voidsetFindAllIntersections(boolean findAllIntersections)
-
-
-
Constructor Detail
-
FastNodingValidator
public FastNodingValidator(Collection segStrings)
Creates a new noding validator for a given set of linework.- Parameters:
segStrings- a collection ofSegmentStrings
-
-
Method Detail
-
computeIntersections
public static List computeIntersections(Collection segStrings)
Gets a list of all intersections found. Intersections are represented asCoordinates. List is empty if none were found.- Parameters:
segStrings- a collection of SegmentStrings- Returns:
- a list of Coordinate
-
setFindAllIntersections
public void setFindAllIntersections(boolean findAllIntersections)
-
getIntersections
public 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 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
-
-