Package org.locationtech.jts.noding
Class BasicSegmentString
- java.lang.Object
-
- org.locationtech.jts.noding.BasicSegmentString
-
- All Implemented Interfaces:
SegmentString
public class BasicSegmentString extends java.lang.Object implements 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:
NodedSegmentString
-
-
Constructor Summary
Constructors Constructor Description BasicSegmentString(Coordinate[] pts, java.lang.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 CoordinategetCoordinate(int i)Coordinate[]getCoordinates()java.lang.ObjectgetData()Gets the user-defined data for this segment string.intgetSegmentOctant(int index)Gets the octant of the segment starting at vertexindex.booleanisClosed()voidsetData(java.lang.Object data)Sets the user-defined data for this segment string.intsize()java.lang.StringtoString()
-
-
-
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 stringdata- 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:
getDatain interfaceSegmentString- Returns:
- the user-defined data
-
setData
public void setData(java.lang.Object data)
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()
- Specified by:
sizein interfaceSegmentString
-
getCoordinate
public Coordinate getCoordinate(int i)
- Specified by:
getCoordinatein interfaceSegmentString
-
getCoordinates
public Coordinate[] getCoordinates()
- Specified by:
getCoordinatesin interfaceSegmentString
-
isClosed
public boolean isClosed()
- Specified by:
isClosedin interfaceSegmentString
-
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
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-