Class TransformWrapper

java.lang.Object
org.locationtech.proj4j.geoapi.Wrapper
org.locationtech.proj4j.geoapi.TransformWrapper
All Implemented Interfaces:
Serializable, org.opengis.metadata.Identifier, org.opengis.referencing.IdentifiedObject, org.opengis.referencing.operation.CoordinateOperation, org.opengis.referencing.operation.MathTransform, org.opengis.referencing.ReferenceIdentifier
Direct Known Subclasses:
TransformWrapper2D, TransformWrapper3D

abstract class TransformWrapper extends Wrapper implements org.opengis.referencing.operation.CoordinateOperation, org.opengis.referencing.operation.MathTransform, Serializable
Base class of two-dimensional or three-dimensional coordinate operation. The exact type of the operation (conversion, transformation or concatenated) is unknown.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) final CoordinateTransform
    The wrapped PROJ4 implementation.

    Fields inherited from class Wrapper

    BIDIMENSIONAL, TRIDIMENSIONAL

    Fields inherited from interface org.opengis.referencing.operation.CoordinateOperation

    COORDINATE_OPERATION_ACCURACY_KEY, DOMAIN_OF_VALIDITY_KEY, OPERATION_VERSION_KEY, SCOPE_KEY

    Fields inherited from interface org.opengis.referencing.IdentifiedObject

    ALIAS_KEY, IDENTIFIERS_KEY, NAME_KEY, REMARKS_KEY

    Fields inherited from interface org.opengis.metadata.Identifier

    AUTHORITY_KEY, CODE_KEY

    Fields inherited from interface org.opengis.referencing.ReferenceIdentifier

    CODESPACE_KEY, VERSION_KEY
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new wrapper for the given PROJ4J implementation.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) static org.opengis.referencing.operation.TransformException
    Wraps the given PROJ4J exception in a GeoAPI exception.
    (package private) static void
    checkNumPts(int numPts)
    validates the number of points argument.
    org.opengis.referencing.operation.Matrix
    derivative(org.opengis.geometry.DirectPosition point)
    Unsupported operation.
    Returns a name that summarizes the operation.
    Collection<org.opengis.metadata.quality.PositionalAccuracy>
    Returns the impact of this operation on point accuracy.
    final org.opengis.referencing.operation.MathTransform
    Returns the object performing the actual coordinate operations.
    private static String
    Returns the name of the given CRS, or an arbitrary name if none is specified.
    Returns the version of the coordinate transformation.
    private static Projection
    Returns the projection of the given CRS, or null if none.
    final org.opengis.referencing.crs.CoordinateReferenceSystem
    Returns the CRS of the source points.
    final org.opengis.referencing.crs.CoordinateReferenceSystem
    Returns the CRS of the target points.
    (package private) final Object
    Returns the PROJ4J backing implementation.
    final boolean
    Tests whether this transform does not move any points.
    final org.opengis.geometry.DirectPosition
    transform(org.opengis.geometry.DirectPosition ptSrc, org.opengis.geometry.DirectPosition ptDst)
    Transforms the specified ptSrc and stores the result in ptDst.
    (package private) static TransformWrapper
    wrap(CoordinateTransform impl, boolean is3D)
    Wraps the given implementation.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.opengis.referencing.operation.CoordinateOperation

    getDomainOfValidity, getScope

    Methods inherited from interface org.opengis.referencing.IdentifiedObject

    getAlias, getIdentifiers, getName, getRemarks, toWKT

    Methods inherited from interface org.opengis.referencing.operation.MathTransform

    getSourceDimensions, getTargetDimensions, inverse, toWKT, transform, transform, transform, transform
  • Field Details

  • Constructor Details

    • TransformWrapper

      TransformWrapper(CoordinateTransform impl)
      Creates a new wrapper for the given PROJ4J implementation.
  • Method Details

    • wrap

      static TransformWrapper wrap(CoordinateTransform impl, boolean is3D)
      Wraps the given implementation.
      Parameters:
      impl - the implementation to wrap, or null
      is3D - whether to return a three-dimensional operation instead of a two-dimensional one
      Returns:
      the wrapper, or null if the given implementation was null
    • implementation

      final Object implementation()
      Returns the PROJ4J backing implementation..
      Specified by:
      implementation in class Wrapper
      Returns:
      the PROJ4J backing implementation
    • getProjection

      private static Projection getProjection(CoordinateReferenceSystem crs)
      Returns the projection of the given CRS, or null if none.
    • getName

      private static String getName(CoordinateReferenceSystem crs)
      Returns the name of the given CRS, or an arbitrary name if none is specified.
    • getCode

      public String getCode()
      Returns a name that summarizes the operation..
      Specified by:
      getCode in interface org.opengis.metadata.Identifier
      Specified by:
      getCode in class Wrapper
      Returns:
      a name that summarizes the operation
    • getSourceCRS

      public final org.opengis.referencing.crs.CoordinateReferenceSystem getSourceCRS()
      Returns the CRS of the source points.. May be null if unspecified.
      Specified by:
      getSourceCRS in interface org.opengis.referencing.operation.CoordinateOperation
      Returns:
      the CRS of the source points
    • getTargetCRS

      public final org.opengis.referencing.crs.CoordinateReferenceSystem getTargetCRS()
      Returns the CRS of the target points.. May be null if unspecified.
      Specified by:
      getTargetCRS in interface org.opengis.referencing.operation.CoordinateOperation
      Returns:
      the CRS of the target points
    • getOperationVersion

      public String getOperationVersion()
      Returns the version of the coordinate transformation.. This is unknown by default.
      Specified by:
      getOperationVersion in interface org.opengis.referencing.operation.CoordinateOperation
      Returns:
      the version of the coordinate transformation
    • getCoordinateOperationAccuracy

      public Collection<org.opengis.metadata.quality.PositionalAccuracy> getCoordinateOperationAccuracy()
      Returns the impact of this operation on point accuracy.. This is unknown by default.
      Specified by:
      getCoordinateOperationAccuracy in interface org.opengis.referencing.operation.CoordinateOperation
      Returns:
      the impact of this operation on point accuracy
    • getMathTransform

      public final org.opengis.referencing.operation.MathTransform getMathTransform()
      Returns the object performing the actual coordinate operations.. This is the same object in the case of PROJ4J implementation.
      Specified by:
      getMathTransform in interface org.opengis.referencing.operation.CoordinateOperation
      Returns:
      the object performing the actual coordinate operations
    • isIdentity

      public final boolean isIdentity()
      Tests whether this transform does not move any points.
      Specified by:
      isIdentity in interface org.opengis.referencing.operation.MathTransform
    • transform

      public final org.opengis.geometry.DirectPosition transform(org.opengis.geometry.DirectPosition ptSrc, org.opengis.geometry.DirectPosition ptDst) throws org.opengis.referencing.operation.TransformException
      Transforms the specified ptSrc and stores the result in ptDst. If the target position is a wrapper, this method writes the result directly in the backing implementation. This method has some flexibility on the number of dimensions (2 or 3).
      Specified by:
      transform in interface org.opengis.referencing.operation.MathTransform
      Throws:
      org.opengis.referencing.operation.TransformException
    • derivative

      public org.opengis.referencing.operation.Matrix derivative(org.opengis.geometry.DirectPosition point) throws org.opengis.referencing.operation.TransformException
      Unsupported operation.
      Specified by:
      derivative in interface org.opengis.referencing.operation.MathTransform
      Throws:
      org.opengis.referencing.operation.TransformException
    • checkNumPts

      static void checkNumPts(int numPts)
      validates the number of points argument.
    • cannotTransform

      static org.opengis.referencing.operation.TransformException cannotTransform(Proj4jException e)
      Wraps the given PROJ4J exception in a GeoAPI exception.
      Parameters:
      e - the PROJ4J exception
      Returns:
      the GeoAPI exception