Package org.locationtech.proj4j.geoapi
Class TransformWrapper
- java.lang.Object
-
- org.locationtech.proj4j.geoapi.Wrapper
-
- org.locationtech.proj4j.geoapi.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) CoordinateTransformimplThe wrapped PROJ4 implementation.-
Fields inherited from class org.locationtech.proj4j.geoapi.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
-
-
Constructor Summary
Constructors Constructor Description TransformWrapper(CoordinateTransform impl)Creates a new wrapper for the given PROJ4J implementation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static org.opengis.referencing.operation.TransformExceptioncannotTransform(Proj4jException e)Wraps the given PROJ4J exception in a GeoAPI exception.(package private) static voidcheckNumPts(int numPts)validates the number of points argument.org.opengis.referencing.operation.Matrixderivative(org.opengis.geometry.DirectPosition point)Unsupported operation.java.lang.StringgetCode(){@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.MathTransformgetMathTransform(){@return the object performing the actual coordinate operations}.private static java.lang.StringgetName(CoordinateReferenceSystem crs)Returns the name of the given CRS, or an arbitrary name if none is specified.java.lang.StringgetOperationVersion(){@return the version of the coordinate transformation}.private static ProjectiongetProjection(CoordinateReferenceSystem crs)Returns the projection of the given CRS, ornullif none.org.opengis.referencing.crs.CoordinateReferenceSystemgetSourceCRS(){@return the CRS of the source points}.org.opengis.referencing.crs.CoordinateReferenceSystemgetTargetCRS(){@return the CRS of the target points}.(package private) java.lang.Objectimplementation(){@return the PROJ4J backing implementation}.booleanisIdentity()Tests whether this transform does not move any points.org.opengis.geometry.DirectPositiontransform(org.opengis.geometry.DirectPosition ptSrc, org.opengis.geometry.DirectPosition ptDst)Transforms the specifiedptSrcand stores the result inptDst.(package private) static TransformWrapperwrap(CoordinateTransform impl, boolean is3D)Wraps the given implementation.-
Methods inherited from class org.locationtech.proj4j.geoapi.Wrapper
equals, getAlias, getAuthority, getCodeSpace, getDomainOfValidity, getIdentifiers, getName, getRemarks, getScope, getVersion, hashCode, toString, toWKT
-
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
-
-
-
-
Field Detail
-
impl
final CoordinateTransform impl
The wrapped PROJ4 implementation.
-
-
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, ornullis3D- whether to return a three-dimensional operation instead of a two-dimensional one- Returns:
- the wrapper, or
nullif the given implementation was null
-
implementation
final java.lang.Object implementation()
{@return the PROJ4J backing implementation}.- Specified by:
implementationin classWrapper
-
getProjection
private static Projection getProjection(CoordinateReferenceSystem crs)
Returns the projection of the given CRS, ornullif none.
-
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}.
-
getSourceCRS
public final org.opengis.referencing.crs.CoordinateReferenceSystem getSourceCRS()
{@return the CRS of the source points}. May benullif unspecified.- Specified by:
getSourceCRSin interfaceorg.opengis.referencing.operation.CoordinateOperation
-
getTargetCRS
public final org.opengis.referencing.crs.CoordinateReferenceSystem getTargetCRS()
{@return the CRS of the target points}. May benullif unspecified.- Specified by:
getTargetCRSin interfaceorg.opengis.referencing.operation.CoordinateOperation
-
getOperationVersion
public java.lang.String getOperationVersion()
{@return the version of the coordinate transformation}. This is unknown by default.- Specified by:
getOperationVersionin interfaceorg.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:
getCoordinateOperationAccuracyin interfaceorg.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:
getMathTransformin interfaceorg.opengis.referencing.operation.CoordinateOperation
-
isIdentity
public final boolean isIdentity()
Tests whether this transform does not move any points.- Specified by:
isIdentityin interfaceorg.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.TransformExceptionTransforms the specifiedptSrcand stores the result inptDst. 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:
transformin interfaceorg.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.TransformExceptionUnsupported operation.- Specified by:
derivativein interfaceorg.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
-
-