Class TransformWrapper

  • All Implemented Interfaces:
    java.io.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, java.io.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) CoordinateTransform impl
      The wrapped PROJ4 implementation.
      • 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
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static org.opengis.referencing.operation.TransformException cannotTransform​(Proj4jException e)
      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.
      java.lang.String getCode()
      {@return a name that summarizes the operation}.
      java.util.Collection<org.opengis.metadata.quality.PositionalAccuracy> getCoordinateOperationAccuracy()
      {@return the impact of this operation on point accuracy}.
      org.opengis.referencing.operation.MathTransform getMathTransform()
      {@return the object performing the actual coordinate operations}.
      private static java.lang.String getName​(CoordinateReferenceSystem crs)
      Returns the name of the given CRS, or an arbitrary name if none is specified.
      java.lang.String getOperationVersion()
      {@return the version of the coordinate transformation}.
      private static Projection getProjection​(CoordinateReferenceSystem crs)
      Returns the projection of the given CRS, or null if none.
      org.opengis.referencing.crs.CoordinateReferenceSystem getSourceCRS()
      {@return the CRS of the source points}.
      org.opengis.referencing.crs.CoordinateReferenceSystem getTargetCRS()
      {@return the CRS of the target points}.
      (package private) java.lang.Object implementation()
      {@return the PROJ4J backing implementation}.
      boolean isIdentity()
      Tests whether this transform does not move any points.
      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 java.lang.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
    • Constructor Detail

      • TransformWrapper

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

      • 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 java.lang.Object implementation()
        {@return the PROJ4J backing implementation}.
        Specified by:
        implementation in class Wrapper
      • getName

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

        public java.lang.String getCode()
        {@return a name that summarizes the operation}.
        Specified by:
        getCode in interface org.opengis.metadata.Identifier
        Specified by:
        getCode in class Wrapper
      • getSourceCRS

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

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

        public java.lang.String getOperationVersion()
        {@return the version of the coordinate transformation}. This is unknown by default.
        Specified by:
        getOperationVersion in interface org.opengis.referencing.operation.CoordinateOperation
      • getCoordinateOperationAccuracy

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

        public final org.opengis.referencing.operation.MathTransform getMathTransform()
        {@return 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
      • 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