sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 01/02: Avoid connection to EPSG database for GeodeticCalculator tests.
Date Sat, 25 May 2019 12:55:54 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

commit 74ffaef8ca66d4ba9d15ed279ad428890a07ddfa
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Sat May 25 10:37:32 2019 +0200

    Avoid connection to EPSG database for GeodeticCalculator tests.
---
 .../sis/referencing/GeodeticCalculatorTest.java    |  7 +++---
 .../apache/sis/referencing/crs/HardCodedCRS.java   | 25 +++++++++++++++-------
 2 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticCalculatorTest.java
b/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticCalculatorTest.java
index 0980a66..43b871d 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticCalculatorTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticCalculatorTest.java
@@ -30,6 +30,7 @@ import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.operation.TransformException;
 import org.apache.sis.internal.referencing.j2d.ShapeUtilitiesExt;
 import org.apache.sis.internal.referencing.Formulas;
+import org.apache.sis.referencing.crs.HardCodedCRS;
 import org.apache.sis.geometry.DirectPosition2D;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.math.StatisticsFormat;
@@ -94,9 +95,7 @@ public final strictfp class GeodeticCalculatorTest extends TestCase {
      * @param  normalized  whether to force (longitude, latitude) axis order.
      */
     private static GeodeticCalculator create(final boolean normalized) {
-        return new GeodeticCalculator(normalized
-                ? CommonCRS.SPHERE.normalizedGeographic()
-                : CommonCRS.SPHERE.geographic());
+        return new GeodeticCalculator(normalized ? HardCodedCRS.SPHERE : HardCodedCRS.SPHERE_φλ);
     }
 
     /**
@@ -377,7 +376,7 @@ public final strictfp class GeodeticCalculatorTest extends TestCase {
     @Test
     public void compareAgainstDataset() throws IOException, TransformException {
         try (LineNumberReader reader = OptionalTestData.GEODESIC.reader()) {
-            final GeodeticCalculator c = new GeodeticCalculator(CommonCRS.WGS84.geographic());
+            final GeodeticCalculator c = new GeodeticCalculator(HardCodedCRS.WGS84_φλ);
             final Geodesic reference = new Geodesic(Formulas.getAuthalicRadius(c.ellipsoid),
0);
             final Random random = TestUtilities.createRandomNumberGenerator();
             final double[] data = new double[7];
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java
b/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java
index 28aa9b2..e658695 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java
@@ -42,7 +42,7 @@ import static org.apache.sis.referencing.IdentifiedObjects.getProperties;
 public final strictfp class HardCodedCRS {
     /**
      * A two-dimensional geographic coordinate reference system using the WGS84 datum.
-     * This CRS uses (<var>latitude</var>, <var>longitude</var>)
ordinates with latitude values
+     * This CRS uses (<var>latitude</var>, <var>longitude</var>)
coordinates with latitude values
      * increasing towards the North and longitude values increasing towards the East.
      * The angular units are decimal degrees and the prime meridian is Greenwich.
      *
@@ -53,7 +53,7 @@ public final strictfp class HardCodedCRS {
 
     /**
      * A two-dimensional geographic coordinate reference system using the WGS84 datum.
-     * This CRS uses (<var>longitude</var>, <var>latitude</var>)
ordinates with longitude values
+     * This CRS uses (<var>longitude</var>, <var>latitude</var>)
coordinates with longitude values
      * increasing towards the East and latitude values increasing towards the North.
      * The angular units are decimal degrees and the prime meridian is Greenwich.
      *
@@ -65,7 +65,7 @@ public final strictfp class HardCodedCRS {
 
     /**
      * A three-dimensional geographic coordinate reference system using the WGS84 datum.
-     * This CRS uses (<var>longitude</var>, <var>latitude</var>,
<var>height</var>) ordinates with longitude values
+     * This CRS uses (<var>longitude</var>, <var>latitude</var>,
<var>height</var>) coordinates with longitude values
      * increasing towards East, latitude values increasing towards North and height positive
above the ellipsoid.
      * The angular units are decimal degrees, the height unit is the metre, and the prime
meridian is Greenwich.
      *
@@ -77,7 +77,7 @@ public final strictfp class HardCodedCRS {
 
     /**
      * A two-dimensional geographic coordinate reference system using the Paris prime meridian.
-     * This CRS uses (<var>longitude</var>, <var>latitude</var>)
ordinates with longitude values
+     * This CRS uses (<var>longitude</var>, <var>latitude</var>)
coordinates with longitude values
      * increasing towards the East and latitude values increasing towards the North.
      * The angular units for the prime meridian and the axes are grads.
      *
@@ -92,7 +92,7 @@ public final strictfp class HardCodedCRS {
 
     /**
      * A two-dimensional geographic coordinate reference system using the Paris prime meridian.
-     * This CRS uses (<var>longitude</var>, <var>latitude</var>)
ordinates with longitude values
+     * This CRS uses (<var>longitude</var>, <var>latitude</var>)
coordinates with longitude values
      * increasing towards the East and latitude values increasing towards the North.
      * The angular units are decimal degrees except for the prime meridian (Paris),
      * which is measured in grads.
@@ -110,7 +110,7 @@ public final strictfp class HardCodedCRS {
 
     /**
      * A three-dimensional geographic coordinate reference system using the Tokyo datum.
-     * This CRS uses (<var>longitude</var>, <var>latitude</var>,
<var>height</var>) ordinates
+     * This CRS uses (<var>longitude</var>, <var>latitude</var>,
<var>height</var>) coordinates
      * with longitude values increasing towards the East, latitude values increasing towards
      * the North and ellipsoidal eight increasing toward up.
      * The angular units are decimal degrees and the linear units are metres.
@@ -126,7 +126,7 @@ public final strictfp class HardCodedCRS {
 
     /**
      * A two-dimensional geographic coordinate reference system using the JGD2000 datum.
-     * This CRS uses (<var>longitude</var>, <var>latitude</var>,
<var>height</var>) ordinates
+     * This CRS uses (<var>longitude</var>, <var>latitude</var>,
<var>height</var>) coordinates
      * with longitude values increasing towards the East, latitude values increasing towards
      * the North and ellipsoidal eight increasing toward up.
      * The angular units are decimal degrees and the linear units are metres.
@@ -142,7 +142,7 @@ public final strictfp class HardCodedCRS {
 
     /**
      * A two-dimensional geographic coordinate reference system using a spherical datum.
-     * This CRS uses (<var>longitude</var>, <var>latitude</var>)
ordinates with longitude values
+     * This CRS uses (<var>longitude</var>, <var>latitude</var>)
coordinates with longitude values
      * increasing towards the East and latitude values increasing towards the North.
      * The angular units are decimal degrees and the prime meridian is Greenwich.
      */
@@ -150,6 +150,15 @@ public final strictfp class HardCodedCRS {
             getProperties(HardCodedDatum.SPHERE), HardCodedDatum.SPHERE, HardCodedCS.GEODETIC_2D);
 
     /**
+     * A two-dimensional geographic coordinate reference system using a spherical datum.
+     * This CRS uses (<var>latitude</var>, <var>longitude</var>)
coordinates with latitude
+     * values increasing towards the North and longitude values increasing towards the East.
+     * The angular units are decimal degrees and the prime meridian is Greenwich.
+     */
+    public static final DefaultGeographicCRS SPHERE_φλ = new DefaultGeographicCRS(
+            getProperties(HardCodedDatum.SPHERE), HardCodedDatum.SPHERE, HardCodedCS.GEODETIC_φλ);
+
+    /**
      * A geocentric CRS with a spherical coordinate system.
      * Prime meridian is Greenwich, geodetic datum is WGS84 and linear units are metres.
      */


Mime
View raw message