Class BasicSegmentString
java.lang.Object
org.locationtech.jts.noding.BasicSegmentString
- All Implemented Interfaces:
SegmentString
Represents a read-only list of contiguous line segments.
This can be used for detection of intersections or nodes.
SegmentStrings can carry a context object, which is useful
for preserving topological or parentage information.
If adding nodes is required use NodedSegmentString.
- Version:
- 1.7
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionBasicSegmentString(Coordinate[] pts, Object data) Creates a new segment string from a list of vertices. -
Method Summary
Modifier and TypeMethodDescriptiongetCoordinate(int i) Gets the segment string coordinate at a given index.Gets the coordinates in this segment string.getData()Gets the user-defined data for this segment string.intgetSegmentOctant(int index) Gets the octant of the segment starting at vertexindex.booleanisClosed()Tests if a segment string is a closed ring.voidSets the user-defined data for this segment string.intsize()Gets the number of coordinates in this segment string.toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface SegmentString
nextInRing, prevInRing
-
Constructor Details
-
BasicSegmentString
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
-
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
-
size
public int size()Description copied from interface:SegmentStringGets the number of coordinates in this segment string.- Specified by:
sizein interfaceSegmentString- Returns:
- the number of coordinates
-
getCoordinate
Description copied from interface:SegmentStringGets the segment string coordinate at a given index.- Specified by:
getCoordinatein interfaceSegmentString- Parameters:
i- the coordinate index- Returns:
- the coordinate at the index
-
getCoordinates
Description copied from interface:SegmentStringGets the coordinates in this segment string.- Specified by:
getCoordinatesin interfaceSegmentString- Returns:
- the coordinates as an array
-
isClosed
public boolean isClosed()Description copied from interface:SegmentStringTests if a segment string is a closed ring.- Specified by:
isClosedin interfaceSegmentString- Returns:
- true if the segment string is closed
-
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
-
toString
-