Package org.locationtech.jts.noding
Class BasicSegmentString
- java.lang.Object
-
- org.locationtech.jts.noding.BasicSegmentString
-
- All Implemented Interfaces:
SegmentString
public class BasicSegmentString extends Object implements SegmentString
Represents a read-only list of contiguous line segments. This can be used for detection of intersections or nodes.SegmentString
s 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:
NodedSegmentString
-
-
Constructor Summary
Constructors Constructor Description BasicSegmentString(Coordinate[] pts, Object data)
Creates a new segment string from a list of vertices.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.int
getSegmentOctant(int index)
Gets the octant of the segment starting at vertexindex
.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()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.locationtech.jts.noding.SegmentString
nextInRing, prevInRing
-
-
-
-
Constructor Detail
-
BasicSegmentString
public BasicSegmentString(Coordinate[] pts, Object data)
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 Detail
-
getData
public Object getData()
Gets the user-defined data for this segment string.- Specified by:
getData
in interfaceSegmentString
- Returns:
- the user-defined data
-
setData
public void setData(Object data)
Sets the user-defined data for this segment string.- Specified by:
setData
in interfaceSegmentString
- Parameters:
data
- an Object containing user-defined data
-
size
public int size()
Description copied from interface:SegmentString
Gets the number of coordinates in this segment string.- Specified by:
size
in interfaceSegmentString
- Returns:
- the number of coordinates
-
getCoordinate
public Coordinate getCoordinate(int i)
Description copied from interface:SegmentString
Gets the segment string coordinate at a given index.- Specified by:
getCoordinate
in interfaceSegmentString
- Parameters:
i
- the coordinate index- Returns:
- the coordinate at the index
-
getCoordinates
public Coordinate[] getCoordinates()
Description copied from interface:SegmentString
Gets the coordinates in this segment string.- Specified by:
getCoordinates
in interfaceSegmentString
- Returns:
- the coordinates as an array
-
isClosed
public boolean isClosed()
Description copied from interface:SegmentString
Tests if a segment string is a closed ring.- Specified by:
isClosed
in 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
-
-