Package org.locationtech.jts.geom.impl
Class PackedCoordinateSequenceFactory
- java.lang.Object
-
- org.locationtech.jts.geom.impl.PackedCoordinateSequenceFactory
-
- All Implemented Interfaces:
java.io.Serializable
,CoordinateSequenceFactory
public class PackedCoordinateSequenceFactory extends java.lang.Object implements CoordinateSequenceFactory, java.io.Serializable
Builds packed array coordinate sequences. The array data type can be either double or float, and defaults to float.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static int
DOUBLE
static PackedCoordinateSequenceFactory
DOUBLE_FACTORY
static int
FLOAT
static PackedCoordinateSequenceFactory
FLOAT_FACTORY
-
Constructor Summary
Constructors Constructor Description PackedCoordinateSequenceFactory()
Creates a new PackedCoordinateSequenceFactory of type DOUBLE.PackedCoordinateSequenceFactory(int type)
Creates a new PackedCoordinateSequenceFactory of the given type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CoordinateSequence
create(double[] packedCoordinates, int dimension)
Create a packed coordinate sequence from the provided array.CoordinateSequence
create(double[] packedCoordinates, int dimension, int measures)
Create a packed coordinate sequence from the provided array.CoordinateSequence
create(float[] packedCoordinates, int dimension)
Create a packed coordinate sequence from the provided array.CoordinateSequence
create(float[] packedCoordinates, int dimension, int measures)
CoordinateSequence
create(int size, int dimension)
Creates aCoordinateSequence
of the specified size and dimension.CoordinateSequence
create(int size, int dimension, int measures)
Creates aCoordinateSequence
of the specified size and dimension with measure support.CoordinateSequence
create(Coordinate[] coordinates)
Returns aCoordinateSequence
based on the given array.CoordinateSequence
create(CoordinateSequence coordSeq)
Creates aCoordinateSequence
which is a copy of the givenCoordinateSequence
.int
getType()
Returns the type of packed coordinate sequences this factory builds, either PackedCoordinateSequenceFactory#Float or PackedCoordinateSequenceFactory#Double
-
-
-
Field Detail
-
DOUBLE
public static final int DOUBLE
- See Also:
- Constant Field Values
-
FLOAT
public static final int FLOAT
- See Also:
- Constant Field Values
-
DOUBLE_FACTORY
public static final PackedCoordinateSequenceFactory DOUBLE_FACTORY
-
FLOAT_FACTORY
public static final PackedCoordinateSequenceFactory FLOAT_FACTORY
-
-
Constructor Detail
-
PackedCoordinateSequenceFactory
public PackedCoordinateSequenceFactory()
Creates a new PackedCoordinateSequenceFactory of type DOUBLE.
-
PackedCoordinateSequenceFactory
public PackedCoordinateSequenceFactory(int type)
Creates a new PackedCoordinateSequenceFactory of the given type. Acceptable type values are PackedCoordinateSequenceFactory#Floator PackedCoordinateSequenceFactory#Double
-
-
Method Detail
-
getType
public int getType()
Returns the type of packed coordinate sequences this factory builds, either PackedCoordinateSequenceFactory#Float or PackedCoordinateSequenceFactory#Double
-
create
public CoordinateSequence create(Coordinate[] coordinates)
Description copied from interface:CoordinateSequenceFactory
Returns aCoordinateSequence
based on the given array. Whether the array is copied or simply referenced is implementation-dependent. This method must handle null arguments by creating an empty sequence.- Specified by:
create
in interfaceCoordinateSequenceFactory
- Parameters:
coordinates
- the coordinates- See Also:
CoordinateSequenceFactory.create(org.locationtech.jts.geom.Coordinate[])
-
create
public CoordinateSequence create(CoordinateSequence coordSeq)
Description copied from interface:CoordinateSequenceFactory
Creates aCoordinateSequence
which is a copy of the givenCoordinateSequence
. This method must handle null arguments by creating an empty sequence.- Specified by:
create
in interfaceCoordinateSequenceFactory
- Parameters:
coordSeq
- the coordinate sequence to copy- See Also:
CoordinateSequenceFactory.create(org.locationtech.jts.geom.CoordinateSequence)
-
create
public CoordinateSequence create(double[] packedCoordinates, int dimension)
Create a packed coordinate sequence from the provided array.- Parameters:
packedCoordinates
-dimension
-- Returns:
- Packaged coordinate seqeunce of the requested type
-
create
public CoordinateSequence create(double[] packedCoordinates, int dimension, int measures)
Create a packed coordinate sequence from the provided array.- Parameters:
packedCoordinates
-dimension
-measures
-- Returns:
- Packaged coordinate seqeunce of the requested type
-
create
public CoordinateSequence create(float[] packedCoordinates, int dimension)
Create a packed coordinate sequence from the provided array.- Parameters:
packedCoordinates
-dimension
-- Returns:
- Packaged coordinate seqeunce of the requested type
-
create
public CoordinateSequence create(float[] packedCoordinates, int dimension, int measures)
- Parameters:
packedCoordinates
-dimension
-measures
-- Returns:
- Packaged coordinate seqeunce of the requested type
-
create
public CoordinateSequence create(int size, int dimension)
Description copied from interface:CoordinateSequenceFactory
Creates aCoordinateSequence
of the specified size and dimension. For this to be useful, theCoordinateSequence
implementation must be mutable.If the requested dimension is larger than the CoordinateSequence implementation can provide, then a sequence of maximum possible dimension should be created. An error should not be thrown.
- Specified by:
create
in interfaceCoordinateSequenceFactory
- Parameters:
size
- the number of coordinates in the sequencedimension
- the dimension of the coordinates in the sequence (if user-specifiable, otherwise ignored)- See Also:
CoordinateSequenceFactory.create(int, int)
-
create
public CoordinateSequence create(int size, int dimension, int measures)
Description copied from interface:CoordinateSequenceFactory
Creates aCoordinateSequence
of the specified size and dimension with measure support. For this to be useful, theCoordinateSequence
implementation must be mutable.If the requested dimension or measures are larger than the CoordinateSequence implementation can provide, then a sequence of maximum possible dimension should be created. An error should not be thrown.
- Specified by:
create
in interfaceCoordinateSequenceFactory
- Parameters:
size
- the number of coordinates in the sequencedimension
- the dimension of the coordinates in the sequence (if user-specifiable, otherwise ignored)measures
- the number of measures of the coordinates in the sequence (if user-specifiable, otherwise ignored)- See Also:
CoordinateSequenceFactory.create(int, int, int)
-
-