Class PackedCoordinateSequence
java.lang.Object
org.apache.sis.internal.feature.jts.PackedCoordinateSequence
- All Implemented Interfaces:
Serializable
,Cloneable
,org.locationtech.jts.geom.CoordinateSequence
- Direct Known Subclasses:
PackedCoordinateSequence.Double
,PackedCoordinateSequence.Float
abstract class PackedCoordinateSequence
extends Object
implements org.locationtech.jts.geom.CoordinateSequence, Serializable
A JTS coordinate sequence which stores coordinates in a single
float[]
or double[]
array.
This class serves the same purpose than PackedCoordinateSequence
but without caching the Coordinate[]
array.- Since:
- 1.2
- Version:
- 1.2
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class
Coordinate sequence storing values in a packeddouble[]
array.(package private) static final class
Coordinate sequence storing values in a packedfloat[]
array. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final int
Number of dimensions for this coordinate sequence.private final int
Whether this coordinate sequence has z and/or M coordinate values.private static final int
Bit to set to 1 in thehasZM
mask if this coordinate sequence has z and/or M coordinate values.private static final long
For cross-version compatibility.private static final int
Bit to set to 1 in thehasZM
mask if this coordinate sequence has z and/or M coordinate values.Fields inherited from interface org.locationtech.jts.geom.CoordinateSequence
M, X, Y, Z
-
Constructor Summary
ConstructorsConstructorDescriptionPackedCoordinateSequence
(int dimension, int measures) Creates a new coordinate sequence for the given number of dimensions.Creates a new sequence initialized to a copy of the given sequence. -
Method Summary
Modifier and TypeMethodDescriptionfinal Object
clone()
Deprecated.Inherits the deprecation status from JTS.(package private) abstract double
coordinate
(int index) Returns the coordinate value at the given index in the packed array.boolean
Compares the given object with this sequence for equality.final org.locationtech.jts.geom.Coordinate
getCoordinate
(int index) Returns the coordinate tuple at the given index.final void
getCoordinate
(int index, org.locationtech.jts.geom.Coordinate dest) Copies the coordinate tuple at the given index into the specified target.final org.locationtech.jts.geom.Coordinate
getCoordinateCopy
(int index) Returns the coordinate tuple at given index.final int
Returns the number of dimensions for all coordinates in this sequence, including measures.final double
getM
(int index) Returns the first M coordinate value for the tuple at the given index, orjava.lang.Double.NaN
if this sequence has no M coordinates.final int
Returns the number of M coordinates.final double
getOrdinate
(int index, int dim) Returns a coordinate value from the coordinate tuple at the given index.private static int
getSpatialDimension
(int hasZM) final double
getX
(int index) Returns the x coordinate value for the tuple at the given index.final double
getY
(int index) Returns the y coordinate value for the tuple at the given index.final double
getZ
(int index) Returns the z coordinate value for the tuple at the given index, orjava.lang.Double.NaN
if this sequence has no z coordinates.int
hashCode()
Returns a hash code value for this sequence.final boolean
hasM()
Returns whether this coordinate sequence has M coordinate values.final boolean
hasZ()
Returns whether this coordinate sequence has z coordinate values.(package private) abstract void
setCoordinates
(org.locationtech.jts.geom.Coordinate[] values) Sets all coordinates in this sequence.(package private) void
setCoordinates
(org.locationtech.jts.geom.CoordinateSequence values) Sets all coordinates in this sequence.final org.locationtech.jts.geom.Coordinate[]
Returns a copy of all coordinates in this sequence.final String
toString()
Returns a string representation of this coordinate sequence.Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.locationtech.jts.geom.CoordinateSequence
copy, createCoordinate, expandEnvelope, setOrdinate, size
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
dimension
protected final int dimensionNumber of dimensions for this coordinate sequence.- See Also:
-
hasZM
private final int hasZM -
Z_MASK
private static final int Z_MASKBit to set to 1 in thehasZM
mask if this coordinate sequence has z and/or M coordinate values.- See Also:
-
M_MASK
private static final int M_MASKBit to set to 1 in thehasZM
mask if this coordinate sequence has z and/or M coordinate values.- See Also:
-
-
Constructor Details
-
PackedCoordinateSequence
PackedCoordinateSequence(PackedCoordinateSequence original) Creates a new sequence initialized to a copy of the given sequence. This is for constructors implementing theCoordinateSequence.copy()
method. -
PackedCoordinateSequence
PackedCoordinateSequence(int dimension, int measures) Creates a new coordinate sequence for the given number of dimensions.- Parameters:
dimension
- number of dimensions, including the number of measures.measures
- number of M coordinates.
-
-
Method Details
-
getSpatialDimension
private static int getSpatialDimension(int hasZM) -
getDimension
public final int getDimension()Returns the number of dimensions for all coordinates in this sequence, including measures.- Specified by:
getDimension
in interfaceorg.locationtech.jts.geom.CoordinateSequence
-
getMeasures
public final int getMeasures()Returns the number of M coordinates.- Specified by:
getMeasures
in interfaceorg.locationtech.jts.geom.CoordinateSequence
-
hasZ
public final boolean hasZ()Returns whether this coordinate sequence has z coordinate values.- Specified by:
hasZ
in interfaceorg.locationtech.jts.geom.CoordinateSequence
-
hasM
public final boolean hasM()Returns whether this coordinate sequence has M coordinate values.- Specified by:
hasM
in interfaceorg.locationtech.jts.geom.CoordinateSequence
-
getX
public final double getX(int index) Returns the x coordinate value for the tuple at the given index.- Specified by:
getX
in interfaceorg.locationtech.jts.geom.CoordinateSequence
-
getY
public final double getY(int index) Returns the y coordinate value for the tuple at the given index.- Specified by:
getY
in interfaceorg.locationtech.jts.geom.CoordinateSequence
-
getZ
public final double getZ(int index) Returns the z coordinate value for the tuple at the given index, orjava.lang.Double.NaN
if this sequence has no z coordinates.- Specified by:
getZ
in interfaceorg.locationtech.jts.geom.CoordinateSequence
-
getM
public final double getM(int index) Returns the first M coordinate value for the tuple at the given index, orjava.lang.Double.NaN
if this sequence has no M coordinates.- Specified by:
getM
in interfaceorg.locationtech.jts.geom.CoordinateSequence
-
getCoordinate
public final org.locationtech.jts.geom.Coordinate getCoordinate(int index) Returns the coordinate tuple at the given index.- Specified by:
getCoordinate
in interfaceorg.locationtech.jts.geom.CoordinateSequence
- Parameters:
index
- index of the coordinate tuple.- Returns:
- coordinate tuple at the given index.
- Throws:
ArrayIndexOutOfBoundsException
- if the given index is out of bounds.
-
getCoordinate
public final void getCoordinate(int index, org.locationtech.jts.geom.Coordinate dest) Copies the coordinate tuple at the given index into the specified target.- Specified by:
getCoordinate
in interfaceorg.locationtech.jts.geom.CoordinateSequence
- Parameters:
index
- index of the coordinate tuple.dest
- where to copy the coordinates.- Throws:
ArrayIndexOutOfBoundsException
- if the given index is out of bounds.
-
getCoordinateCopy
public final org.locationtech.jts.geom.Coordinate getCoordinateCopy(int index) Returns the coordinate tuple at given index.- Specified by:
getCoordinateCopy
in interfaceorg.locationtech.jts.geom.CoordinateSequence
- Parameters:
index
- index of the coordinate tuple.- Returns:
- coordinate tuple at the given index.
- Throws:
ArrayIndexOutOfBoundsException
- if the given index is out of bounds.
-
getOrdinate
public final double getOrdinate(int index, int dim) Returns a coordinate value from the coordinate tuple at the given index. For performance reasons, this method does not checkdim
validity.- Specified by:
getOrdinate
in interfaceorg.locationtech.jts.geom.CoordinateSequence
- Parameters:
index
- index of the coordinate tuple.dim
- index of the coordinate value in the tuple.- Returns:
- value of the specified value in the coordinate tuple.
-
coordinate
abstract double coordinate(int index) Returns the coordinate value at the given index in the packed array.- Parameters:
index
- index in the packed array.- Returns:
- coordinate value at the given index.
-
setCoordinates
abstract void setCoordinates(org.locationtech.jts.geom.Coordinate[] values) Sets all coordinates in this sequence. The length of the given array shall be equal toCoordinateSequence.size()
(this is not verified). -
setCoordinates
void setCoordinates(org.locationtech.jts.geom.CoordinateSequence values) Sets all coordinates in this sequence. The size of the given sequence shall be equal toCoordinateSequence.size()
(this is not verified). -
toCoordinateArray
public final org.locationtech.jts.geom.Coordinate[] toCoordinateArray()Returns a copy of all coordinates in this sequence.- Specified by:
toCoordinateArray
in interfaceorg.locationtech.jts.geom.CoordinateSequence
-
toString
Returns a string representation of this coordinate sequence. -
hashCode
public int hashCode()Returns a hash code value for this sequence. -
equals
Compares the given object with this sequence for equality. -
clone
Deprecated.Inherits the deprecation status from JTS.Returns a copy of this sequence.
-