Class MCIndexSnapRounder
- java.lang.Object
-
- org.locationtech.jts.noding.snapround.MCIndexSnapRounder
-
- All Implemented Interfaces:
Noder
public class MCIndexSnapRounder extends java.lang.Object implements Noder
Uses Snap Rounding to compute a rounded, fully noded arrangement from a set ofSegmentString
s. Implements the Snap Rounding technique described in 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 a monotone chains and a spatial index to speed up the intersection tests.
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
Fields Modifier and Type Field Description private LineIntersector
li
private java.util.Collection
nodedSegStrings
private MCIndexNoder
noder
private PrecisionModel
pm
private MCIndexPointSnapper
pointSnapper
private double
scaleFactor
-
Constructor Summary
Constructors Constructor Description MCIndexSnapRounder(PrecisionModel pm)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkCorrectness(java.util.Collection inputSegmentStrings)
private void
computeIntersectionSnaps(java.util.Collection snapPts)
Snaps segments to nodes created by segment intersections.void
computeNodes(java.util.Collection inputSegmentStrings)
Computes the noding for a collection ofSegmentString
s.void
computeVertexSnaps(java.util.Collection edges)
Snaps segments to all vertices.private void
computeVertexSnaps(NodedSegmentString e)
Snaps segments to the vertices of a Segment String.private java.util.List
findInteriorIntersections(java.util.Collection segStrings, LineIntersector li)
Computes all interior intersections in the collection ofSegmentString
s, and returns theirCoordinate
s.java.util.Collection
getNodedSubstrings()
Returns aCollection
of fully nodedSegmentString
s.private void
snapRound(java.util.Collection segStrings, LineIntersector li)
-
-
-
Field Detail
-
pm
private final PrecisionModel pm
-
li
private LineIntersector li
-
scaleFactor
private final double scaleFactor
-
noder
private MCIndexNoder noder
-
pointSnapper
private MCIndexPointSnapper pointSnapper
-
nodedSegStrings
private java.util.Collection nodedSegStrings
-
-
Constructor Detail
-
MCIndexSnapRounder
public MCIndexSnapRounder(PrecisionModel pm)
-
-
Method Detail
-
getNodedSubstrings
public java.util.Collection getNodedSubstrings()
Description copied from interface:Noder
Returns aCollection
of fully nodedSegmentString
s. The SegmentStrings have the same context as their parent.- Specified by:
getNodedSubstrings
in interfaceNoder
- Returns:
- a Collection of SegmentStrings
-
computeNodes
public void computeNodes(java.util.Collection inputSegmentStrings)
Description copied from interface:Noder
Computes the noding for a collection ofSegmentString
s. Some Noders may add all these nodes to the input SegmentStrings; others may only add some or none at all.- Specified by:
computeNodes
in interfaceNoder
- Parameters:
inputSegmentStrings
- a collection ofSegmentString
s to node
-
checkCorrectness
private void checkCorrectness(java.util.Collection inputSegmentStrings)
-
snapRound
private void snapRound(java.util.Collection segStrings, LineIntersector li)
-
findInteriorIntersections
private java.util.List findInteriorIntersections(java.util.Collection segStrings, LineIntersector li)
Computes all interior intersections in the collection ofSegmentString
s, and returns theirCoordinate
s. Does NOT node the segStrings.- Returns:
- a list of Coordinates for the intersections
-
computeIntersectionSnaps
private void computeIntersectionSnaps(java.util.Collection snapPts)
Snaps segments to nodes created by segment intersections.
-
computeVertexSnaps
public void computeVertexSnaps(java.util.Collection edges)
Snaps segments to all vertices.- Parameters:
edges
- the list of segment strings to snap together
-
computeVertexSnaps
private void computeVertexSnaps(NodedSegmentString e)
Snaps segments to the vertices of a Segment String.
-
-