Package org.locationtech.jts.noding
Class NodedSegmentString
java.lang.Object
org.locationtech.jts.noding.NodedSegmentString
- All Implemented Interfaces:
NodableSegmentString,SegmentString
Represents a list of contiguous line segments,
and supports noding the segments.
The line segments are represented by an array of
Coordinates.
Intended to optimize the noding of contiguous segments by
reducing the number of allocated objects.
SegmentStrings can carry a context object, which is useful
for preserving topological or parentage information.
All noded substrings are initialized with the same context object.- Version:
- 1.7
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNodedSegmentString(Coordinate[] pts, Object data) Creates a new segment string from a list of vertices. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddIntersection(LineIntersector li, int segmentIndex, int geomIndex, int intIndex) Add an SegmentNode for intersection intIndex.voidaddIntersection(Coordinate intPt, int segmentIndex) Adds an intersection node for a given point and segment to this segment string.addIntersectionNode(Coordinate intPt, int segmentIndex) Adds an intersection node for a given point and segment to this segment string.voidaddIntersections(LineIntersector li, int segmentIndex, int geomIndex) Adds EdgeIntersections for one or both intersections found for a segment of an edge to the edge intersection list.getCoordinate(int i) getData()Gets the user-defined data for this segment string.static ListgetNodedSubstrings(Collection segStrings) Gets theSegmentStrings which result from splitting this string at node points.static voidgetNodedSubstrings(Collection segStrings, Collection resultEdgelist) Adds the nodedSegmentStrings which result from splitting this string at node points.intgetSegmentOctant(int index) Gets the octant of the segment starting at vertexindex.booleanisClosed()private intsafeOctant(Coordinate p0, Coordinate p1) voidSets the user-defined data for this segment string.intsize()toString()
-
Field Details
-
nodeList
-
pts
-
data
-
-
Constructor Details
-
NodedSegmentString
Creates a new segment string from a list of vertices.- Parameters:
pts- the vertices of the segment stringdata- the user-defined data of this segment string (may be null)
-
-
Method Details
-
getNodedSubstrings
Gets theSegmentStrings which result from splitting this string at node points.- Parameters:
segStrings- a Collection of NodedSegmentStrings- Returns:
- a Collection of NodedSegmentStrings representing the substrings
-
getNodedSubstrings
Adds the nodedSegmentStrings which result from splitting this string at node points.- Parameters:
segStrings- a Collection of NodedSegmentStringsresultEdgelist- a List which will collect the NodedSegmentStrings representing the substrings
-
getData
Gets the user-defined data for this segment string.- Specified by:
getDatain interfaceSegmentString- Returns:
- the user-defined data
-
setData
Sets the user-defined data for this segment string.- Specified by:
setDatain interfaceSegmentString- Parameters:
data- an Object containing user-defined data
-
getNodeList
-
size
public int size()- Specified by:
sizein interfaceSegmentString
-
getCoordinate
- Specified by:
getCoordinatein interfaceSegmentString
-
getCoordinates
- Specified by:
getCoordinatesin interfaceSegmentString
-
isClosed
public boolean isClosed()- Specified by:
isClosedin interfaceSegmentString
-
getSegmentOctant
public int getSegmentOctant(int index) Gets the octant of the segment starting at vertexindex.- Parameters:
index- the index of the vertex starting the segment. Must not be the last index in the vertex list- Returns:
- the octant of the segment at the vertex
-
safeOctant
-
addIntersections
Adds EdgeIntersections for one or both intersections found for a segment of an edge to the edge intersection list. -
addIntersection
Add an SegmentNode for intersection intIndex. An intersection that falls exactly on a vertex of the SegmentString is normalized to use the higher of the two possible segmentIndexes -
addIntersection
Adds an intersection node for a given point and segment to this segment string.- Specified by:
addIntersectionin interfaceNodableSegmentString- Parameters:
intPt- the location of the intersectionsegmentIndex- the index of the segment containing the intersection
-
addIntersectionNode
Adds an intersection node for a given point and segment to this segment string. If an intersection already exists for this exact location, the existing node will be returned.- Parameters:
intPt- the location of the intersectionsegmentIndex- the index of the segment containing the intersection- Returns:
- the intersection node for the point
-
toString
-