Class SimpleSnapRounder
java.lang.Object
org.locationtech.jts.noding.snapround.SimpleSnapRounder
- All Implemented Interfaces:
Noder
Uses Snap Rounding to compute a rounded,
fully noded arrangement from a set of
SegmentStrings.
Implements the Snap Rounding technique described in
the papers by Hobby, Guibas & Marimont, and Goodrich et al.
Snap Rounding assumes that all vertices lie on a uniform grid;
hence the precision model of the input must be fixed precision,
and all the input vertices must be rounded to that precision.
This implementation uses simple iteration over the line segments. This is not the most efficient approach for large sets of segments.
This implementation appears to be fully robust using an integer precision model. It will function with non-integer precision models, but the results are not 100% guaranteed to be correctly noded.
- Version:
- 1.7
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate LineIntersectorprivate Collectionprivate final PrecisionModelprivate final double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcheckCorrectness(Collection inputSegmentStrings) voidcomputeNodes(Collection inputSegmentStrings) Computes the noding for a collection ofSegmentStrings.private voidcomputeSnaps(Collection segStrings, Collection snapPts) Computes nodes introduced as a result of snapping segments to snap points (hot pixels)private voidcomputeSnaps(NodedSegmentString ss, Collection snapPts) voidcomputeVertexSnaps(Collection edges) Computes nodes introduced as a result of snapping segments to vertices of other segmentsprivate voidPerforms a brute-force comparison of every segment in eachSegmentString.private ListfindInteriorIntersections(Collection segStrings, LineIntersector li) Computes all interior intersections in the collection ofSegmentStrings, and returns theirCoordinates.Returns aCollectionof fully nodedSegmentStrings.private voidsnapRound(Collection segStrings, LineIntersector li)
-
Field Details
-
pm
-
li
-
scaleFactor
private final double scaleFactor -
nodedSegStrings
-
-
Constructor Details
-
SimpleSnapRounder
-
-
Method Details
-
getNodedSubstrings
Description copied from interface:NoderReturns aCollectionof fully nodedSegmentStrings. The SegmentStrings have the same context as their parent.- Specified by:
getNodedSubstringsin interfaceNoder- Returns:
- a Collection of NodedSegmentStrings representing the substrings
-
computeNodes
Description copied from interface:NoderComputes the noding for a collection ofSegmentStrings. Some Noders may add all these nodes to the input SegmentStrings; others may only add some or none at all.- Specified by:
computeNodesin interfaceNoder- Parameters:
inputSegmentStrings- a Collection of NodedSegmentStrings
-
checkCorrectness
-
snapRound
-
findInteriorIntersections
Computes all interior intersections in the collection ofSegmentStrings, and returns theirCoordinates. Does NOT node the segStrings.- Returns:
- a list of Coordinates for the intersections
-
computeSnaps
Computes nodes introduced as a result of snapping segments to snap points (hot pixels)- Parameters:
li-
-
computeSnaps
-
computeVertexSnaps
Computes nodes introduced as a result of snapping segments to vertices of other segments- Parameters:
edges- the list of segment strings to snap together
-
computeVertexSnaps
Performs a brute-force comparison of every segment in eachSegmentString. This has n^2 performance.
-