public class NodedSegmentString extends Object implements NodableSegmentString
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.
For read-only applications use BasicSegmentString,
which is (slightly) more lightweight.
BasicSegmentString| Constructor and Description |
|---|
NodedSegmentString(Coordinate[] pts,
Object data)
Creates a instance from a list of vertices and optional data object.
|
NodedSegmentString(SegmentString ss)
Creates a new instance from a
SegmentString. |
| Modifier and Type | Method and Description |
|---|---|
void |
addIntersection(Coordinate intPt,
int segmentIndex)
Adds an intersection node for a given point and segment to this segment string.
|
void |
addIntersection(LineIntersector li,
int segmentIndex,
int geomIndex,
int intIndex)
Add an SegmentNode for intersection intIndex.
|
SegmentNode |
addIntersectionNode(Coordinate intPt,
int segmentIndex)
Adds an intersection node for a given point and segment to this segment string.
|
void |
addIntersections(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.
|
Coordinate |
getCoordinate(int i)
Gets the segment string coordinate at a given index.
|
Coordinate[] |
getCoordinates()
Gets the coordinates in this segment string.
|
Object |
getData()
Gets the user-defined data for this segment string.
|
Coordinate[] |
getNodedCoordinates()
Gets a list of coordinates with all nodes included.
|
static List |
getNodedSubstrings(Collection segStrings)
Gets the
SegmentStrings which result from splitting this string at node points. |
static void |
getNodedSubstrings(Collection segStrings,
Collection resultEdgelist)
Adds the noded
SegmentStrings which result from splitting this string at node points. |
SegmentNodeList |
getNodeList() |
int |
getSegmentOctant(int index)
Gets the octant of the segment starting at vertex
index. |
boolean |
hasNodes()
Tests whether any nodes have been added.
|
boolean |
isClosed()
Tests if a segment string is a closed ring.
|
void |
setData(Object data)
Sets the user-defined data for this segment string.
|
int |
size()
Gets the number of coordinates in this segment string.
|
String |
toString() |
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitnextInRing, prevInRingpublic NodedSegmentString(Coordinate[] pts, Object data)
pts - the vertices of the segment stringdata - the user-defined data of this segment string (may be null)public NodedSegmentString(SegmentString ss)
SegmentString.ss - the segment string to usepublic static List getNodedSubstrings(Collection segStrings)
SegmentStrings which result from splitting this string at node points.segStrings - a Collection of NodedSegmentStringspublic static void getNodedSubstrings(Collection segStrings, Collection resultEdgelist)
SegmentStrings which result from splitting this string at node points.segStrings - a Collection of NodedSegmentStringsresultEdgelist - a List which will collect the NodedSegmentStrings representing the substringspublic Object getData()
getData in interface SegmentStringpublic void setData(Object data)
setData in interface SegmentStringdata - an Object containing user-defined datapublic SegmentNodeList getNodeList()
public int size()
SegmentStringsize in interface SegmentStringpublic Coordinate getCoordinate(int i)
SegmentStringgetCoordinate in interface SegmentStringi - the coordinate indexpublic Coordinate[] getCoordinates()
SegmentStringgetCoordinates in interface SegmentStringpublic Coordinate[] getNodedCoordinates()
public boolean isClosed()
SegmentStringisClosed in interface SegmentStringpublic boolean hasNodes()
public int getSegmentOctant(int index)
index.index - the index of the vertex starting the segment. Must not be
the last index in the vertex listpublic void addIntersections(LineIntersector li, int segmentIndex, int geomIndex)
public void addIntersection(LineIntersector li, int segmentIndex, int geomIndex, int intIndex)
public void addIntersection(Coordinate intPt, int segmentIndex)
addIntersection in interface NodableSegmentStringintPt - the location of the intersectionsegmentIndex - the index of the segment containing the intersectionpublic SegmentNode addIntersectionNode(Coordinate intPt, int segmentIndex)
intPt - the location of the intersectionsegmentIndex - the index of the segment containing the intersectionCopyright © 2024. All rights reserved.