public abstract class NormalizedProjection extends AbstractMathTransform2D implements Serializable
transform(…)
method
expects (longitude, latitude) angles in radians.
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.transform(…)
method returns
(x, y) values on a sphere or ellipse having a semi-major axis length (a) of 1.
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.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 intend (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 inverse 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.
ContextualParameters
,
Map projections on MathWorld,
Serialized FormDefined in the sis-referencing
module
Modifier and Type | Class and Description |
---|---|
protected static class |
NormalizedProjection.ParameterRole
Maps the parameters to be used for initializing
NormalizedProjection and its
normalization / denormalization matrices. |
Modifier and Type | Field and Description |
---|---|
protected double |
eccentricity
Ellipsoid eccentricity, equals to
sqrt(eccentricitySquared) . |
protected double |
eccentricitySquared
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.
|
Modifier | Constructor and Description |
---|---|
protected |
NormalizedProjection(OperationMethod method,
Parameters parameters,
Map<NormalizedProjection.ParameterRole,? extends ParameterDescriptor<? extends Number>> roles)
Constructs a new map projection from the supplied parameters.
|
Modifier and Type | Method and Description |
---|---|
protected int |
computeHashCode()
Computes a hash code value for this
NormalizedProjection . |
MathTransform |
createMapProjection(MathTransformFactory factory)
Returns the sequence of normalization →
this → denormalization transforms
as a whole. |
boolean |
equals(Object object,
ComparisonMode mode)
Compares the given object with this transform for equivalence.
|
protected ContextualParameters |
getContextualParameters()
Returns the parameters used for creating the complete map projection.
|
ParameterDescriptorGroup |
getParameterDescriptors()
Returns a description of the non-linear internal parameters of this
NormalizedProjection . |
ParameterValueGroup |
getParameterValues()
Returns a copy of non-linear internal parameter values of this
NormalizedProjection . |
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 in
srcPts at the given offset and stores the result in
ptDst at the given offset. |
abstract Matrix |
transform(double[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
boolean derivate)
Converts a single coordinate in
srcPts at the given offset and stores the result
in dstPts at the given offset. |
protected MathTransform |
tryConcatenate(boolean applyOtherFirst,
MathTransform other,
MathTransformFactory factory)
Concatenates or pre-concatenates in an optimized way this projection with the given transform, if possible.
|
createTransformedShape, derivative, getSourceDimensions, getTargetDimensions, transform
derivative, equals, formatTo, hashCode, isIdentity, transform, transform, transform, transform, transform
print, toString, toString, toWKT
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
derivative, isIdentity, toWKT, transform, transform, transform, transform, transform
protected final double eccentricity
sqrt(eccentricitySquared)
.
Value 0 means that the ellipsoid is spherical.protected final double eccentricitySquared
protected NormalizedProjection(OperationMethod method, Parameters parameters, Map<NormalizedProjection.ParameterRole,? extends ParameterDescriptor<? extends Number>> roles)
this
transform):
this
transform):
this
transform):
Normalization | Denormalization |
---|---|
roles
map specifies which parameters to look for central meridian,
scale factor, false easting, false northing and other values.
All entries in the roles
map are optional.
All descriptors in the map shall comply to the following constraints:
NormalizedProjection.ParameterRole.SEMI_MAJOR
, SEMI_MINOR
,
FALSE_EASTING
and FALSE_NORTHING
shall have the same linear unit of measurement (usually metre).NormalizedProjection.ParameterRole.CENTRAL_MERIDIAN
and
LATITUDE_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 the roles
map, which must be the above-cited units.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.public MathTransform createMapProjection(MathTransformFactory factory) throws FactoryException
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:
return getContextualParameters().completeTransform(factory, this);Subclasses can override this method if they wish to use alternative implementations under some circumstances. For example many subclasses will replace
this
by a specialized implementation if they detect that the
ellipsoid is actually spherical.factory
- the factory to use for creating the transform.FactoryException
- if an error occurred while creating a transform.ContextualParameters.completeTransform(MathTransformFactory, MathTransform)
protected final ContextualParameters getContextualParameters()
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.getContextualParameters
in class AbstractMathTransform
this
→ denormalize
transforms, or null
if unspecified.@Debug public ParameterValueGroup getParameterValues()
NormalizedProjection
.
The returned group contains at least the eccentricity
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.
getParameterValues
in interface Parameterized
getParameterValues
in class AbstractMathTransform
AbstractMathTransform.getContextualParameters()
,
AbstractSingleOperation.getParameterValues()
@Debug public ParameterDescriptorGroup getParameterDescriptors()
NormalizedProjection
.
The returned group contains at least a descriptor for the eccentricity
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.
getParameterDescriptors
in interface Parameterized
getParameterDescriptors
in class AbstractMathTransform
DefaultOperationMethod.getParameters()
public abstract Matrix transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, boolean derivate) throws ProjectionException
srcPts
at the given offset and stores the result
in dstPts
at the given offset. In addition, opportunistically computes the
transform derivative if requested.
pj_fwd.c
.transform
in class AbstractMathTransform
srcPts
- the array containing the source point coordinate, as (longitude, latitude)
angles in radians.srcOff
- the offset of the single coordinate to be converted in the source array.dstPts
- the array into which the converted coordinate is returned (may be the same than srcPts
).
Ordinates 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 coordinate that is stored in the destination array.derivate
- true
for computing the derivative, or false
if not needed.null
if the derivate
argument is false
.ProjectionException
- if the coordinate can not be converted.AbstractMathTransform.derivative(DirectPosition)
,
AbstractMathTransform.transform(DirectPosition, DirectPosition)
,
MathTransforms.derivativeAndTransform(MathTransform, double[], int, double[], int)
protected abstract void inverseTransform(double[] srcPts, int srcOff, double[] dstPts, int dstOff) throws ProjectionException
srcPts
at the given offset and stores the result in
ptDst
at the given offset. The output ordinates are (longitude, latitude)
angles in radians, usually (but not necessarily) in the range [-π … π] and [-π/2 … π/2] respectively.
pj_inv.c
.srcPts
- the array containing the source point coordinate, 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 coordinate is returned (may be the same than srcPts
).
Ordinates will be (longitude, latitude) angles in radians.dstOff
- the offset of the location of the converted point that is stored in the destination array.ProjectionException
- if the point can not be converted.public MathTransform2D inverse()
inverseTransform(…)
instead.inverse
in interface MathTransform
inverse
in interface MathTransform2D
inverse
in class AbstractMathTransform2D
protected MathTransform tryConcatenate(boolean applyOtherFirst, MathTransform other, MathTransformFactory factory) throws FactoryException
null
.tryConcatenate
in class AbstractMathTransform
applyOtherFirst
- true
if the transformation order is other
followed by this
, or
false
if the transformation order is this
followed by other
.other
- the other math transform to (pre-)concatenate with this transform.factory
- the factory which is (indirectly) invoking this method, or null
if none.null
if no such optimization is available.FactoryException
- if an error occurred while combining the transforms.DefaultMathTransformFactory.createConcatenatedTransform(MathTransform, MathTransform)
protected int computeHashCode()
NormalizedProjection
.computeHashCode
in class AbstractMathTransform
public boolean equals(Object object, ComparisonMode mode)
object
is an instance of the same class than this
, 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 is ComparisonMode.STRICT
or BY_CONTRACT
.
equals
in interface LenientComparable
equals
in class AbstractMathTransform
object
- the object to compare with this map projection for equivalence.mode
- the strictness level of the comparison. Default to ComparisonMode.STRICT
.true
if the given object is equivalent to this map projection.Utilities.deepEquals(Object, Object, ComparisonMode)
Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.