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) CoordinateTransform
impl
The 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.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, ornull
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 specifiedptSrc
and stores the result inptDst
.(package private) static TransformWrapper
wrap(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, ornull
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 classWrapper
-
getProjection
private static Projection getProjection(CoordinateReferenceSystem crs)
Returns the projection of the given CRS, ornull
if 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 benull
if unspecified.- Specified by:
getSourceCRS
in interfaceorg.opengis.referencing.operation.CoordinateOperation
-
getTargetCRS
public final org.opengis.referencing.crs.CoordinateReferenceSystem getTargetCRS()
{@return the CRS of the target points}. May benull
if unspecified.- Specified by:
getTargetCRS
in 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:
getOperationVersion
in 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:
getCoordinateOperationAccuracy
in 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:
getMathTransform
in interfaceorg.opengis.referencing.operation.CoordinateOperation
-
isIdentity
public final boolean isIdentity()
Tests whether this transform does not move any points.- Specified by:
isIdentity
in 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.TransformException
Transforms the specifiedptSrc
and 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:
transform
in 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.TransformException
Unsupported operation.- Specified by:
derivative
in 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
-
-