com.vividsolutions.jts.noding

Class SegmentString


public class SegmentString
extends java.lang.Object

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

Constructor Summary

SegmentString(Coordinate[] pts, Object data)
Creates a new segment string from a list of vertices.

Method Summary

void
addIntersection(LineIntersector li, int segmentIndex, int geomIndex, int intIndex)
Add an SegmentNode for intersection intIndex.
void
addIntersection(Coordinate intPt, int segmentIndex)
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)
Coordinate[]
getCoordinates()
Object
getData()
Gets the user-defined data for this segment string.
SegmentNodeList
getNodeList()
static List
getNodedSubstrings(Collection segStrings)
static void
getNodedSubstrings(Collection segStrings, Collection resultEdgelist)
int
getSegmentOctant(int index)
Gets the octant of the segment starting at vertex index.
boolean
isClosed()
void
setData(Object data)
Sets the user-defined data for this segment string.
int
size()

Constructor Details

SegmentString

public SegmentString(Coordinate[] pts,
                     Object data)
Creates a new segment string from a list of vertices.
Parameters:
pts - the vertices of the segment string
data - the user-defined data of this segment string (may be null)

Method Details

addIntersection

public void addIntersection(LineIntersector li,
                            int segmentIndex,
                            int geomIndex,
                            int intIndex)
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

public void addIntersection(Coordinate intPt,
                            int segmentIndex)

addIntersections

public 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.

getCoordinate

public Coordinate getCoordinate(int i)

getCoordinates

public Coordinate[] getCoordinates()

getData

public Object getData()
Gets the user-defined data for this segment string.
Returns:
the user-defined data

getNodeList

public SegmentNodeList getNodeList()

getNodedSubstrings

public static List getNodedSubstrings(Collection segStrings)

getNodedSubstrings

public static void getNodedSubstrings(Collection segStrings,
                                      Collection resultEdgelist)

getSegmentOctant

public int getSegmentOctant(int index)
Gets the octant of the segment starting at vertex index.
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

isClosed

public boolean isClosed()

setData

public void setData(Object data)
Sets the user-defined data for this segment string.
Parameters:
data - an Object containing user-defined data

size

public int size()