com.vividsolutions.jts.noding
Class BasicSegmentString

java.lang.Object
  extended by com.vividsolutions.jts.noding.BasicSegmentString
All Implemented Interfaces:
SegmentString

public class BasicSegmentString
extends java.lang.Object
implements 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

Constructor Summary
BasicSegmentString(Coordinate[] pts, java.lang.Object data)
          Creates a new segment string from a list of vertices.
 
Method Summary
 Coordinate getCoordinate(int i)
           
 Coordinate[] getCoordinates()
           
 java.lang.Object getData()
          Gets the user-defined data for this segment string.
 int getSegmentOctant(int index)
          Gets the octant of the segment starting at vertex index.
 boolean isClosed()
           
 void setData(java.lang.Object data)
          Sets the user-defined data for this segment string.
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicSegmentString

public BasicSegmentString(Coordinate[] pts,
                          java.lang.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 Detail

getData

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

Specified by:
getData in interface SegmentString
Returns:
the user-defined data

setData

public void setData(java.lang.Object data)
Sets the user-defined data for this segment string.

Specified by:
setData in interface SegmentString
Parameters:
data - an Object containing user-defined data

size

public int size()
Specified by:
size in interface SegmentString

getCoordinate

public Coordinate getCoordinate(int i)
Specified by:
getCoordinate in interface SegmentString

getCoordinates

public Coordinate[] getCoordinates()
Specified by:
getCoordinates in interface SegmentString

isClosed

public boolean isClosed()
Specified by:
isClosed in interface SegmentString

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