Class NormalizedProjection
- All Implemented Interfaces:
Serializable
,Parameterized
,LenientComparable
,org.opengis.referencing.operation.MathTransform
,org.opengis.referencing.operation.MathTransform2D
- Direct Known Subclasses:
AuthalicConversion
,AzimuthalEquidistant
,ConformalProjection
,MeridianArcBased
,Mollweide
,ObliqueStereographic
,Orthographic
,SatelliteTracking
,TransverseMercator
- On input, the
transform(…)
method expects (longitude, latitude) angles in radians, sometimes pre-multiplied by other projection-specific factors (see point #3 below). Longitudes have the central meridian (λ₀) removed before the transform method is invoked. The conversion from degrees to radians and the longitude rotation are applied by the normalization affine transform. - On output, the
transform(…)
method returns (x, y) values on a sphere or ellipse having a semi-major axis length (a) of 1, sometimes divided by other projection-specific factors (see point #3 below). The multiplication by the scale factor (k₀) and the translation by false easting (FE) and false northing (FN) are applied by the denormalization affine transform. - In addition to above-cited conversions, subclasses may opportunistically concatenate other linear operations
(scales and translations). They do that by changing the normalization and denormalization matrices shown below.
When such changes are applied, the
transform(…)
inputs are no longer angles in radians but some other derived values.
NormalizedProjection
respectively. Those matrices show only the basic parameters common to most projections.
Some projections will put more elements in those matrices.
NormalizedProjection
NormalizedProjection
does not store the above cited parameters (central meridian, scale factor, etc.)
on intent (except indirectly), in order to make clear that those parameters are not used by subclasses.
The ability to recognize two NormalizedProjection
s as equivalent
without consideration for the scale factor (among other) allow more efficient concatenation in some cases
(typically some combinations of reverse projection followed by a direct projection).
All angles (either fields, method parameters or return values) in this class and subclasses are
in radians. This is the opposite of Parameters
where all angles are in CRS-dependent units,
typically decimal degrees.
Serialization
Serialization of this class is appropriate for short-term storage or RMI use, but may not be compatible with future versions. For long term storage, WKT (Well Know Text) or XML are more appropriate.- Since:
- 0.6
- Version:
- 1.3
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
Reverse of a normalized map projection.protected static enum
Maps the parameters to be used for initializingNormalizedProjection
and its normalization / denormalization matrices. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final double
Maximum difference allowed when comparing longitudes or latitudes in radians.(package private) final ContextualParameters
The parameters used for creating this projection.The internal parameter descriptors.protected final double
Ellipsoid eccentricity, equals tosqrt(eccentricitySquared)
.protected final double
The square of eccentricity: ℯ² = (a²-b²)/a² where ℯ is the eccentricity, a is the semi-major axis length and b is the semi-minor axis length.private final org.opengis.referencing.operation.MathTransform2D
The inverse of this map projection.(package private) static final double
Desired accuracy for the result of iterative computations, in radians.(package private) static final double
An arbitrarily large longitude value (in radians) for map projections capable to have infinite extent in the east-west direction.(package private) static final int
Maximum number of iterations for iterative computations.(package private) static final double
Arbitrary latitude threshold (in radians) for considering that a point is in the polar area.private static final long
For cross-version compatibility.Fields inherited from class org.apache.sis.referencing.operation.transform.AbstractMathTransform2D
DIMENSION
-
Constructor Summary
ConstructorsModifierConstructorDescription(package private)
NormalizedProjection
(Initializer initializer, NormalizedProjection other) Creates a new normalized projection from the parameters computed by the given initializer, or from the parameters already computed by another projection.protected
NormalizedProjection
(org.opengis.referencing.operation.OperationMethod method, Parameters parameters, Map<NormalizedProjection.ParameterRole, ? extends org.opengis.parameter.ParameterDescriptor<? extends Number>> roles) Constructs a new map projection from the supplied parameters. -
Method Summary
Modifier and TypeMethodDescription(package private) final org.opengis.referencing.operation.MathTransform
completeWithWraparound
(org.opengis.referencing.operation.MathTransformFactory factory) Returns a transform which may shift scaled longitude θ=n⋅λ inside the [−n⋅π … n⋅π] range.protected int
Computes a hash code value for thisNormalizedProjection
.org.opengis.referencing.operation.MathTransform
createMapProjection
(org.opengis.referencing.operation.MathTransformFactory factory) Returns the sequence of normalization →this
→ denormalization transforms as a whole.(package private) final org.opengis.referencing.operation.MathTransform
If this map projection cannot handle the parameters given by the user but another projection could, delegates to the other projection.boolean
equals
(Object object, ComparisonMode mode) Compares the given object with this transform for equivalence.protected final ContextualParameters
Returns the parameters used for creating the complete map projection.(package private) String[]
Returns the names of any additional internal parameters (other thaneccentricity
) that this projection has.(package private) double[]
Returns the values of any additional internal parameters (other thaneccentricity
) that this projection has.private static org.opengis.referencing.operation.Matrix
getMiddleMatrix
(AbstractMathTransform projection, org.opengis.referencing.operation.MathTransform other, boolean applyOtherFirst) If a sequence of 3 transforms are (reverse projection) → (affine) → (projection) where the (projection) and (reverse projection) steps are the inverse of each other, returns the matrix of the affine transform step.org.opengis.parameter.ParameterDescriptorGroup
Returns a description of the non-linear internal parameters of thisNormalizedProjection
.org.opengis.parameter.ParameterValueGroup
Returns a copy of non-linear internal parameter values of thisNormalizedProjection
.(package private) final double
The longitude value where wraparound is, or would be, applied by this map projection.org.opengis.referencing.operation.MathTransform2D
inverse()
Returns the inverse of this map projection.protected abstract void
inverseTransform
(double[] srcPts, int srcOff, double[] dstPts, int dstOff) Inverse converts the single coordinate tuple insrcPts
at the given offset and stores the result inptDst
at the given offset.abstract org.opengis.referencing.operation.Matrix
transform
(double[] srcPts, int srcOff, double[] dstPts, int dstOff, boolean derivate) Projects a single coordinate tuple insrcPts
at the given offset and stores the result indstPts
at the given offset.protected org.opengis.referencing.operation.MathTransform
tryConcatenate
(boolean applyOtherFirst, org.opengis.referencing.operation.MathTransform other, org.opengis.referencing.operation.MathTransformFactory factory) Concatenates or pre-concatenates in an optimized way this projection with the given transform, if possible.(package private) org.opengis.referencing.operation.MathTransform
tryConcatenate
(boolean projectedSpace, org.opengis.referencing.operation.Matrix affine, org.opengis.referencing.operation.MathTransformFactory factory) Returns the concatenation of (inverse) → (affine) → (this) transforms, ornull
if none.(package private) static <V extends ProjectionVariant>
Vvariant
(org.opengis.referencing.operation.OperationMethod method, V[] variants, V defaultValue) Returns the variant of the map projection described by the given operation method.Methods inherited from class org.apache.sis.referencing.operation.transform.AbstractMathTransform2D
createTransformedShape, derivative, getSourceDimensions, getTargetDimensions, transform
Methods inherited from class org.apache.sis.referencing.operation.transform.AbstractMathTransform
derivative, equals, formatTo, getDomain, hashCode, isIdentity, transform, transform, transform, transform, transform
Methods inherited from class org.apache.sis.io.wkt.FormattableObject
print, toString, 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.MathTransform
derivative, isIdentity, toWKT, transform, transform, transform, transform, transform
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
ANGULAR_TOLERANCE
static final double ANGULAR_TOLERANCEMaximum difference allowed when comparing longitudes or latitudes in radians. The current value takes the system-wide angular tolerance value (equivalent to about 1 cm on Earth) converted to radians.Some formulas use this tolerance value for testing sines or cosines of an angle. In the sine case, this is justified because sin(θ) ≅ θ when θ is small. Similar reasoning applies to cosine with cos(θ) ≅ θ + π/2 when θ is small.
Some formulas may use this tolerance value as a linear tolerance on the unit sphere. This is okay because the arc length for an angular tolerance θ is r⋅θ, but in this class r=1.
- See Also:
-
ITERATION_TOLERANCE
static final double ITERATION_TOLERANCEDesired accuracy for the result of iterative computations, in radians. This constant defines the desired accuracy of methods likeConformalProjection.φ(double)
.The current value is 0.25 time the accuracy derived from
Formulas.LINEAR_TOLERANCE
. So if the linear tolerance is 1 cm, then the accuracy that we will seek for is 0.25 cm (about 4E-10 radians). The 0.25 factor is a safety margin for meeting the 1 cm accuracy.- See Also:
-
MAXIMUM_ITERATIONS
static final int MAXIMUM_ITERATIONSMaximum number of iterations for iterative computations. The iterative methods used in subclasses should converge quickly (in 3 or 4 iterations) when used for a planet with an eccentricity similar to Earth. But we allow a high limit in case someone uses SIS for some planet with higher eccentricity.- See Also:
-
POLAR_AREA_LIMIT
static final double POLAR_AREA_LIMITArbitrary latitude threshold (in radians) for considering that a point is in the polar area. This is used for implementations of theAbstractMathTransform.getDomain(DomainDefinition)
method.- See Also:
-
LARGE_LONGITUDE_LIMIT
static final double LARGE_LONGITUDE_LIMITAn arbitrarily large longitude value (in radians) for map projections capable to have infinite extent in the east-west direction. This is the case ofMercator
projection for example. Longitudes have no real world meaning outside −180° … +180° range (unless wraparound is applied), but we nevertheless accept large values without wraparound because they make envelope projection easier. This is used for implementations of theAbstractMathTransform.getDomain(DomainDefinition)
method, which use arbitrary limits anyway.- See Also:
-
DESCRIPTORS
@Debug private static final Map<Class<?>,org.opengis.parameter.ParameterDescriptorGroup> DESCRIPTORSThe internal parameter descriptors. Keys are implementation classes. Values are parameter descriptor groups containing at least a parameter for theeccentricity
value, and optionally other internal parameter added by some subclasses.Entries are created only when first needed. Those descriptors are usually never created since they are used only by
getParameterDescriptors()
, which is itself invoked mostly for debugging purpose. -
context
The parameters used for creating this projection. They are used for formatting Well Known Text (WKT) and error messages. Subclasses shall not use the values defined in this object for computation purpose, except at construction time.- See Also:
-
eccentricity
protected final double eccentricityEllipsoid eccentricity, equals tosqrt(eccentricitySquared)
. Value 0 means that the ellipsoid is spherical. -
eccentricitySquared
protected final double eccentricitySquaredThe square of eccentricity: ℯ² = (a²-b²)/a² where ℯ is the eccentricity, a is the semi-major axis length and b is the semi-minor axis length. -
inverse
private final org.opengis.referencing.operation.MathTransform2D inverseThe inverse of this map projection.Note: creation of this object is not deferred to the first call to theinverse()
method because this object is lightweight and typically needed soon anyway (may be as soon asConcatenatedTransform
construction time). In addition this field is part of serialization form in order to preserve the references graph.
-
-
Constructor Details
-
NormalizedProjection
protected NormalizedProjection(org.opengis.referencing.operation.OperationMethod method, Parameters parameters, Map<NormalizedProjection.ParameterRole, ? extends org.opengis.parameter.ParameterDescriptor<? extends Number>> roles) Constructs a new map projection from the supplied parameters. This constructor applies the following operations on the contextual parameters:- On the normalization matrix (to be applied before
this
transform):- Subtract the central meridian value.
- Convert from degrees to radians.
- On the denormalization matrix (to be applied after
this
transform):- Scale by the semi-major axis length.
- If a scale factor is present (not all map projections have a scale factor), apply that scale.
- Translate by the false easting and false northing (after the scale).
- On the contextual parameters (not the parameters of
this
transform):- Store the values for semi-major axis length, semi-minor axis length, scale factor (if present), central meridian, false easting and false northing values.
Initial matrix coefficients after construction Normalization Denormalization Which parameters are considered
Theroles
map specifies which parameters to look for central meridian, scale factor, false easting, false northing and other values. All entries in theroles
map are optional. All descriptors in the map shall comply to the following constraints:- Descriptors associated to
NormalizedProjection.ParameterRole.SEMI_MAJOR
,SEMI_MINOR
,FALSE_EASTING
andFALSE_NORTHING
shall have the same linear unit of measurement (usually metre). - Descriptors associated to angular measures (
NormalizedProjection.ParameterRole.CENTRAL_MERIDIAN
andLATITUDE_OF_CONFORMAL_SPHERE_RADIUS
) shall use degrees.
Parameters
object given in argument to this constructor. But those values will be converted to the units of measurement specified by the parameter descriptors in theroles
map, which must be the above-cited units.- Parameters:
method
- description of the map projection parameters.parameters
- the parameters of the projection to be created.roles
- parameters to look for central meridian, scale factor, false easting, false northing and other values.
- On the normalization matrix (to be applied before
-
NormalizedProjection
NormalizedProjection(Initializer initializer, NormalizedProjection other) Creates a new normalized projection from the parameters computed by the given initializer, or from the parameters already computed by another projection. Exactly one ofinitializer
orother
shall be non-null. Theother
argument may be used after we determined that the default implementation can be replaced by another one, for example using spherical formulas instead of the ellipsoidal ones. This constructor allows to transfer all parameters to the new instance without recomputing them.Design note
We do not define two separated constructors because doing so can force some subclasses to duplicate non-trivial calculations in the two constructors.- Parameters:
initializer
- the initializer for computing map projection internal parameters, ornull
.other
- the other projection from which to compute parameters, ornull
.
-
-
Method Details
-
variant
static <V extends ProjectionVariant> V variant(org.opengis.referencing.operation.OperationMethod method, V[] variants, V defaultValue) Returns the variant of the map projection described by the given operation method. Identifiers are tested first because they have precedence over operation names.- Parameters:
method
- the user-specified projection method.variants
- possible variants for the map projection.defaultValue
- value to return if no match is found.- Returns:
- the variant of the given operation method, or
defaultValue
if none.
-
createMapProjection
public org.opengis.referencing.operation.MathTransform createMapProjection(org.opengis.referencing.operation.MathTransformFactory factory) throws org.opengis.util.FactoryException Returns the sequence of normalization →this
→ denormalization transforms as a whole. The transform returned by this method expects (longitude, latitude) coordinates in degrees and returns (x,y) coordinates in metres. Conversion to other units and changes in axis order are not managed by the returned transform.The default implementation is as below:
Subclasses can override this method if they wish to use alternative implementations under some circumstances. For example, many subclasses will replacethis
by a specialized implementation if they detect that the ellipsoid is actually spherical.- Parameters:
factory
- the factory to use for creating the transform.- Returns:
- the map projection from (λ,φ) to (x,y) coordinates.
- Throws:
org.opengis.util.FactoryException
- if an error occurred while creating a transform.- See Also:
-
completeWithWraparound
final org.opengis.referencing.operation.MathTransform completeWithWraparound(org.opengis.referencing.operation.MathTransformFactory factory) throws org.opengis.util.FactoryException Returns a transform which may shift scaled longitude θ=n⋅λ inside the [−n⋅π … n⋅π] range. The transform intentionally does not force θ to be inside that range in all cases. We avoid explicit wraparounds as much as possible (as opposed to implicit wraparounds performed by trigonometric functions) because they tend to introduce discontinuities. We perform wraparounds only when necessary for the problem of area crossing the anti-meridian (±180°).Example: a CRS for Alaska may have the central meridian at λ₀=−154° of longitude. If the point to project is at λ=177° of longitude, calculations will be performed with Δλ=331° while the correct value that we need to use is Δλ=−29°.In order to avoid wraparound operations as much as possible, we test only the bound where anti-meridian problem may happen; no wraparound will be applied for the opposite bound. Furthermore, we add or subtract 360° only once. Even if the point did many turns around the Earth, the 360° shift will still be applied at most once. The desire to apply the minimal amount of shifts is the reason why we do not useMath.IEEEremainder(double, double)
.When to use
This method is invoked by map projections that multiply the longitude values by some scale factor before to use them in trigonometric functions. Usually we do not explicitly wraparound the longitude values, because trigonometric functions do that automatically for us. However if the longitude is multiplied by some factor before to be used in trigonometric functions, then that implicit wraparound is not the one we expect. The map projection code needs to perform explicit wraparound in such cases.- Parameters:
factory
- the factory to use for completing the transform with normalization/denormalization steps.- Returns:
- the map projection from (λ,φ) to (x,y) coordinates with wraparound if needed.
- Throws:
org.opengis.util.FactoryException
- if an error occurred while creating a transform.- See Also:
-
delegate
final org.opengis.referencing.operation.MathTransform delegate(org.opengis.referencing.operation.MathTransformFactory factory, String name) throws org.opengis.util.FactoryException If this map projection cannot handle the parameters given by the user but another projection could, delegates to the other projection. This method can be invoked by somecreateMapProjection(MathTransformFactory)
implementations when the other projection can be seen as a special case.Example: theIt is caller's responsibility to choose an alternative method that can understand the parameters which were given to this original projection.ObliqueStereographic
formulas do not work anymore when the latitude of origin is 90°N or 90°S, because some internal coefficients become infinite. However, thePolarStereographic
implementation is designed especially for those special cases. So theObliqueStereographic.createMapProjection(…)
method can redirect toPolarStereographic.createMapProjection(…)
when it detects such cases.- Parameters:
factory
- the factory given tocreateMapProjection(MathTransformFactory)
.name
- the name of the alternative map projection to use.- Returns:
- the alternative projection.
- Throws:
org.opengis.util.FactoryException
- if an error occurred while creating the alternative projection.- Since:
- 0.7
-
getContextualParameters
Returns the parameters used for creating the complete map projection. Those parameters describe a sequence of normalize →this
→ denormalize transforms, not including axis swapping. Those parameters are used for formatting Well Known Text (WKT) and error messages. Subclasses shall not use the values defined in the returned object for computation purpose, except at construction time.- Overrides:
getContextualParameters
in classAbstractMathTransform
- Returns:
- the parameter values for the sequence of normalize →
this
→ denormalize transforms, ornull
if unspecified.
-
getParameterValues
Returns a copy of non-linear internal parameter values of thisNormalizedProjection
. The returned group contains at least theeccentricity
parameter value. Some subclasses add more non-linear parameters, but most of them do not because many parameters like the scale factor or the false easting/northing are handled by the (de)normalization affine transforms instead.Note: This method is mostly for debugging purposes since the isolation of non-linear parameters in this class is highly implementation dependent. Most GIS applications will instead be interested in the contextual parameters.- Specified by:
getParameterValues
in interfaceParameterized
- Overrides:
getParameterValues
in classAbstractMathTransform
- Returns:
- a copy of the internal parameter values for this normalized projection.
- See Also:
-
getParameterDescriptors
Returns a description of the non-linear internal parameters of thisNormalizedProjection
. The returned group contains at least a descriptor for theeccentricity
parameter. Subclasses may add more parameters.This method is for inspecting the parameter values of this non-linear kernel only, not for inspecting the contextual parameters. Inspecting the kernel parameter values is usually for debugging purpose only.
- Specified by:
getParameterDescriptors
in interfaceParameterized
- Overrides:
getParameterDescriptors
in classAbstractMathTransform
- Returns:
- a description of the internal parameters.
- See Also:
-
getInternalParameterNames
String[] getInternalParameterNames()Returns the names of any additional internal parameters (other thaneccentricity
) that this projection has. The length of this array must be the same than the length of thegetInternalParameterValues()
array, if the latter is non-null. -
getInternalParameterValues
double[] getInternalParameterValues()Returns the values of any additional internal parameters (other thaneccentricity
) that this projection has. Those values are also compared byequals(Object, ComparisonMode)
. -
getWraparoundLongitude
final double getWraparoundLongitude()The longitude value where wraparound is, or would be, applied by this map projection. This is typicallyMath.PI
(180° converted to radians) but not necessarily, because implementations are free to scale the longitude values by an arbitrary factor.The wraparound may not be really applied by the
transform(…)
methods. Many map projections implicitly wraparound longitude values through the use of trigonometric functions (sin(λ)
,cos(λ)
, etc). For those map projections, the wraparound is unconditional. But some other map projections are capable to handle longitude values beyond the [−180° … +180°] range as if the world was expanding toward infinity in east and west directions. The most common example is the Mercator projection. In those latter cases, wraparounds are avoided as much as possible in order to facilitate the projection of envelopes, geometries or rasters, where discontinuities (sudden jumps of 360°) cause artifacts.- Returns:
- the longitude value where wraparound is or would be applied.
- See Also:
-
transform
public abstract org.opengis.referencing.operation.Matrix transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, boolean derivate) throws ProjectionException Projects a single coordinate tuple insrcPts
at the given offset and stores the result indstPts
at the given offset. In addition, opportunistically computes the transform derivative if requested.Normalization
The input coordinates are (λ,φ) (the variable names for longitude and latitude respectively) angles in radians, eventually pre-multiplied by projection-specific factors. Input coordinates shall have the central meridian removed from the longitude by the caller before this method is invoked. After this method is invoked, the caller will need to multiply the output coordinates by the global scale factor, apply the (false easting, false northing) offset and eventually other projection-specific factors. This means that projections that implement this method are performed on a sphere or ellipse having a semi-major axis length of 1.Note 1: it is generally not necessary to know the projection-specific additional factors applied by subclasses on the input and output values, becauseNormalizedProjection
should never be used directly.NormalizedProjection
instances are used only indirectly as a step in a concatenated transform that include the normalization and denormalization matrices documented in this class javadoc.Note 2: in the PROJ library, the same standardization, described above, is handled bypj_fwd.c
, except for the projection-specific additional factors.Argument checks
The input longitude and latitude are usually (but not always) in the range [-π … π] and [-π/2 … π/2] respectively. However, values outside those ranges are accepted on the assumption that most implementations use those values only in trigonometric functions like sine and cosine. If this assumption is not applicable to a particular subclass, then it is implementer responsibility to check the range.- Specified by:
transform
in classAbstractMathTransform
- Parameters:
srcPts
- the array containing the source point coordinates, as (longitude, latitude) angles in radians.srcOff
- the offset of the single coordinate tuple to be converted in the source array.dstPts
- the array into which the converted coordinates is returned (may be the same thansrcPts
). Coordinates will be expressed in a dimensionless unit, as a linear distance on a unit sphere or ellipse.dstOff
- the offset of the location of the converted coordinates that is stored in the destination array.derivate
-true
for computing the derivative, orfalse
if not needed.- Returns:
- the matrix of the projection derivative at the given source position,
or
null
if thederivate
argument isfalse
. - Throws:
ProjectionException
- if the coordinates cannot be converted.- See Also:
-
inverseTransform
protected abstract void inverseTransform(double[] srcPts, int srcOff, double[] dstPts, int dstOff) throws ProjectionException Inverse converts the single coordinate tuple insrcPts
at the given offset and stores the result inptDst
at the given offset. The output coordinates are (longitude, latitude) angles in radians, usually (but not necessarily) in the range [-π … π] and [-π/2 … π/2] respectively.Normalization
Input coordinates shall have the (false easting, false northing) removed by the caller and the result divided by the global scale factor before this method is invoked. After this method is invoked, the caller will need to add the central meridian to the longitude in the output coordinates. This means that projections that implement this method are performed on a sphere or ellipse having a semi-major axis of 1. Additional projection-specific factors may also need to be applied (see class javadoc).Note: in the PROJ library, the same standardization, described above, is handled bypj_inv.c
, except for the projection-specific additional factors.- Parameters:
srcPts
- the array containing the source point coordinates, as linear distance on a unit sphere or ellipse.srcOff
- the offset of the point to be converted in the source array.dstPts
- the array into which the converted point coordinates is returned (may be the same thansrcPts
). Coordinates will be (longitude, latitude) angles in radians.dstOff
- the offset of the location of the converted point that is stored in the destination array.- Throws:
ProjectionException
- if the point cannot be converted.
-
inverse
public org.opengis.referencing.operation.MathTransform2D inverse()Returns the inverse of this map projection. Subclasses do not need to override this method, as they should overrideinverseTransform(…)
instead.- Specified by:
inverse
in interfaceorg.opengis.referencing.operation.MathTransform
- Specified by:
inverse
in interfaceorg.opengis.referencing.operation.MathTransform2D
- Overrides:
inverse
in classAbstractMathTransform2D
- Returns:
- the inverse of this map projection.
-
tryConcatenate
protected org.opengis.referencing.operation.MathTransform tryConcatenate(boolean applyOtherFirst, org.opengis.referencing.operation.MathTransform other, org.opengis.referencing.operation.MathTransformFactory factory) throws org.opengis.util.FactoryException Concatenates or pre-concatenates in an optimized way this projection with the given transform, if possible. If transforms are concatenated in a (reverse projection) → (affine) → (projection) sequence where the (projection) and (reverse projection) steps are the inverse of each other, then in some particular case the sequence can be replaced by a single affine transform. If no such simplification is possible, this method returnsnull
.- Overrides:
tryConcatenate
in classAbstractMathTransform
- Parameters:
applyOtherFirst
-true
if the transformation order isother
followed bythis
, orfalse
if the transformation order isthis
followed byother
.other
- the other math transform to (pre-)concatenate with this transform.factory
- the factory which is (indirectly) invoking this method, ornull
if none.- Returns:
- the simplified (usually affine) transform, or
null
if no such optimization is available. - Throws:
org.opengis.util.FactoryException
- if an error occurred while combining the transforms.- Since:
- 0.8
- See Also:
-
tryConcatenate
org.opengis.referencing.operation.MathTransform tryConcatenate(boolean projectedSpace, org.opengis.referencing.operation.Matrix affine, org.opengis.referencing.operation.MathTransformFactory factory) throws org.opengis.util.FactoryException Returns the concatenation of (inverse) → (affine) → (this) transforms, ornull
if none. The affine transform is applied in the geographic space with angular values in radians.Above description is for the usual case where
projectedSpace
isfalse
. Iftrue
(should be unusual), then the affine transform is rather applied in the projected space and the sequence to concatenate is (this) → (affine) → (inverse).Default implementation returns
null
. Subclasses should override if applicable.- Parameters:
projectedSpace
-true
if affine transform is applied in projected instead of geographic space.affine
- the affine transform in the middle of (inverse) → (affine) → (this) transform sequence.factory
- the factory to use for creating new transform, ornull
.- Returns:
- the optimized concatenation, or
null
if none. - Throws:
org.opengis.util.FactoryException
-
getMiddleMatrix
private static org.opengis.referencing.operation.Matrix getMiddleMatrix(AbstractMathTransform projection, org.opengis.referencing.operation.MathTransform other, boolean applyOtherFirst) If a sequence of 3 transforms are (reverse projection) → (affine) → (projection) where the (projection) and (reverse projection) steps are the inverse of each other, returns the matrix of the affine transform step. Otherwise returnsnull
. This method accepts also (projection) → (affine) → (reverse projection) sequence, but such sequences should be much more unusual.- Parameters:
projection
- eitherNormalizedProjection
orNormalizedProjection.Inverse
.other
- the arbitrary transforms to be concatenated with the given projection.applyOtherFirst
- whetherother
is concatenated beforeprojection
or the converse.- Returns:
- the 3×3 matrix of the affine transform step, or
null
if none.
-
computeHashCode
protected int computeHashCode()Computes a hash code value for thisNormalizedProjection
.- Overrides:
computeHashCode
in classAbstractMathTransform
- Returns:
- the hash code value.
-
equals
Compares the given object with this transform for equivalence. The default implementation checks ifobject
is an instance of the same class thanthis
, then compares the eccentricity.If this method returns
true
, then for any given identical source position, the two compared map projections shall compute the same target position. Many of the contextual parameters used for creating the map projections are irrelevant and do not need to be known. Those projection parameters will be compared only if the comparison mode isComparisonMode.STRICT
orBY_CONTRACT
.Example: a Mercator projection can be created in the 2SP case with a standard parallel value of 60°. The same projection can also be created in the 1SP case with a scale factor of 0.5. Nevertheless those two map projections applied on a sphere gives identical results. Considering them as equivalent allows the referencing module to transform coordinates between those two projections more efficiently.- Specified by:
equals
in interfaceLenientComparable
- Overrides:
equals
in classAbstractMathTransform
- Parameters:
object
- the object to compare with this map projection for equivalence.mode
- the strictness level of the comparison. Default toComparisonMode.STRICT
.- Returns:
true
if the given object is equivalent to this map projection.- See Also:
-