Class Initializer
- To convert degrees to radians, than back to degrees and find the original value.
- To convert axis length (optionally with flattening factor) to eccentricity, then back to axis length and find the original value.
As a general rule, we stop storing result with double-double precision after the point where we need
transcendental functions (sine, logarithm, etc.), since we do not have double-double versions of
those functions. Digits after the double
part are usually not significant in such cases, except
in some relatively rare scenarios like 1 ± x where x is much smaller than 1.
- Since:
- 0.6
- Version:
- 1.3
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final ContextualParameters
The parameters used for creating the map projection.(package private) final DoubleDouble
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.(package private) final Parameters
The user supplied parameters, stored temporarily while we transfer the information tocontext
.private final byte
Sign of central meridian: -1 if negative, 0 if zero, +1 if positive.(package private) final ProjectionVariant
Map projection variant, ornull
if none. -
Constructor Summary
ConstructorsConstructorDescriptionInitializer
(org.opengis.referencing.operation.OperationMethod method, Parameters parameters, Map<NormalizedProjection.ParameterRole, ? extends org.opengis.parameter.ParameterDescriptor<? extends Number>> roles, ProjectionVariant variant) Creates a new initializer. -
Method Summary
Modifier and TypeMethodDescription(package private) final DoubleDouble
Returnsb/a
wherea
is the semi-major axis length andb
the semi-minor axis length.(package private) final double
getAndStore
(org.opengis.parameter.ParameterDescriptor<? extends Number> descriptor) Gets a parameter value identified by the given descriptor and stores it in thecontext
.(package private) final double
getAndStore
(org.opengis.parameter.ParameterDescriptor<Double> descriptor, double defaultValue) Same asgetAndStore(ParameterDescriptor)
, but returns the given default value if the parameter is not specified.(package private) final int
getAndStore
(org.opengis.parameter.ParameterDescriptor<Integer> descriptor, int defaultValue) Same asgetAndStore(ParameterDescriptor, double)
but working on integer values.(package private) final double
radiusOfConformalSphere
(double sinφ) Returns the radius of the conformal sphere (assuming a semi-major axis length of 1) at a given latitude.(package private) final double
radiusOfCurvature
(double sinφ) Returns the radius of curvature of the ellipsoid perpendicular to the meridian at latitude φ.(package private) final DoubleDouble
rν2
(double sinφ) Computes the square of the reciprocal of the radius of curvature of the ellipsoid perpendicular to the meridian at latitude φ.(package private) final double
scaleAtφ
(double sinφ, double cosφ) Returns the scale factor at latitude φ (Snyder 14-15).
-
Field Details
-
context
The parameters used for creating the map projection. This object will be stored in the map projection.- See Also:
-
parameters
The user supplied parameters, stored temporarily while we transfer the information tocontext
. -
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.This is stored as a double-double value because this parameter is sometimes used for computing back the semi-minor axis length or the inverse flattening factor. In such case we wish to find the original
double
parameter value without rounding errors. This wish usually do not apply to other internalNormalizedProjection
parameters. -
signum_λ0
private final byte signum_λ0Sign of central meridian: -1 if negative, 0 if zero, +1 if positive. -
variant
Map projection variant, ornull
if none.
-
-
Constructor Details
-
Initializer
Initializer(org.opengis.referencing.operation.OperationMethod method, Parameters parameters, Map<NormalizedProjection.ParameterRole, ? extends org.opengis.parameter.ParameterDescriptor<? extends Number>> roles, ProjectionVariant variant) Creates a new initializer. The parameters are described inNormalizedProjection(OperationMethod, Parameters, Map)
.- 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.variant
- the map projection variant, ornull
if none.
-
-
Method Details
-
getAndStore
Gets a parameter value identified by the given descriptor and stores it in thecontext
. A "contextual parameter" is a parameter that apply to the normalize →this
→ denormalize chain as a whole. It does not really apply to aNormalizedProjection
instance taken alone.This method performs the following actions:
- Convert the value to the units specified by the descriptor.
- Ensure that the value is contained in the range specified by the descriptor.
- Store the value only if different than the default value.
-
getAndStore
final double getAndStore(org.opengis.parameter.ParameterDescriptor<Double> descriptor, double defaultValue) Same asgetAndStore(ParameterDescriptor)
, but returns the given default value if the parameter is not specified. This method shall be used only for parameters having a default value more complex than what we can represent inParameterDescriptor.getDefaultValue()
. -
getAndStore
final int getAndStore(org.opengis.parameter.ParameterDescriptor<Integer> descriptor, int defaultValue) Same asgetAndStore(ParameterDescriptor, double)
but working on integer values. -
axisLengthRatio
Returnsb/a
wherea
is the semi-major axis length andb
the semi-minor axis length. We retrieve this value from the eccentricity withb/a = sqrt(1-ℯ²)
.Tip: for ℯ₁ = [1 - √(1 - ℯ²)] / [1 + √(1 - ℯ²)] (Snyder 3-24), invoke
DoubleDouble.ratio_1m_1p()
on the returned value. -
rν2
Computes the square of the reciprocal of the radius of curvature of the ellipsoid perpendicular to the meridian at latitude φ. That radius of curvature is:ν = 1 / √(1 - ℯ²⋅sin²φ)
This method returns 1/ν², which is the (1 - ℯ²⋅sin²φ) part of above equation. Special cases:- If φ is 0°, then m is 1.
- If φ is ±90°, then m is 0 provided that we are not in the spherical case
(otherwise we get
Double.NaN
).
- Parameters:
sinφ
- the sine of the φ latitude.- Returns:
- reciprocal squared of the radius of curvature of the ellipsoid perpendicular to the meridian at latitude φ.
-
radiusOfCurvature
final double radiusOfCurvature(double sinφ) Returns the radius of curvature of the ellipsoid perpendicular to the meridian at latitude φ. This is1/sqrt(rν2(sinφ))
.- Parameters:
sinφ
- the sine of the φ latitude.- Returns:
- radius of curvature of the ellipsoid perpendicular to the meridian at latitude φ.
-
radiusOfConformalSphere
final double radiusOfConformalSphere(double sinφ) Returns the radius of the conformal sphere (assuming a semi-major axis length of 1) at a given latitude. The radius of conformal sphere is computed from ρ, which is the radius of curvature in the meridian at latitude φ, and ν which is the radius of curvature in the prime vertical, as below:Rc = √(ρ⋅ν) = √(1 – ℯ²) / (1 – ℯ²sin²φ)
This is a function of latitude and therefore not constant. When used for spherical projections the use of φ₀ (or φ₁ as relevant to method) for φ is suggested, except if the projection is equal area when the radius of authalic sphere should be used.- Parameters:
sinφ
- the sine of the φ latitude.- Returns:
- radius of the conformal sphere at latitude φ.
-
scaleAtφ
final double scaleAtφ(double sinφ, double cosφ) Returns the scale factor at latitude φ (Snyder 14-15). This is computed as:cosφ / sqrt(rν2(sinφ))
The result is returned as adouble
because the limited precision ofsinφ
andcosφ
makes the error term meaningless. We use double-double arithmetic only for intermediate calculation.- Parameters:
sinφ
- the sine of the φ latitude.cosφ
- the cosine of the φ latitude.- Returns:
- scale factor at latitude φ.
-