Package org.geolatte.geom
Class LineString<P extends Position>
- java.lang.Object
-
- org.geolatte.geom.Geometry<P>
-
- org.geolatte.geom.LineString<P>
-
- All Implemented Interfaces:
Serializable,Linear<P>,Simple
- Direct Known Subclasses:
LinearRing
public class LineString<P extends Position> extends Geometry<P> implements Linear<P>, Simple
A LineString is a 1-dimensionalGeometryconsisting of theLineSegments defined by consecutive pairs ofPoints of aPointSequence.- Author:
- Karel Maesen, Geovise BVBA, 2011
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description LineString(CoordinateReferenceSystem<P> crs)protectedLineString(LineString<P> base)This constructor has been added to speed up object creation of LinearRingsLineString(PositionSequence<P> positions, CoordinateReferenceSystem<P> crs)Constructs aLineStringfrom the specified positions andProjectedGeometryOperationsimplementation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(GeometryVisitor<P> visitor)Accepts aGeometryVisitor.<Q extends Position>
LineString<Q>as(Class<Q> castToType)intgetDimension()Returns the topological dimension of this instance.PgetEndPosition()Returns the lastPositionof thisLineString.GeometryTypegetGeometryType()Returns the type of thisGeometry.PgetStartPosition()Returns the firstPositionof thisLineString.booleanisClosed()Checks whether thisLineStringis closed, i.e.booleanisRing()Checks whether thisLineStringis a ring, i.e.-
Methods inherited from class org.geolatte.geom.Geometry
checkCast, equals, forceToCrs, getCoordinateDimension, getCoordinateReferenceSystem, getCrs, getEnvelope, getNumPositions, getPositionClass, getPositionN, getPositions, getSRID, hashCode, isEmpty, nestPositionSequences, toString, writeReplace
-
-
-
-
Constructor Detail
-
LineString
public LineString(CoordinateReferenceSystem<P> crs)
-
LineString
protected LineString(LineString<P> base)
This constructor has been added to speed up object creation of LinearRings- Parameters:
base-
-
LineString
public LineString(PositionSequence<P> positions, CoordinateReferenceSystem<P> crs)
Constructs aLineStringfrom the specified positions andProjectedGeometryOperationsimplementation.- Parameters:
positions- thePositionSequencethat determines this geometry- Throws:
IllegalArgumentException- if the passedPointSequenceis non-empty and of size < 2
-
-
Method Detail
-
getStartPosition
public P getStartPosition()
Returns the firstPositionof thisLineString.- Specified by:
getStartPositionin interfaceLinear<P extends Position>- Returns:
- the first
Positionof thisLineString.
-
getEndPosition
public P getEndPosition()
Returns the lastPositionof thisLineString.- Specified by:
getEndPositionin interfaceLinear<P extends Position>- Returns:
- the last
Positionof thisLineString.
-
isClosed
public boolean isClosed()
Checks whether thisLineStringis closed, i.e. the firstPointequals the last.- Returns:
- true if this
LineStringis closed.
-
isRing
public boolean isRing()
Checks whether thisLineStringis a ring, i.e. is closed and non-empty.Note that this implementation allows rings thate are non-simple.
- Returns:
- true if this
LineStringis a ring.
-
getDimension
public int getDimension()
Description copied from class:GeometryReturns the topological dimension of this instance. In non-homogenous collections, this will return the largest topological dimension of the containedGeometries.- Specified by:
getDimensionin classGeometry<P extends Position>- Returns:
- the topological dimension of this instance
-
getGeometryType
public GeometryType getGeometryType()
Description copied from class:GeometryReturns the type of thisGeometry.- Specified by:
getGeometryTypein classGeometry<P extends Position>- Returns:
- the
GeometryTypeof this instance.
-
accept
public void accept(GeometryVisitor<P> visitor)
Description copied from class:GeometryAccepts aGeometryVisitor.If this
Geometryinstance is aGeometryCollectionthen it will pass the visitor to its containedGeometries.
-
-