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 classCoordinate sequence storing values in a packeddouble[]array.(package private) static final classCoordinate sequence storing values in a packedfloat[]array. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final intNumber of dimensions for this coordinate sequence.private final intWhether this coordinate sequence has z and/or M coordinate values.private static final intBit to set to 1 in thehasZMmask if this coordinate sequence has z and/or M coordinate values.private static final longFor cross-version compatibility.private static final intBit to set to 1 in thehasZMmask 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 Objectclone()Deprecated.Inherits the deprecation status from JTS.(package private) abstract doublecoordinate(int index) Returns the coordinate value at the given index in the packed array.booleanCompares the given object with this sequence for equality.final org.locationtech.jts.geom.CoordinategetCoordinate(int index) Returns the coordinate tuple at the given index.final voidgetCoordinate(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.CoordinategetCoordinateCopy(int index) Returns the coordinate tuple at given index.final intReturns the number of dimensions for all coordinates in this sequence, including measures.final doublegetM(int index) Returns the first M coordinate value for the tuple at the given index, orjava.lang.Double.NaNif this sequence has no M coordinates.final intReturns the number of M coordinates.final doublegetOrdinate(int index, int dim) Returns a coordinate value from the coordinate tuple at the given index.private static intgetSpatialDimension(int hasZM) final doublegetX(int index) Returns the x coordinate value for the tuple at the given index.final doublegetY(int index) Returns the y coordinate value for the tuple at the given index.final doublegetZ(int index) Returns the z coordinate value for the tuple at the given index, orjava.lang.Double.NaNif this sequence has no z coordinates.inthashCode()Returns a hash code value for this sequence.final booleanhasM()Returns whether this coordinate sequence has M coordinate values.final booleanhasZ()Returns whether this coordinate sequence has z coordinate values.(package private) abstract voidsetCoordinates(org.locationtech.jts.geom.Coordinate[] values) Sets all coordinates in this sequence.(package private) voidsetCoordinates(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 StringtoString()Returns a string representation of this coordinate sequence.Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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 thehasZMmask 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 thehasZMmask 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:
getDimensionin interfaceorg.locationtech.jts.geom.CoordinateSequence
-
getMeasures
public final int getMeasures()Returns the number of M coordinates.- Specified by:
getMeasuresin interfaceorg.locationtech.jts.geom.CoordinateSequence
-
hasZ
public final boolean hasZ()Returns whether this coordinate sequence has z coordinate values.- Specified by:
hasZin interfaceorg.locationtech.jts.geom.CoordinateSequence
-
hasM
public final boolean hasM()Returns whether this coordinate sequence has M coordinate values.- Specified by:
hasMin 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:
getXin 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:
getYin 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.NaNif this sequence has no z coordinates.- Specified by:
getZin 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.NaNif this sequence has no M coordinates.- Specified by:
getMin 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:
getCoordinatein 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:
getCoordinatein 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:
getCoordinateCopyin 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 checkdimvalidity.- Specified by:
getOrdinatein 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:
toCoordinateArrayin 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.
-