Package org.locationtech.jts.geom.impl
Class PackedCoordinateSequenceFactory
- java.lang.Object
-
- org.locationtech.jts.geom.impl.PackedCoordinateSequenceFactory
-
- All Implemented Interfaces:
Serializable,CoordinateSequenceFactory
public class PackedCoordinateSequenceFactory extends Object implements CoordinateSequenceFactory, Serializable
Builds packed array coordinate sequences. The array data type can be eitherdoubleorfloat, and defaults todouble.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intDOUBLEType code for arrays of typedouble.static PackedCoordinateSequenceFactoryDOUBLE_FACTORYA factory using array typeDOUBLEstatic intFLOATType code for arrays of typefloat.static PackedCoordinateSequenceFactoryFLOAT_FACTORYA factory using array typeFLOAT
-
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 CoordinateSequencecreate(double[] packedCoordinates, int dimension)Creates a packed coordinate sequence of typeDOUBLEfrom the provided array using the given coordinate dimension and a measure count of 0.CoordinateSequencecreate(double[] packedCoordinates, int dimension, int measures)Creates a packed coordinate sequence of typeDOUBLEfrom the provided array using the given coordinate dimension and measure count.CoordinateSequencecreate(float[] packedCoordinates, int dimension)Creates a packed coordinate sequence of typeFLOATfrom the provided array.CoordinateSequencecreate(float[] packedCoordinates, int dimension, int measures)Creates a packed coordinate sequence of typeFLOATfrom the provided array.CoordinateSequencecreate(int size, int dimension)Creates aCoordinateSequenceof the specified size and dimension.CoordinateSequencecreate(int size, int dimension, int measures)Creates aCoordinateSequenceof the specified size and dimension with measure support.CoordinateSequencecreate(Coordinate[] coordinates)Returns aCoordinateSequencebased on the given array.CoordinateSequencecreate(CoordinateSequence coordSeq)Creates aCoordinateSequencewhich is a copy of the givenCoordinateSequence.intgetType()
-
-
-
Field Detail
-
DOUBLE
public static final int DOUBLE
Type code for arrays of typedouble.- See Also:
- Constant Field Values
-
FLOAT
public static final int FLOAT
Type code for arrays of typefloat.- See Also:
- Constant Field Values
-
DOUBLE_FACTORY
public static final PackedCoordinateSequenceFactory DOUBLE_FACTORY
A factory using array typeDOUBLE
-
FLOAT_FACTORY
public static final PackedCoordinateSequenceFactory FLOAT_FACTORY
A factory using array typeFLOAT
-
-
Method Detail
-
getType
public int getType()
- Returns:
- the type of packed array built
-
create
public CoordinateSequence create(Coordinate[] coordinates)
Description copied from interface:CoordinateSequenceFactoryReturns aCoordinateSequencebased 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:
createin interfaceCoordinateSequenceFactory- Parameters:
coordinates- the coordinates- See Also:
CoordinateSequenceFactory.create(Coordinate[])
-
create
public CoordinateSequence create(CoordinateSequence coordSeq)
Description copied from interface:CoordinateSequenceFactoryCreates aCoordinateSequencewhich is a copy of the givenCoordinateSequence. This method must handle null arguments by creating an empty sequence.- Specified by:
createin interfaceCoordinateSequenceFactory- Parameters:
coordSeq- the coordinate sequence to copy- See Also:
CoordinateSequenceFactory.create(CoordinateSequence)
-
create
public CoordinateSequence create(double[] packedCoordinates, int dimension)
Creates a packed coordinate sequence of typeDOUBLEfrom the provided array using the given coordinate dimension and a measure count of 0.- Parameters:
packedCoordinates- the array containing coordinate valuesdimension- the coordinate dimension- Returns:
- a packed coordinate sequence of type
DOUBLE
-
create
public CoordinateSequence create(double[] packedCoordinates, int dimension, int measures)
Creates a packed coordinate sequence of typeDOUBLEfrom the provided array using the given coordinate dimension and measure count.- Parameters:
packedCoordinates- the array containing coordinate valuesdimension- the coordinate dimensionmeasures- the coordinate measure count- Returns:
- a packed coordinate sequence of type
DOUBLE
-
create
public CoordinateSequence create(float[] packedCoordinates, int dimension)
Creates a packed coordinate sequence of typeFLOATfrom the provided array.- Parameters:
packedCoordinates- the array containing coordinate valuesdimension- the coordinate dimension- Returns:
- a packed coordinate sequence of type
FLOAT
-
create
public CoordinateSequence create(float[] packedCoordinates, int dimension, int measures)
Creates a packed coordinate sequence of typeFLOATfrom the provided array.- Parameters:
packedCoordinates- the array containing coordinate valuesdimension- the coordinate dimensionmeasures- the coordinate measure count- Returns:
- a packed coordinate sequence of type
FLOAT
-
create
public CoordinateSequence create(int size, int dimension)
Description copied from interface:CoordinateSequenceFactoryCreates aCoordinateSequenceof the specified size and dimension. For this to be useful, theCoordinateSequenceimplementation 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:
createin 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:CoordinateSequenceFactoryCreates aCoordinateSequenceof the specified size and dimension with measure support. For this to be useful, theCoordinateSequenceimplementation 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:
createin 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)
-
-