Package io.github.sebasbaumh.postgis
Class CompoundCurve
- java.lang.Object
-
- io.github.sebasbaumh.postgis.Geometry
-
- io.github.sebasbaumh.postgis.Curve
-
- io.github.sebasbaumh.postgis.CompoundCurve
-
- All Implemented Interfaces:
LineBasedGeometry
,java.io.Serializable
,java.lang.Iterable<LineString>
@NonNullByDefault public class CompoundCurve extends Curve implements java.lang.Iterable<LineString>
A compound curve is a single, continuous curve that has both curved (circular) segments and linear segments. That means that in addition to having well-formed components, the end point of every component (except the last) must be coincident with the start point of the following component. Just note: here it is treated as a specialMultiCurve
where the end points of all contained lines match.- Author:
- Sebastian Baumhekel
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
TYPE
The OGIS geometry type number for single, continuous curves that have both curved (circular) segments and linear segments.-
Fields inherited from class io.github.sebasbaumh.postgis.Geometry
UNKNOWN_SRID
-
-
Constructor Summary
Constructors Constructor Description CompoundCurve()
Constructs an instance.CompoundCurve(java.lang.Iterable<? extends LineString> geoms)
Constructs an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(LineString geom)
Adds a geometry.void
addAll(java.lang.Iterable<? extends LineString> geoms)
Adds all given geometries.boolean
checkConsistency()
Do some internal consistency checks on the geometry.void
close()
Closes thisCurve
if the last coordinate is not already the same as the first coordinate.boolean
equals(java.lang.Object other)
java.lang.Object equals implementationjava.lang.Iterable<Point>
getCoordinates()
Gets the coordinates of thisGeometry
.Point
getEndPoint()
Gets the end point.java.util.Collection<LineString>
getGeometries()
Gets all geometries.int
getNumberOfCoordinates()
Gets the number of coordinates of thisGeometry
.Point
getStartPoint()
Gets the start point.int
hashCode()
boolean
hasMeasure()
Returns whether we have a measure (4th dimension)boolean
is3d()
Checks if thisGeometry
is 3d.boolean
isEmpty()
Checks, if there are no sub-geometries.java.util.Iterator<LineString>
iterator()
double
length()
Gets the length of this line.void
reverse()
Reverses this linestring.void
setSrid(int srid)
Recursively sets the srid on this geometry and all contained subgeometriesint
size()
Gets the number of contained geometries.-
Methods inherited from class io.github.sebasbaumh.postgis.Curve
isClockwise, isClosed
-
Methods inherited from class io.github.sebasbaumh.postgis.Geometry
getDimension, getSrid, getType, numPoints
-
-
-
-
Field Detail
-
TYPE
public static final int TYPE
The OGIS geometry type number for single, continuous curves that have both curved (circular) segments and linear segments.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CompoundCurve
public CompoundCurve()
Constructs an instance.
-
CompoundCurve
public CompoundCurve(java.lang.Iterable<? extends LineString> geoms)
Constructs an instance.- Parameters:
geoms
- geometries
-
-
Method Detail
-
add
public void add(LineString geom)
Adds a geometry.- Parameters:
geom
- geometry
-
addAll
public final void addAll(java.lang.Iterable<? extends LineString> geoms)
Adds all given geometries.- Parameters:
geoms
- geometries
-
checkConsistency
public boolean checkConsistency()
Description copied from class:Geometry
Do some internal consistency checks on the geometry. Currently, all Geometries must have a valid dimension (2 or 3) and a valid type. Composed geometries must have all equal SRID, dimensionality and measures, as well as that they do not contain NULL or inconsistent subgeometries. BinaryParser and WKTParser should only generate consistent geometries. BinaryWriter may produce invalid results on inconsistent geometries.- Overrides:
checkConsistency
in classGeometry
- Returns:
- true if all checks are passed.
-
close
public void close()
Closes thisCurve
if the last coordinate is not already the same as the first coordinate.
-
equals
public boolean equals(@Nullable java.lang.Object other)
Description copied from class:Geometry
java.lang.Object equals implementation
-
getCoordinates
public java.lang.Iterable<Point> getCoordinates()
Description copied from class:Geometry
Gets the coordinates of thisGeometry
.- Specified by:
getCoordinates
in classGeometry
- Returns:
- coordinates
-
getEndPoint
@Nullable public Point getEndPoint()
Description copied from interface:LineBasedGeometry
Gets the end point.- Specified by:
getEndPoint
in interfaceLineBasedGeometry
- Returns:
Point
on success, else null
-
getGeometries
public java.util.Collection<LineString> getGeometries()
Gets all geometries.- Returns:
- geometries
-
getNumberOfCoordinates
public int getNumberOfCoordinates()
Description copied from class:Geometry
Gets the number of coordinates of thisGeometry
.- Specified by:
getNumberOfCoordinates
in classGeometry
- Returns:
- number of coordinates
-
getStartPoint
@Nullable public Point getStartPoint()
Description copied from interface:LineBasedGeometry
Gets the start point.- Specified by:
getStartPoint
in interfaceLineBasedGeometry
- Returns:
Point
on success, else null
-
hasMeasure
public boolean hasMeasure()
Description copied from class:Geometry
Returns whether we have a measure (4th dimension)- Specified by:
hasMeasure
in classGeometry
- Returns:
- true if the geometry has a measure, false otherwise
-
isEmpty
public boolean isEmpty()
Checks, if there are no sub-geometries.
-
iterator
public java.util.Iterator<LineString> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<LineString>
-
length
public double length()
Description copied from interface:LineBasedGeometry
Gets the length of this line.- Specified by:
length
in interfaceLineBasedGeometry
- Returns:
- length
-
reverse
public void reverse()
Description copied from class:Curve
Reverses this linestring.
-
setSrid
public void setSrid(int srid)
Description copied from class:Geometry
Recursively sets the srid on this geometry and all contained subgeometries
-
size
public int size()
Gets the number of contained geometries.- Returns:
- number of contained geometries
-
-