Class ConstantTransform1D

All Implemented Interfaces:
Serializable, Parameterized, LinearTransform, LenientComparable, org.opengis.referencing.operation.MathTransform, org.opengis.referencing.operation.MathTransform1D

final class ConstantTransform1D extends LinearTransform1D
A one dimensional, constant transform. Output values are set to a constant value regardless of input values. This class is a special case of LinearTransform1D in which LinearTransform1D.scale = 0 and LinearTransform1D.offset = constant. However, this specialized ConstantTransform1D class is faster.

ConstantTransform1D behavior differs from LinearTransform1D behavior is one aspect: NaN values are ignored and converted to the constant value. By contrast, LinearTransform1D let those values to NaN. Overwriting NaN by the constant value is required by org.apache.sis.coverage.

Since:
0.5
Version:
0.5
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Serial number for inter-operability with different versions.
      See Also:
    • ZERO

      static final ConstantTransform1D ZERO
      A transform for the positive zero constant.
    • ONE

      static final ConstantTransform1D ONE
      A transform for the one constant.
  • Constructor Details

    • ConstantTransform1D

      ConstantTransform1D(double offset)
      Constructs a new constant transform.
      Parameters:
      offset - the offset term in the linear equation.
  • Method Details

    • transform

      public double transform(double value)
      Transforms the specified value.
      Specified by:
      transform in interface org.opengis.referencing.operation.MathTransform1D
      Overrides:
      transform in class LinearTransform1D
      Parameters:
      value - the value to transform.
      Returns:
      the transformed value.
    • transform

      public void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
      Transforms many positions in a list of coordinate values.
      Specified by:
      transform in interface org.opengis.referencing.operation.MathTransform
      Overrides:
      transform in class LinearTransform1D
      Parameters:
      srcPts - the array containing the source point coordinates.
      srcOff - the offset to the first point to be transformed in the source array.
      dstPts - the array into which the transformed point coordinates are returned. May be the same than srcPts.
      dstOff - the offset to the location of the first transformed point that is stored in the destination array.
      numPts - the number of point objects to be transformed.
    • transform

      public void transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts)
      Transforms many positions in a list of coordinate values.
      Specified by:
      transform in interface org.opengis.referencing.operation.MathTransform
      Overrides:
      transform in class LinearTransform1D
      Parameters:
      srcPts - the array containing the source point coordinates.
      srcOff - the offset to the first point to be transformed in the source array.
      dstPts - the array into which the transformed point coordinates are returned. May be the same than srcPts.
      dstOff - the offset to the location of the first transformed point that is stored in the destination array.
      numPts - the number of point objects to be transformed.
    • transform

      public void transform(double[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts)
      Transforms many positions in a list of coordinate values.
      Specified by:
      transform in interface org.opengis.referencing.operation.MathTransform
      Overrides:
      transform in class LinearTransform1D
      Parameters:
      srcPts - the array containing the source point coordinates.
      srcOff - the offset to the first point to be transformed in the source array.
      dstPts - the array into which the transformed point coordinates are returned.
      dstOff - the offset to the location of the first transformed point that is stored in the destination array.
      numPts - the number of point objects to be transformed.
    • transform

      public void transform(float[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
      Transforms many positions in a list of coordinate values.
      Specified by:
      transform in interface org.opengis.referencing.operation.MathTransform
      Overrides:
      transform in class LinearTransform1D
      Parameters:
      srcPts - the array containing the source point coordinates.
      srcOff - the offset to the first point to be transformed in the source array.
      dstPts - the array into which the transformed point coordinates are returned.
      dstOff - the offset to the location of the first transformed point that is stored in the destination array.
      numPts - the number of point objects to be transformed.