sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1684662 - /sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java
Date Wed, 10 Jun 2015 12:41:38 GMT
Author: desruisseaux
Date: Wed Jun 10 12:41:38 2015
New Revision: 1684662

URL: http://svn.apache.org/r1684662
Log:
WKT: tests verify the TOWGS84 element.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java?rev=1684662&r1=1684661&r2=1684662&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java
[UTF-8] Wed Jun 10 12:41:38 2015
@@ -31,6 +31,8 @@ import org.opengis.referencing.datum.*;
 import org.opengis.parameter.ParameterValue;
 import org.opengis.parameter.ParameterValueGroup;
 import org.apache.sis.internal.metadata.AxisNames;
+import org.apache.sis.referencing.datum.BursaWolfParameters;
+import org.apache.sis.referencing.datum.DefaultGeodeticDatum;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
@@ -322,7 +324,7 @@ public final strictfp class GeodeticObje
 
         GeographicCRS crs = parse(GeographicCRS.class, wkt);
         assertNameAndIdentifierEqual("NTF (Paris)", 0, crs);
-        PrimeMeridian pm = verifyNTF(crs.getDatum());
+        PrimeMeridian pm = verifyNTF(crs.getDatum(), false);
         assertEquals("angularUnit", NonSI.GRADE, pm.getAngularUnit());
         assertEquals("greenwichLongitude", 2.5969213, pm.getGreenwichLongitude(), STRICT);
         EllipsoidalCS cs = crs.getCoordinateSystem();
@@ -344,7 +346,7 @@ public final strictfp class GeodeticObje
         setConvention(Convention.WKT1_COMMON_UNITS, true);
         crs = parse(GeographicCRS.class, wkt);
         assertNameAndIdentifierEqual("NTF (Paris)", 0, crs);
-        pm = verifyNTF(crs.getDatum());
+        pm = verifyNTF(crs.getDatum(), false);
         assertEquals("angularUnit", NonSI.DEGREE_ANGLE, pm.getAngularUnit());
         assertEquals("greenwichLongitude", 2.33722917, pm.getGreenwichLongitude(), STRICT);
         cs = crs.getCoordinateSystem();
@@ -379,7 +381,7 @@ public final strictfp class GeodeticObje
         ProjectedCRS crs = parse(ProjectedCRS.class, wkt);
         assertNameAndIdentifierEqual("NTF (Paris) / Lambert zone II", 0, crs);
         verifyProjectedCS(crs.getCoordinateSystem(), SI.KILOMETRE);
-        PrimeMeridian pm = verifyNTF(crs.getDatum());
+        PrimeMeridian pm = verifyNTF(crs.getDatum(), true);
         assertEquals("angularUnit", NonSI.GRADE, pm.getAngularUnit());
         assertEquals("greenwichLongitude", 2.5969213, pm.getGreenwichLongitude(), STRICT);
         ParameterValue<?> param = verifyNTF(crs.getConversionFromBase().getParameterValues());
@@ -399,7 +401,7 @@ public final strictfp class GeodeticObje
         crs = parse(ProjectedCRS.class, wkt);
         assertNameAndIdentifierEqual("NTF (Paris) / Lambert zone II", 0, crs);
         verifyProjectedCS(crs.getCoordinateSystem(), SI.KILOMETRE);
-        pm = verifyNTF(crs.getDatum());
+        pm = verifyNTF(crs.getDatum(), true);
         assertEquals("angularUnit", NonSI.DEGREE_ANGLE, pm.getAngularUnit());
         assertEquals("greenwichLongitude", 2.33722917, pm.getGreenwichLongitude(), STRICT);
         param = verifyNTF(crs.getConversionFromBase().getParameterValues());
@@ -412,11 +414,19 @@ public final strictfp class GeodeticObje
      * This is used by the methods in this class which test a CRS using less frequently used
units and prime
      * meridian.
      *
+     * @param  datum The datum to verify.
+     * @param  hasToWGS84 Whether the datum is expected to have a {@code TOWGS84[…]} element.
      * @return The prime meridian, to be verified by the caller because the unit of measurement
depends on the test.
      */
-    private static PrimeMeridian verifyNTF(final GeodeticDatum datum) {
+    private static PrimeMeridian verifyNTF(final GeodeticDatum datum, final boolean hasToWGS84)
{
         assertNameAndIdentifierEqual("Nouvelle Triangulation Française (Paris)", 0, datum);
 
+        final BursaWolfParameters[] bwp = ((DefaultGeodeticDatum) datum).getBursaWolfParameters();
+        assertEquals("BursaWolfParameters", hasToWGS84 ? 1 : 0, bwp.length);
+        if (hasToWGS84) {
+            assertArrayEquals("BursaWolfParameters", new double[] {-168, -60, 320}, bwp[0].getValues(),
STRICT);
+        }
+
         final Ellipsoid ellipsoid = datum.getEllipsoid();
         assertNameAndIdentifierEqual("Clarke 1880 (IGN)", 0, ellipsoid);
         assertEquals("semiMajor", 6378249.2, ellipsoid.getSemiMajorAxis(), STRICT);
@@ -566,7 +576,7 @@ public final strictfp class GeodeticObje
         final ProjectedCRS crs = parse(ProjectedCRS.class,
                 "PROJCS[“FRANCE/NTF/Lambert III”," +
                 "GEOGCS[“”," + // Missing name (the purpose of this test).
-                "DATUM[“NTF=GR3DF97A”,TOWGS84[-168, -60, 320, 0, 0, 0, 0] ," + // Intentionally
misplaced coma.
+                "DATUM[“NTF=GR3DF97A”,TOWGS84[-168, -60, 320] ," + // Intentionally misplaced
coma.
                 "SPHEROID[“Clarke 1880 (IGN)”,6378249.2,293.4660212936269]]," +
                 "PRIMEM[“Greenwich”,0],UNIT[“Degrees”,0.0174532925199433]," +
                 "AXIS[“Long”,East],AXIS[“Lat”,North]]," +
@@ -587,6 +597,8 @@ public final strictfp class GeodeticObje
         final GeodeticDatum datum = geoCRS.getDatum();
         assertNameAndIdentifierEqual("NTF=GR3DF97A", 0, datum);
         assertNameAndIdentifierEqual("Greenwich", 0, datum.getPrimeMeridian());
+        assertArrayEquals("BursaWolfParameters", new double[] {-168, -60, 320},
+                ((DefaultGeodeticDatum) datum).getBursaWolfParameters()[0].getValues(), STRICT);
 
         final Ellipsoid ellipsoid = datum.getEllipsoid();
         assertNameAndIdentifierEqual("Clarke 1880 (IGN)", 0, ellipsoid);



Mime
View raw message