This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git commit f6c88a18924385d67fe867e9932c4f741874da13 Author: Martin Desruisseaux AuthorDate: Thu Apr 9 14:59:01 2020 +0200 Add missing parameters in the internal `toString()` representation of some map projections. --- .../sis/referencing/datum/DefaultEllipsoid.java | 7 ---- .../operation/projection/AzimuthalEquidistant.java | 44 +++++++++++----------- .../operation/projection/Orthographic.java | 37 ++++++++++-------- .../operation/projection/SatelliteTracking.java | 21 +++++++++++ 4 files changed, 65 insertions(+), 44 deletions(-) diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java index e272c20..9337dd0 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java @@ -124,13 +124,6 @@ public class DefaultEllipsoid extends AbstractIdentifiedObject implements Ellips private static final long serialVersionUID = -1149451543954764081L; /** - * Tolerance threshold for comparing floating point numbers. - * - * @see Numerics#COMPARISON_THRESHOLD - */ - private static final double COMPARISON_THRESHOLD = 1E-10; - - /** * The equatorial radius. This field should be considered as final. * It is modified only by JAXB at unmarshalling time. * diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/AzimuthalEquidistant.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/AzimuthalEquidistant.java index c4123bd..987ac81 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/AzimuthalEquidistant.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/AzimuthalEquidistant.java @@ -125,6 +125,28 @@ public class AzimuthalEquidistant extends NormalizedProjection { } /** + * Returns the names of additional internal parameters which need to be taken in account when + * comparing two {@code AzimuthalEquidistant} projections or formatting them in debug mode. + * + *

We could report any of the internal parameters. But since they are all derived from φ₀ and + * the {@linkplain #eccentricity eccentricity} and since the eccentricity is already reported by + * the super-class, we report only φ₀ as a representative of the internal parameters.

+ */ + @Override + final String[] getInternalParameterNames() { + return new String[] {"φ₀"}; + } + + /** + * Returns the values of additional internal parameters which need to be taken in account when + * comparing two {@code AzimuthalEquidistant} projections or formatting them in debug mode. + */ + @Override + final double[] getInternalParameterValues() { + return new double[] {(cosφ0 < PI/4) ? acos(cosφ0) : asin(sinφ0)}; + } + + /** * Converts the specified (λ,φ) coordinate and stores the (x,y) result in {@code dstPts}. * * @param srcPts source point coordinate, as (longitude, latitude) in radians. @@ -200,26 +222,4 @@ public class AzimuthalEquidistant extends NormalizedProjection { dstPts[dstOff ] = atan2(x*sinD, (cosφ0*cosD*D - sinφ0*sinD*y)); dstPts[dstOff+1] = asin(cosD*sinφ0 + sinD*cosφ0*y/D); } - - /** - * Returns the names of additional internal parameters which need to be taken in account when - * comparing two {@code AzimuthalEquidistant} projections or formatting them in debug mode. - * - *

We could report any of the internal parameters. But since they are all derived from φ₀ and - * the {@linkplain #eccentricity eccentricity} and since the eccentricity is already reported by - * the super-class, we report only φ₀ as a representative of the internal parameters.

- */ - @Override - final String[] getInternalParameterNames() { - return new String[] {"φ₀"}; - } - - /** - * Returns the values of additional internal parameters which need to be taken in account when - * comparing two {@code ObliqueStereographic} projections or formatting them in debug mode. - */ - @Override - final double[] getInternalParameterValues() { - return new double[] {(cosφ0 < PI/4) ? acos(cosφ0) : asin(sinφ0)}; - } } diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Orthographic.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Orthographic.java index 1b77965..ad0a9b8 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Orthographic.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Orthographic.java @@ -17,7 +17,6 @@ package org.apache.sis.referencing.operation.projection; import java.util.EnumMap; -import org.apache.sis.internal.util.Numerics; import org.opengis.referencing.operation.Matrix; import org.opengis.referencing.operation.OperationMethod; import org.opengis.parameter.ParameterDescriptor; @@ -25,7 +24,6 @@ import org.apache.sis.parameter.Parameters; import org.apache.sis.referencing.operation.matrix.Matrix2; import org.apache.sis.referencing.operation.matrix.MatrixSIS; import org.apache.sis.referencing.operation.transform.ContextualParameters; -import org.apache.sis.util.ComparisonMode; import org.apache.sis.util.Workaround; import static java.lang.Math.*; @@ -125,6 +123,28 @@ public class Orthographic extends NormalizedProjection { } /** + * Returns the names of additional internal parameters which need to be taken in account when + * comparing two {@code Orthographic} projections or formatting them in debug mode. + * + *

We could report any of the internal parameters. But since they are all derived from φ₀ and + * the {@linkplain #eccentricity eccentricity} and since the eccentricity is already reported by + * the super-class, we report only φ₀ as a representative of the internal parameters.

+ */ + @Override + final String[] getInternalParameterNames() { + return new String[] {"φ₀"}; + } + + /** + * Returns the values of additional internal parameters which need to be taken in account when + * comparing two {@code Orthographic} projections or formatting them in debug mode. + */ + @Override + final double[] getInternalParameterValues() { + return new double[] {(cosφ0 < PI/4) ? acos(cosφ0) : asin(sinφ0)}; + } + + /** * Converts the specified (λ,φ) coordinate and stores the (x,y) result in {@code dstPts}. * The units of measurement are implementation-specific (see super-class javadoc). * @@ -245,17 +265,4 @@ public class Orthographic extends NormalizedProjection { dstPts[dstOff] = IEEEremainder(dstPts[dstOff], PI); } } - - /** - * Compares the given object with this transform for equivalence. - */ - @Override - public boolean equals(final Object object, final ComparisonMode mode) { - if (super.equals(object, mode)) { - final Orthographic that = (Orthographic) object; - return Numerics.epsilonEqual(sinφ0, that.sinφ0, mode) && - Numerics.epsilonEqual(cosφ0, that.cosφ0, mode); - } - return false; - } } diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/SatelliteTracking.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/SatelliteTracking.java index 430e92f..b37513c 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/SatelliteTracking.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/SatelliteTracking.java @@ -226,6 +226,27 @@ public class SatelliteTracking extends NormalizedProjection { } /** + * Returns the names of additional internal parameters which need to be taken in account when + * comparing two {@code SatelliteTracking} projections or formatting them in debug mode. + */ + @Override + final String[] getInternalParameterNames() { + return new String[] {"i", "P₂∕P₁"}; + } + + /** + * Returns the values of additional internal parameters which need to be taken in account when + * comparing two {@code SatelliteTracking} projections or formatting them in debug mode. + */ + @Override + final double[] getInternalParameterValues() { + return new double[] { + (cos_i < PI/4) ? acos(cos_i) : asin(sin_i), + p2_on_p1 + }; + } + + /** * Computes the F₁ or F₂ coefficient using Snyder equation 28-9. Note that this is the same equation * than F₁′ in above cylindrical case, but with the addition of arc-tangent. This value is constant * after construction time.