public class Polyline extends CompositeCurve implements AutoCloseable
GeometryFactory#createPolyline
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
finalize() |
LineInterpolationType |
getInterpolationType()
Returns the interpolation type of the line segment.
|
Coordinate |
getPoint(long index)
Returns the coordinate for the requested index.
|
long |
getPointCount()
Returns the number of points in the polyline.
|
List<Coordinate> |
getPoints()
Returns the list of points of this polyline.
|
Polyline |
insertPoint(long index,
Coordinate newLocation)
Creates a new
Polyline with an newly inserted control point. |
Polyline |
movePoint(long index,
Coordinate newLocation)
Creates a new
Polyline with a moved control point. |
Polyline |
removePoint(long index)
Creates a new
Polyline with a control point removed. |
Polyline |
translate(Coordinate translation)
Translates the entire polyline.
|
getCurveAt, getCurveCount
computePoint, getLength2D
getBounds, getReference
protected void finalize()
finalize
in class CompositeCurve
public void close()
close
in interface AutoCloseable
close
in class CompositeCurve
public long getPointCount()
@NotNull public Coordinate getPoint(long index) throws IllegalArgumentException
index
- the index of the requested point.IllegalArgumentException
- when requesting an invalid index.@NotNull public List<Coordinate> getPoints()
@NotNull public LineInterpolationType getInterpolationType()
One of
@NotNull public Polyline translate(@NotNull Coordinate translation)
Note: when the polyline is defined in a geodetic reference and uses geodetic interpolation, the translation is not performed by translating the points one by one. Instead, a translation method is used that better preserves the shape of the polyline when moving it towards (or away from) the poles.
translation
- the translation vector@NotNull public Polyline movePoint(long index, @NotNull Coordinate newLocation) throws IllegalArgumentException
Polyline
with a moved control point.index
- the index of the point to move. Should be in [0, getPointCount()
- 1]
.newLocation
- the new location of the pointIllegalArgumentException
- for an invalid index@NotNull public Polyline insertPoint(long index, @NotNull Coordinate newLocation) throws IllegalArgumentException
Polyline
with an newly inserted control point.index
- the index of the newly inserted control point. Should be in [0, getPointCount()
]
. For index 0, a new point will be added at the start of the Polyline
. For index getPointCount()
, a new point will be added at the end of the Polyline
. For other index values, a point will be added between 2 other points.newLocation
- the location of the new pointIllegalArgumentException
- for an invalid index@NotNull public Polyline removePoint(long index) throws IllegalArgumentException
Polyline
with a control point removed.
This methods returns a copy of the polyline if its point count is less or equal to 2.
index
- the index of the point to be removed. Should be in [0, getPointCount()
- 1]
.IllegalArgumentException
- for an invalid index