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 either double or float, and defaults to double.
See Also:
  • Field Details

  • Constructor Details

    • 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 FLOATor DOUBLE
  • Method Details

    • getType

      public int getType()
      Gets the type of packed coordinate sequence this factory builds, either FLOAT or DOUBLE
      Returns:
      the type of packed array built
    • create

      public CoordinateSequence create(Coordinate[] coordinates)
      Description copied from interface: CoordinateSequenceFactory
      Returns a CoordinateSequence 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 interface CoordinateSequenceFactory
      Parameters:
      coordinates - the coordinates
      See Also:
    • create

      public CoordinateSequence create(CoordinateSequence coordSeq)
      Description copied from interface: CoordinateSequenceFactory
      Creates a CoordinateSequence which is a copy of the given CoordinateSequence. This method must handle null arguments by creating an empty sequence.
      Specified by:
      create in interface CoordinateSequenceFactory
      Parameters:
      coordSeq - the coordinate sequence to copy
      See Also:
    • create

      public CoordinateSequence create(double[] packedCoordinates, int dimension)
      Creates a packed coordinate sequence of type DOUBLE from the provided array using the given coordinate dimension and a measure count of 0.
      Parameters:
      packedCoordinates - the array containing coordinate values
      dimension - 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 type DOUBLE from the provided array using the given coordinate dimension and measure count.
      Parameters:
      packedCoordinates - the array containing coordinate values
      dimension - the coordinate dimension
      measures - 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 type FLOAT from the provided array.
      Parameters:
      packedCoordinates - the array containing coordinate values
      dimension - 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 type FLOAT from the provided array.
      Parameters:
      packedCoordinates - the array containing coordinate values
      dimension - the coordinate dimension
      measures - the coordinate measure count
      Returns:
      a packed coordinate sequence of type FLOAT
    • create

      public CoordinateSequence create(int size, int dimension)
      Description copied from interface: CoordinateSequenceFactory
      Creates a CoordinateSequence of the specified size and dimension. For this to be useful, the CoordinateSequence 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 interface CoordinateSequenceFactory
      Parameters:
      size - the number of coordinates in the sequence
      dimension - the dimension of the coordinates in the sequence (if user-specifiable, otherwise ignored)
      See Also:
    • create

      public CoordinateSequence create(int size, int dimension, int measures)
      Description copied from interface: CoordinateSequenceFactory
      Creates a CoordinateSequence of the specified size and dimension with measure support. For this to be useful, the CoordinateSequence 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 interface CoordinateSequenceFactory
      Parameters:
      size - the number of coordinates in the sequence
      dimension - 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: