sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] branch geoapi-4.0 updated: Remove more deprecated methods: DefaultEllipsoid.orthodromicDistance, XML.DEFAULT_NAMESPACE.
Date Thu, 12 Sep 2019 18:01:39 GMT
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


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new 1cbed34  Remove more deprecated methods: DefaultEllipsoid.orthodromicDistance, XML.DEFAULT_NAMESPACE.
1cbed34 is described below

commit 1cbed343fb9d653fbecbbcbe175b51a09cfcf062
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Thu Sep 12 19:55:05 2019 +0200

    Remove more deprecated methods: DefaultEllipsoid.orthodromicDistance, XML.DEFAULT_NAMESPACE.
---
 .../apache/sis/internal/metadata/Identifiers.java  |   4 +-
 .../apache/sis/metadata/iso/DefaultIdentifier.java |   2 +-
 .../sis/metadata/iso/citation/Citations.java       |  24 +----
 .../java/org/apache/sis/xml/MarshallerPool.java    |   8 +-
 .../src/main/java/org/apache/sis/xml/XML.java      |  11 --
 .../main/java/org/apache/sis/xml/package-info.java |   2 +-
 .../java/org/apache/sis/referencing/CommonCRS.java |   4 +-
 .../apache/sis/referencing/IdentifiedObjects.java  |   4 +-
 .../sis/referencing/datum/DefaultEllipsoid.java    | 119 ---------------------
 .../org/apache/sis/referencing/datum/Sphere.java   |  28 +----
 .../apache/sis/referencing/datum/package-info.java |   3 +-
 .../org/apache/sis/referencing/package-info.java   |   2 +-
 .../referencing/datum/DefaultEllipsoidTest.java    |  81 --------------
 .../test/integration/CoordinateOperationTest.java  |  79 +++++---------
 .../java/org/apache/sis/util/CharSequences.java    |   2 +-
 15 files changed, 40 insertions(+), 333 deletions(-)

diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/Identifiers.java
b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/Identifiers.java
index 46f7f1f..1fb8556 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/Identifiers.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/Identifiers.java
@@ -91,10 +91,10 @@ public final class Identifiers extends Static {
      * <ul>
      *   <li>For information purpose (e.g. some {@code toString()} methods), use {@code
getIdentifier(…, false)}.</li>
      *   <li>For WKT formatting, use {@code getIdentifier(…, true)} in order to preserve
formatting characters.</li>
-     *   <li>For assigning a value to a {@code codeSpace} field, use {@link Citations#getUnicodeIdentifier(Citation)}.</li>
+     *   <li>For assigning a value to a {@code codeSpace} field, use {@link Citations#toCodeSpace(Citation)}.</li>
      * </ul>
      *
-     * Use {@code getUnicodeIdentifier(…)} method when assigning values to be returned
by methods like
+     * Use {@code toCodeSpace(…)} method when assigning values to be returned by methods
like
      * {@link Identifier#getCodeSpace()}, since those values are likely to be compared without
special
      * care about ignorable identifier characters. But if the intent is to format a more
complex string
      * like WKT or {@code toString()}, then we suggest to use {@code getIdentifier(citation,
true)} instead,
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java
b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java
index 55e5be1..c7d7e8a 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java
@@ -196,7 +196,7 @@ public class DefaultIdentifier extends ISOMetadata implements Identifier
{
      * @param authority  the the person or party responsible for maintenance of the namespace,
or {@code null} if none.
      * @param code       the alphanumeric value identifying an instance in the namespace,
or {@code null} if none.
      *
-     * @see org.apache.sis.metadata.iso.citation.Citations#getUnicodeIdentifier(Citation)
+     * @see org.apache.sis.metadata.iso.citation.Citations#toCodeSpace(Citation)
      */
     public DefaultIdentifier(final Citation authority, final String code) {
         this.authority = authority;
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
index 67c24d4..6a83995 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
@@ -25,7 +25,6 @@ import java.util.Locale;
 import org.opengis.util.InternationalString;
 import org.opengis.metadata.Identifier;
 import org.opengis.metadata.citation.Citation;
-import org.opengis.referencing.IdentifiedObject;                // For javadoc
 import org.apache.sis.util.Static;
 import org.apache.sis.util.Characters;
 import org.apache.sis.util.CharSequences;
@@ -78,7 +77,7 @@ import static org.apache.sis.internal.util.CollectionsExt.nonEmptyIterator;
  * </ul>
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 1.0
+ * @version 1.1
  * @since   0.3
  * @module
  */
@@ -810,27 +809,6 @@ public final class Citations extends Static {
     }
 
     /**
-     * Infers a valid Unicode identifier from the given citation, or returns {@code null}
if none.
-     *
-     * @param  citation  the citation for which to get the Unicode identifier, or {@code
null}.
-     * @return a non-empty Unicode identifier for the given citation without leading or trailing
whitespaces,
-     *         or {@code null} if the given citation is null or does not have any Unicode
identifier or title.
-     *
-     * @see org.apache.sis.referencing.ImmutableIdentifier
-     * @see org.apache.sis.referencing.IdentifiedObjects#getSimpleNameOrIdentifier(IdentifiedObject)
-     * @see org.apache.sis.util.CharSequences#isUnicodeIdentifier(CharSequence)
-     *
-     * @since 0.6
-     *
-     * @deprecated Replaced by {@link #toCodeSpace(Citation)} in order to reduce the risk
of inconsistent
-     *             behavior if those two methods are mixed.
-     */
-    @Deprecated
-    public static String getUnicodeIdentifier(final Citation citation) {
-        return removeIgnorableCharacters(Identifiers.getIdentifier(citation, true));
-    }
-
-    /**
      * Infers a code space from the given citation, or returns {@code null} if none.
      * This method is useful for extracting a short designation of an authority (e.g. {@code
"EPSG"})
      * for processing purpose. This method performs the following actions:
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/xml/MarshallerPool.java b/core/sis-metadata/src/main/java/org/apache/sis/xml/MarshallerPool.java
index b40c1c2..2c1528c 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/xml/MarshallerPool.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/xml/MarshallerPool.java
@@ -59,7 +59,7 @@ import org.apache.sis.util.CharSequences;
  * from multiple threads.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.1
  *
  * @see XML
  * @see <a href="http://jaxb.java.net/guide/Performance_and_thread_safety.html">JAXB
Performance and thread-safety</a>
@@ -187,11 +187,7 @@ public class MarshallerPool {
          * Prepares a copy of the property map (if any), then removes the
          * properties which are handled especially by this constructor.
          */
-        template = new PooledTemplate(properties, implementation);
-        final Object rootNamespace = template.remove(XML.DEFAULT_NAMESPACE, null);
-        if (rootNamespace != null) {
-            Logging.getLogger(Loggers.XML).warning(XML.DEFAULT_NAMESPACE + " property is
no longer supported.");
-        }
+        template           = new PooledTemplate(properties, implementation);
         marshallers        = new ConcurrentLinkedDeque<>();
         unmarshallers      = new ConcurrentLinkedDeque<>();
         isRemovalScheduled = new AtomicBoolean();
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/xml/XML.java b/core/sis-metadata/src/main/java/org/apache/sis/xml/XML.java
index 1e684bf..eeda0be 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/xml/XML.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/xml/XML.java
@@ -75,7 +75,6 @@ import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
  *   <tr><td>{@link #LOCALE}</td>             <td>{@link Locale}</td>
           <td>for specifying the locale to use for international strings and code lists.</td></tr>
  *   <tr><td>{@link #TIMEZONE}</td>           <td>{@link TimeZone}</td>
         <td>for specifying the timezone to use for dates and times.</td></tr>
  *   <tr><td>{@link #SCHEMAS}</td>            <td>{@link Map}</td>
              <td>for specifying the root URL of metadata schemas to use.</td></tr>
- *   <tr><td>{@link #DEFAULT_NAMESPACE}</td>  <td>{@link String}</td>
           <td>for specifying the default namespace of the XML document to write.</td></tr>
  *   <tr><td>{@link #GML_VERSION}</td>        <td>{@link Version}</td>
          <td>for specifying the GML version of the document to be (un)marshalled.</td></tr>
  *   <tr><td>{@link #METADATA_VERSION}</td>   <td>{@link Version}</td>
          <td>for specifying the metadata version of the document to be (un)marshalled.</td></tr>
  *   <tr><td>{@link #RESOLVER}</td>           <td>{@link ReferenceResolver}</td>
<td>for replacing {@code xlink} or {@code uuidref} attributes by the actual object to
use.</td></tr>
@@ -176,16 +175,6 @@ public final class XML extends Static {
     // If more keys are documented, update the Pooled.SCHEMAS_KEY array.
 
     /**
-     * Specifies the default namespace of the XML document to write.
-     * An example of value for this key is {@code "http://www.isotc211.org/2005/gmd"}.
-     *
-     * @deprecated This property is no longer honored by Apache SIS 1.0.
-     *             Use {@link javax.xml.bind.annotation.XmlSchema} instead.
-     */
-    @Deprecated
-    public static final String DEFAULT_NAMESPACE = "org.apache.sis.xml.defaultNamespace";
-
-    /**
      * Specifies the GML version of the document to be marshalled or unmarshalled.
      * The GML version may affect the set of XML elements to be marshalled and their namespaces.
      * Note that GML 3.2 is identical to ISO 19136:2007.
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/xml/package-info.java b/core/sis-metadata/src/main/java/org/apache/sis/xml/package-info.java
index 64b3978..1fd8e46 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/xml/package-info.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/xml/package-info.java
@@ -59,7 +59,7 @@
  * @author  Guilhem Legal (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Cullen Rombach (Image Matters)
- * @version 1.0
+ * @version 1.1
  * @since   0.3
  * @module
  */
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
index 578e2c9..f266bdb 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
@@ -286,9 +286,7 @@ public enum CommonCRS {
             (short) 0, (short) 0, (short) 0, (short) 0, (byte) 0, (byte) 0),            
    // UPS and UTM info
 
     /**
-     * Unspecified datum based upon the GRS 1980 Authalic Sphere. Spheres use a simpler algorithm
for
-     * {@linkplain org.apache.sis.referencing.datum.DefaultEllipsoid#orthodromicDistance
-     * orthodromic distance computation}, which may be faster and more robust.
+     * Unspecified datum based upon the GRS 1980 Authalic Sphere.
      *
      * <blockquote><table class="compact">
      * <caption>Sphere properties</caption>
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
index 8c992a4..fc91821 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
@@ -56,7 +56,7 @@ import static org.apache.sis.internal.util.CollectionsExt.iterator;
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Guilhem Legal (Geomatys)
- * @version 1.0
+ * @version 1.1
  *
  * @see CRS
  * @see org.apache.sis.geometry.Envelopes
@@ -345,7 +345,7 @@ public final class IdentifiedObjects extends Static {
      * @return the first name, alias or identifier which is a valid Unicode identifier, or
{@code null} if none.
      *
      * @see ImmutableIdentifier
-     * @see Citations#getUnicodeIdentifier(Citation)
+     * @see Citations#toCodeSpace(Citation)
      * @see CharSequences#isUnicodeIdentifier(CharSequence)
      *
      * @since 1.0
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 1aa2ec7..a004719 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
@@ -29,14 +29,12 @@ import org.opengis.util.GenericName;
 import org.opengis.util.InternationalString;
 import org.opengis.metadata.Identifier;
 import org.opengis.referencing.datum.Ellipsoid;
-import org.apache.sis.geometry.DirectPosition2D;
 import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.internal.util.DoubleDouble;
 import org.apache.sis.internal.jaxb.gml.Measure;
 import org.apache.sis.internal.jaxb.referencing.SecondDefiningParameter;
 import org.apache.sis.internal.metadata.MetadataUtilities;
 import org.apache.sis.internal.referencing.Formulas;
-import org.apache.sis.internal.referencing.Resources;
 import org.apache.sis.internal.referencing.WKTKeywords;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.AbstractIdentifiedObject;
@@ -46,7 +44,6 @@ import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.Utilities;
 import org.apache.sis.measure.Units;
 
-import static java.lang.Math.*;
 import static java.lang.Double.*;
 import static org.apache.sis.util.ArgumentChecks.ensureStrictlyPositive;
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
@@ -71,10 +68,6 @@ import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
  *   <li>{@linkplain #getEccentricity() eccentricity}</li>
  * </ul>
  *
- * <div class="section">Distance calculations</div>
- * This class contains an {@link #orthodromicDistance(double, double, double, double)} convenience
method
- * for calculating distances on great circles.
- *
  * <div class="section">Creating new ellipsoid instances</div>
  * New instances can be created either directly by specifying all information to a factory
method (choices 3
  * and 4 below), or indirectly by specifying the identifier of an entry in a database (choices
1 and 2 below).
@@ -131,16 +124,6 @@ public class DefaultEllipsoid extends AbstractIdentifiedObject implements
Ellips
     private static final long serialVersionUID = -1149451543954764081L;
 
     /**
-     * Maximum number of iterations in the {@link #orthodromicDistance(double, double, double,
double)} method.
-     */
-    private static final int MAX_ITERATIONS = 100;
-
-    /**
-     * Small tolerance value for {@link #orthodromicDistance(double, double, double, double)}.
-     */
-    private static final double EPS = 0.5E-13;
-
-    /**
      * Tolerance threshold for comparing floating point numbers.
      *
      * @see Numerics#COMPARISON_THRESHOLD
@@ -523,108 +506,6 @@ public class DefaultEllipsoid extends AbstractIdentifiedObject implements
Ellips
     }
 
     /**
-     * Returns the orthodromic distance between two geographic coordinates.
-     * The orthodromic distance is the shortest distance between two points on a ellipsoid's
surface.
-     * The orthodromic path is always on a great circle.
-     *
-     * <div class="note"><b>Note:</b>
-     * Orthodromic distances are different than the <cite>loxodromic distance</cite>.
-     * The later is a longer distance on a path with a constant direction on the compass.</div>
-     *
-     * @param  λ1  longitude of first  point (in decimal degrees).
-     * @param  φ1  latitude  of first  point (in decimal degrees).
-     * @param  λ2  longitude of second point (in decimal degrees).
-     * @param  φ2  latitude  of second point (in decimal degrees).
-     * @return the orthodromic distance (in the units of this ellipsoid's axis).
-     *
-     * @deprecated Replaced by {@link org.apache.sis.referencing.GeodeticCalculator}.
-     *
-     * @see <a href="https://issues.apache.org/jira/browse/SIS-386">SIS-386</a>
-     */
-    @Deprecated
-    public double orthodromicDistance(double λ1, double φ1, double λ2, double φ2) {
-        λ1 = toRadians(λ1);
-        φ1 = toRadians(φ1);
-        λ2 = toRadians(λ2);
-        φ2 = toRadians(φ2);
-        /*
-         * Solution of the geodetic inverse problem after T.Vincenty.
-         * Modified Rainsford's method with Helmert's elliptical terms.
-         * Effective in any azimuth and at any distance short of antipodal.
-         *
-         * Latitudes and longitudes in radians positive North and East.
-         * Forward azimuths at both points returned in radians from North.
-         *
-         * Programmed for CDC-6600 by LCDR L.Pfeifer NGS ROCKVILLE MD 18FEB75
-         * Modified for IBM SYSTEM 360 by John G.Gergen NGS ROCKVILLE MD 7507
-         * Ported from Fortran to Java by Martin Desruisseaux.
-         *
-         * Source: ftp://ftp.ngs.noaa.gov/pub/pcsoft/for_inv.3d/source/inverse.for
-         *         subroutine INVER1
-         */
-        final double F = 1 / getInverseFlattening();
-        final double R = 1 - F;
-
-        double tu1 = R * tan(φ1);
-        double tu2 = R * tan(φ2);
-        double cu1 = 1 / sqrt(tu1*tu1 + 1);
-        double cu2 = 1 / sqrt(tu2*tu2 + 1);
-        double su1 = cu1 * tu1;
-        double s   = cu1 * cu2;
-        double baz =   s * tu2;
-        double faz = baz * tu1;
-        double x   =  λ2 - λ1;
-        for (int i=0; i<MAX_ITERATIONS; i++) {
-            final double sx = sin(x);
-            final double cx = cos(x);
-            tu1 = cu2 * sx;
-            tu2 = baz - su1*cu2*cx;
-            final double sy = hypot(tu1, tu2);
-            final double cy = s*cx + faz;
-            final double y = atan2(sy, cy);
-            final double SA = s * (sx/sy);
-            final double c2a = 1 - SA*SA;
-            double cz = 2*faz;
-            if (c2a > 0) {
-                cz = -cz/c2a + cy;
-            }
-            double e = cz*cz*2 - 1;
-            double c = ((-3*c2a+4)*F + 4) * c2a * F/16;
-            double d = x;
-            x = ((e*cy*c+cz)*sy*c + y) * SA;
-            x = (1-c)*x*F + λ2-λ1;
-
-            if (abs(d-x) <= EPS) {
-                x = sqrt((1/(R*R) - 1) * c2a + 1) + 1;
-                x = (x-2)/x;
-                c = 1-x;
-                c = (x*x/4 + 1)/c;
-                d = (0.375*x*x - 1)*x;
-                x = e*cy;
-                s = 1 - 2*e;
-                s = ((((sy*sy*4 - 3)*s*cz*d/6-x)*d/4+cz)*sy*d+y)*c*R * getSemiMajorAxis();
-                return s;
-            }
-        }
-        // No convergence. It may be because coordinate points
-        // are equals or because they are at antipodes.
-        if (abs(λ1-λ2) <= COMPARISON_THRESHOLD && abs(φ1-φ2) <= COMPARISON_THRESHOLD)
{
-            return 0; // Coordinate points are equals
-        }
-        if (abs(φ1) <= COMPARISON_THRESHOLD && abs(φ2) <= COMPARISON_THRESHOLD)
{
-            return abs(λ1-λ2) * getSemiMajorAxis(); // Points are on the equator.
-        }
-        // At least one input coordinate is NaN.
-        if (isNaN(λ1) || isNaN(φ1) || isNaN(λ2) || isNaN(φ2)) {
-            return NaN;
-        }
-        // Other cases: no solution for this algorithm.
-        throw new ArithmeticException(Resources.format(Resources.Keys.NoConvergenceForPoints_2,
-                  new DirectPosition2D(toDegrees(λ1), toDegrees(φ1)),
-                  new DirectPosition2D(toDegrees(λ2), toDegrees(φ2))));
-    }
-
-    /**
      * Returns the difference between the semi-major axis length of two ellipsoids.
      * If the two ellipsoid does not use the same unit of measurement, than the axis
      * length of the other ellipsoid is converted into the units of this ellipsoid axis.
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/Sphere.java
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/Sphere.java
index 436aa5c..4fbfb8b 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/Sphere.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/Sphere.java
@@ -26,8 +26,7 @@ import static java.lang.Math.*;
 
 
 /**
- * A ellipsoid which is spherical. This ellipsoid implements a faster
- * {@link #orthodromicDistance(double, double, double, double)} method.
+ * A ellipsoid which is spherical.
  *
  * <div class="section">Immutability and thread safety</div>
  * This class is immutable and thus thread-safe if the property <em>values</em>
(not necessarily the map itself)
@@ -35,7 +34,7 @@ import static java.lang.Math.*;
  * all components were created using only SIS factories and static constants.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 0.7
+ * @version 1.1
  * @since   0.4
  * @module
  */
@@ -98,27 +97,4 @@ final class Sphere extends DefaultEllipsoid {
         return 1 / other.getInverseFlattening();
     }
 
-    /**
-     * Returns the orthodromic distance between two geographic coordinates.
-     * The orthodromic distance is the shortest distance between two points
-     * on a sphere's surface. The orthodromic path is always on a great circle.
-     *
-     * @param  λ1  longitude of first point (in decimal degrees).
-     * @param  φ1  latitude of first point (in decimal degrees).
-     * @param  λ2  longitude of second point (in decimal degrees).
-     * @param  φ2  latitude of second point (in decimal degrees).
-     * @return the orthodromic distance (in the units of this ellipsoid's axis).
-     */
-    @Override
-    @Deprecated
-    public double orthodromicDistance(double λ1, double φ1, double λ2, double φ2) {
-        φ1 = toRadians(φ1);
-        φ2 = toRadians(φ2);
-        final double dx = toRadians(abs(λ2-λ1) % 360);
-        double rho = sin(φ1)*sin(φ2) + cos(φ1)*cos(φ2)*cos(dx);
-        assert abs(rho) < 1.0000001 : rho;
-        if (rho > +1) rho = +1;                         // Catch rounding error.
-        if (rho < -1) rho = -1;                         // Catch rounding error.
-        return acos(rho) * getSemiMajorAxis();
-    }
 }
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/package-info.java
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/package-info.java
index 9c4be13..f67a13e 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/package-info.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/package-info.java
@@ -32,7 +32,6 @@
  * <ul>
  *   <li>{@link org.apache.sis.referencing.datum.DefaultEllipsoid#getAuthalicRadius()}</li>
  *   <li>{@link org.apache.sis.referencing.datum.DefaultEllipsoid#getEccentricity()}</li>
- *   <li>{@link org.apache.sis.referencing.datum.DefaultEllipsoid#orthodromicDistance(double,
double, double, double)}</li>
  *   <li>{@link org.apache.sis.referencing.datum.DefaultPrimeMeridian#getGreenwichLongitude(javax.measure.Unit)
  *       DefaultPrimeMeridian.getGreenwichLongitude(Unit)}</li>
  *   <li>{@link org.apache.sis.referencing.datum.DefaultGeodeticDatum#getBursaWolfParameters()}</li>
@@ -54,7 +53,7 @@
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Cédric Briançon (Geomatys)
- * @version 0.7
+ * @version 1.1
  * @since   0.4
  * @module
  */
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java
index f4a7ba6..973fcd9 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/package-info.java
@@ -94,7 +94,7 @@
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Guilhem Legal (Geomatys)
- * @version 1.0
+ * @version 1.1
  * @since   0.4
  * @module
  */
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java
b/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java
index 893e79d..83a6f54 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java
@@ -19,16 +19,11 @@ package org.apache.sis.referencing.datum;
 import java.util.Random;
 import javax.xml.bind.JAXBException;
 import org.apache.sis.measure.Units;
-import org.apache.sis.measure.Latitude;
 import org.apache.sis.measure.Longitude;
-import org.apache.sis.referencing.IdentifiedObjects;
-import org.apache.sis.test.TestUtilities;
 import org.apache.sis.test.xml.TestCase;
 import org.apache.sis.test.DependsOn;
-import org.apache.sis.test.DependsOnMethod;
 import org.junit.Test;
 
-import static java.lang.StrictMath.*;
 import static org.apache.sis.test.ReferencingAssert.*;
 
 
@@ -114,82 +109,6 @@ public final strictfp class DefaultEllipsoidTest extends TestCase {
     }
 
     /**
-     * Tests the orthodromic distances computed by {@link DefaultEllipsoid}. There is actually
two algorithms:
-     * one for the ellipsoidal model, and a simpler one for spherical model. This method
tests the ellipsoidal
-     * model using known values of nautical mile at different latitude.
-     *
-     * <p>This method performs the test on the Clark 1866 ellipsoid, which was the
basis for the Imperial and
-     * U.S. definitions prior the First International Extraordinary Hydrographic Conference
in Monaco (1929).</p>
-     */
-    @Test
-    public void testOrthodromicDistance() {
-        final DefaultEllipsoid e = new DefaultEllipsoid(GeodeticDatumMock.NAD27.getEllipsoid());
// Clark 1866
-        assertEquals("Nautical mile at equator",    1842.78, e.orthodromicDistance(0,   
-HM,   0,    +HM), 0.01);
-        assertEquals("Nautical mile at North pole", 1861.67, e.orthodromicDistance(0,  90-HM*2,
0,  90   ), 0.02);
-        assertEquals("Nautical mile at South pole", 1861.67, e.orthodromicDistance(0, -90+HM*2,
0, -90   ), 0.02);
-        assertEquals("International nautical mile", 1852.00, e.orthodromicDistance(0,  45-HM,
  0,  45+HM), 0.20);
-        /*
-         * Test parallel segments of increasing length at random positions on the equator.
-         */
-        final Random random = TestUtilities.createRandomNumberGenerator();
-        final double semiMajor = e.getSemiMajorAxis();
-        for (double length = 0; length <= Longitude.MAX_VALUE; length += 0.5) {
-            final double λ = nextLongitude(random);
-            assertEquals(semiMajor * toRadians(length), e.orthodromicDistance(λ, 0, λ+length,
0), 0.2);
-        }
-    }
-
-    /**
-     * Tests the orthodromic distances computed by {@link DefaultEllipsoid} on a sphere,
-     * and compares them with the distances computed by {@link Sphere}.
-     */
-    @Test
-    @DependsOnMethod("testOrthodromicDistance")
-    public void testOrthodromicDistanceOnSphere() {
-        /*
-         * Creates instance of DefaultEllipsoid and Sphere with the same properties.
-         * Those instances will use different formulas for orthodromic distances, which we
will compare.
-         */
-        final DefaultEllipsoid e = new DefaultEllipsoid(GeodeticDatumMock.SPHERE.getEllipsoid());
-        final double radius = e.getSemiMajorAxis();
-        final Sphere s = new Sphere(IdentifiedObjects.getProperties(e), radius, false, e.getAxisUnit());
-        assertTrue(e.isSphere());
-        assertTrue(s.isSphere());
-        /*
-         * Test parallel segments of increasing length at random positions on the equator.
-         */
-        final Random random = TestUtilities.createRandomNumberGenerator();
-        for (double length = 0; length <= Longitude.MAX_VALUE; length += 0.5) {
-            final double λ = nextLongitude(random);
-            final double distance = radius * toRadians(length);
-            assertEquals(distance, s.orthodromicDistance(λ, 0, λ+length, 0), SPHERICAL_TOLERANCE);
-            assertEquals(distance, e.orthodromicDistance(λ, 0, λ+length, 0), SPHERICAL_TOLERANCE);
-        }
-        /*
-         * Test meridian segments from equator to increasing latitudes.
-         */
-        for (double φ = Latitude.MIN_VALUE; φ <= Latitude.MAX_VALUE; φ += 0.5) {
-            final double λ = nextLongitude(random);
-            final double distance = radius * toRadians(abs(φ));
-            assertEquals(distance, s.orthodromicDistance(λ, 0, λ, φ), SPHERICAL_TOLERANCE);
-            assertEquals(distance, e.orthodromicDistance(λ, 0, λ, φ), SPHERICAL_TOLERANCE);
-        }
-        /*
-         * Tests random segments.
-         */
-        final double circumference = (radius * (1 + 1E-8)) * (2*PI);
-        for (int i=0; i<100; i++) {
-            final double φ1 =  -90 + 180*random.nextDouble();
-            final double φ2 =  -90 + 180*random.nextDouble();
-            final double λ1 = -180 + 360*random.nextDouble();
-            final double λ2 = -180 + 360*random.nextDouble();
-            final double distance = s.orthodromicDistance(λ1, φ1, λ2, φ2);
-            assertTrue(distance >= 0 && distance <= circumference);
-            assertEquals(distance, e.orthodromicDistance(λ1, φ1, λ2, φ2), SPHERICAL_TOLERANCE);
-        }
-    }
-
-    /**
      * Tests the {@link DefaultEllipsoid#getAuthalicRadius()} method on the GRS 1980 ellipsoid
(EPSG:7019).
      * The expected result is the radius of the sphere defined by EPSG:7048.
      */
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/test/integration/CoordinateOperationTest.java
b/core/sis-referencing/src/test/java/org/apache/sis/test/integration/CoordinateOperationTest.java
index aab1218..f7223d7 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/test/integration/CoordinateOperationTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/test/integration/CoordinateOperationTest.java
@@ -17,7 +17,6 @@
 package org.apache.sis.test.integration;
 
 import java.util.Random;
-import java.util.Collections;
 import org.opengis.util.FactoryException;
 import org.opengis.referencing.datum.Ellipsoid;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
@@ -28,14 +27,12 @@ import org.apache.sis.math.MathFunctions;
 import org.apache.sis.referencing.CommonCRS;
 import org.apache.sis.referencing.crs.AbstractCRS;
 import org.apache.sis.referencing.cs.AxesConvention;
-import org.apache.sis.referencing.datum.DefaultEllipsoid;
 import org.apache.sis.referencing.operation.transform.MathTransformTestCase;
 import org.apache.sis.internal.referencing.CoordinateOperations;
 import org.apache.sis.test.DependsOn;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
-import static java.lang.StrictMath.*;
 
 
 /**
@@ -43,7 +40,7 @@ import static java.lang.StrictMath.*;
  * orthodromic distances, <i>etc</i>.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 0.8
+ * @version 1.1
  * @since   0.8
  * @module
  */
@@ -91,40 +88,37 @@ public final strictfp class CoordinateOperationTest extends MathTransformTestCas
         validate();
         /*
          * Constructs an array of random points. The first 8 points
-         * are initialized to know values. Other points are left random.
+         * are initialized to know values. Other points are random.
          */
-        final double   cartesianDistance[] = new double[4];
-        final double orthodromicDistance[] = new double[4];
-        final double[] array0 = new double[900];                    // Must be divisible
by 3.
-        for (int i=0; i<array0.length; i++) {
+        final double distance[] = new double[4];
+        final double[] array0 = new double[900];                // Must be divisible by 3.
+
+        array0[0]=35.0; array0[1]=24.0; array0[2]=8000;         // 24°N 35°E 8km
+        array0[3]=34.8; array0[4]=24.7; array0[5]=5000;         // … about 80 km away
+        distance[0] = 80284.00;
+
+        // array0[6,7,8,10,11] = 0
+        array0[9]=180;                                          // Antipodes; distance should
be 2*6378.137 km
+        distance[1] = ellipsoid.getSemiMajorAxis() * 2;
+
+                       array0[13]=-90;
+        array0[15]=180; array0[16]=+90;                         // Antipodes; distance should
be 2*6356.752 km
+        distance[2] = ellipsoid.getSemiMinorAxis() * 2;
+
+        array0[18]= 95; array0[19]=-38;
+        array0[21]=-85; array0[22]=+38;                         // Antipodes
+        distance[3] = 12740147.19;
+
+        for (int i=24; i<array0.length; i++) {
             final int range;
             switch (i % 3) {
                 case 0:  range =   360; break;                      // Longitude
                 case 1:  range =   180; break;                      // Latitidue
                 case 2:  range = 10000; break;                      // Altitude
-                default: range =     0; break;                      // Should not happen
+                default: throw new AssertionError(i);
             }
             array0[i] = random.nextDouble() * range - (range/2);
         }
-        array0[0]=35.0; array0[1]=24.0; array0[2]=8000;             // 24°N 35°E 8km
-        array0[3]=34.8; array0[4]=24.7; array0[5]=5000;             // … about 80 km away
-        cartesianDistance  [0] = 80284.00;
-        orthodromicDistance[0] = 80302.99;                          // Not really exact.
-
-        array0[6]=  0; array0[ 7]=0.0; array0[ 8]=0;
-        array0[9]=180; array0[10]=0.0; array0[11]=0;                // Antipodes; distance
should be 2*6378.137 km
-        cartesianDistance  [1] = ellipsoid.getSemiMajorAxis() * 2;
-        orthodromicDistance[1] = ellipsoid.getSemiMajorAxis() * PI;
-
-        array0[12]=  0; array0[13]=-90; array0[14]=0;
-        array0[15]=180; array0[16]=+90; array0[17]=0;               // Antipodes; distance
should be 2*6356.752 km
-        cartesianDistance  [2] = ellipsoid.getSemiMinorAxis() * 2;
-        orthodromicDistance[2] = 20003931.46;
-
-        array0[18]= 95; array0[19]=-38; array0[20]=0;
-        array0[21]=-85; array0[22]=+38; array0[23]=0;               // Antipodes
-        cartesianDistance  [3] = 12740147.19;
-        orthodromicDistance[3] = 20003867.86;
         /*
          * Transforms all points, and then inverse transform them. The resulting
          * array2 should be equal to array0 except for rounding errors. We tolerate
@@ -141,7 +135,6 @@ public final strictfp class CoordinateOperationTest extends MathTransformTestCas
         }
         /*
          * Compares the distances between "special" points with expected distances.
-         * This tests the ellipsoid orthodromic distance computation as well.
          * We require a precision of 10 centimetres.
          */
         for (int i=0; i < array0.length / 6; i++) {
@@ -150,30 +143,8 @@ public final strictfp class CoordinateOperationTest extends MathTransformTestCas
                     array1[base+0] - array1[base+3],
                     array1[base+1] - array1[base+4],
                     array1[base+2] - array1[base+5]);
-            if (i < cartesianDistance.length) {
-                assertEquals("Cartesian distance", cartesianDistance[i], cartesian, 0.1);
-            }
-            /*
-             * Compares with orthodromic distance. Distance is computed using an ellipsoid
-             * at the maximal altitude (i.e. the length of semi-major axis is increased to
-             * fit the maximal altitude).
-             */
-            try {
-                final double altitude = max(array0[base+2], array0[base+5]);
-                final DefaultEllipsoid ellip = DefaultEllipsoid.createFlattenedSphere(
-                        Collections.singletonMap(Ellipsoid.NAME_KEY, "Temporary"),
-                        ellipsoid.getSemiMajorAxis() + altitude,
-                        ellipsoid.getInverseFlattening(),
-                        ellipsoid.getAxisUnit());
-                double orthodromic = ellip.orthodromicDistance(array0[base+0], array0[base+1],
-                                                               array0[base+3], array0[base+4]);
-                orthodromic = hypot(orthodromic, array0[base+2] - array0[base+5]);
-                if (i < orthodromicDistance.length) {
-                    assertEquals("Orthodromic distance", orthodromicDistance[i], orthodromic,
0.1);
-                }
-                assertTrue("Distance consistency", cartesian <= orthodromic);
-            } catch (ArithmeticException exception) {
-                // Orthodromic distance computation didn't converge. Ignore...
+            if (i < distance.length) {
+                assertEquals("Cartesian distance", distance[i], cartesian, 0.1);
             }
         }
     }
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java b/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
index 9ea0e55..1e2739f 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
@@ -1544,7 +1544,7 @@ cmp:    while (ia < lga) {
      * @return {@code true} if the given character sequence is a legal Unicode identifier.
      *
      * @see org.apache.sis.referencing.ImmutableIdentifier
-     * @see org.apache.sis.metadata.iso.citation.Citations#getUnicodeIdentifier(Citation)
+     * @see org.apache.sis.metadata.iso.citation.Citations#toCodeSpace(Citation)
      * @see org.apache.sis.referencing.IdentifiedObjects#getSimpleNameOrIdentifier(IdentifiedObject)
      */
     public static boolean isUnicodeIdentifier(final CharSequence identifier) {


Mime
View raw message