sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1688804 - in /sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt: GeodeticObjectParserTest.java WKTParserTest.java
Date Thu, 02 Jul 2015 10:32:56 GMT
Author: desruisseaux
Date: Thu Jul  2 10:32:55 2015
New Revision: 1688804

URL: http://svn.apache.org/r1688804
Log:
Added tests.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/GeodeticObjectParserTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTParserTest.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=1688804&r1=1688803&r2=1688804&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] Thu Jul  2 10:32:55 2015
@@ -661,6 +661,33 @@ public final strictfp class GeodeticObje
     }
 
     /**
+     * Tests the parsing of an engineering CRS from a WKT 2 string.
+     *
+     * @throws ParseException if the parsing failed.
+     */
+    @Test
+    public void testEngineeringCRS() throws ParseException {
+        final EngineeringCRS crs = parse(EngineeringCRS.class,
+                "EngineeringCRS[“A building-centred CRS”,\n" +
+                "  EngineeringDatum[“Building reference point”],\n" +
+                "  CS[Cartesian, 3],\n" +
+                "    Axis[“x”, east],\n" +
+                "    Axis[“y”, north],\n" +
+                "    Axis[“z”, up],\n" +
+                "    Unit[“metre”, 1]]");
+
+        assertNameAndIdentifierEqual("A building-centred CRS", 0, crs);
+        assertNameAndIdentifierEqual("Building reference point", 0, crs.getDatum());
+        final CoordinateSystem cs = crs.getCoordinateSystem();
+        assertEquals("dimension", 3, cs.getDimension());
+
+        // Axis names are arbitrary and could change in future SIS versions.
+        assertUnboundedAxisEquals("Easting",  "x", AxisDirection.EAST,  SI.METRE, cs.getAxis(0));
+        assertUnboundedAxisEquals("Northing", "y", AxisDirection.NORTH, SI.METRE, cs.getAxis(1));
+        assertUnboundedAxisEquals("z",        "z", AxisDirection.UP,    SI.METRE, cs.getAxis(2));
+    }
+
+    /**
      * Tests the parsing of a compound CRS from a WKT 1 string, except the time dimension
which is WKT 2.
      *
      * @throws ParseException if the parsing failed.

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTParserTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTParserTest.java?rev=1688804&r1=1688803&r2=1688804&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTParserTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTParserTest.java
[UTF-8] Thu Jul  2 10:32:55 2015
@@ -74,6 +74,18 @@ public class WKTParserTest extends CRSPa
 
     /**
      * Completes the GeoAPI tests with a check of axis names.
+     * The WKT parsed by this test is (except for quote characters):
+     *
+     * {@preformat wkt
+     *   GEODCRS[“WGS 84”,
+     *    DATUM[“World Geodetic System 1984”,
+     *      ELLIPSOID[“WGS 84”, 6378137, 298.257223563,
+     *        LENGTHUNIT[“metre”,1.0]]],
+     *    CS[ellipsoidal,3],
+     *      AXIS[“(lat)”,north,ANGLEUNIT[“degree”,0.0174532925199433]],
+     *      AXIS[“(lon)”,east,ANGLEUNIT[“degree”,0.0174532925199433]],
+     *      AXIS[“ellipsoidal height (h)”,up,LENGTHUNIT[“metre”,1.0]]]
+     * }
      *
      * @throws FactoryException if an error occurred during the WKT parsing.
      */
@@ -86,6 +98,19 @@ public class WKTParserTest extends CRSPa
 
     /**
      * Completes the GeoAPI tests with a check of axis names.
+     * The WKT parsed by this test is (except for quote characters):
+     *
+     * {@preformat wkt
+     *   GEODCRS[“S-95”,
+     *    DATUM[“Pulkovo 1995”,
+     *      ELLIPSOID[“Krassowsky 1940”, 6378245, 298.3,
+     *        LENGTHUNIT[“metre”,1.0]]],
+     *    CS[ellipsoidal,2],
+     *      AXIS[“latitude”,north,ORDER[1]],
+     *      AXIS[“longitude”,east,ORDER[2]],
+     *      ANGLEUNIT[“degree”,0.0174532925199433],
+     *    REMARK[“Система Геодеэических Координвт года
1995(СК-95)”]]
+     * }
      *
      * @throws FactoryException if an error occurred during the WKT parsing.
      */
@@ -98,6 +123,19 @@ public class WKTParserTest extends CRSPa
 
     /**
      * Completes the GeoAPI tests with a check of axis names.
+     * The WKT parsed by this test is (except for quote characters):
+     *
+     * {@preformat wkt
+     *   GEODCRS[“NAD83”,
+     *    DATUM[“North American Datum 1983”,
+     *      ELLIPSOID[“GRS 1980”, 6378137, 298.257222101, LENGTHUNIT[“metre”,1.0]]],
+     *    CS[ellipsoidal,2],
+     *      AXIS[“latitude”,north],
+     *      AXIS[“longitude”,east],
+     *      ANGLEUNIT[“degree”,0.017453292519943],
+     *    ID[“EPSG”,4269],
+     *    REMARK[“1986 realisation”]]
+     * }
      *
      * @throws FactoryException if an error occurred during the WKT parsing.
      */
@@ -110,6 +148,19 @@ public class WKTParserTest extends CRSPa
 
     /**
      * Completes the GeoAPI tests with a check of axis names.
+     * The WKT parsed by this test is (except for quote characters):
+     *
+     * {@preformat wkt
+     *   GEODCRS[“NTF (Paris)”,
+     *    DATUM[“Nouvelle Triangulation Francaise”,
+     *      ELLIPSOID[“Clarke 1880 (IGN)”, 6378249.2, 293.4660213]],
+     *    PRIMEM[“Paris”,2.5969213],
+     *    CS[ellipsoidal,2],
+     *      AXIS[“latitude”,north,ORDER[1]],
+     *      AXIS[“longitude”,east,ORDER[2]],
+     *      ANGLEUNIT[“grad”,0.015707963267949],
+     *    REMARK[“Nouvelle Triangulation Française”]]
+     * }
      *
      * @throws FactoryException if an error occurred during the WKT parsing.
      */
@@ -122,6 +173,24 @@ public class WKTParserTest extends CRSPa
 
     /**
      * Completes the GeoAPI tests with a check of axis names.
+     * The WKT parsed by this test is (except for quote characters):
+     *
+     * {@preformat wkt
+     *   GEODETICCRS[“JGD2000”,
+     *    DATUM[“Japanese Geodetic Datum 2000”,
+     *      ELLIPSOID[“GRS 1980”, 6378137, 298.257222101]],
+     *    CS[Cartesian,3],
+     *      AXIS[“(X)”,geocentricX],
+     *      AXIS[“(Y)”,geocentricY],
+     *      AXIS[“(Z)”,geocentricZ],
+     *      LENGTHUNIT[“metre”,1.0],
+     *    SCOPE[“Geodesy, topographic mapping and cadastre”],
+     *    AREA[“Japan”],
+     *    BBOX[17.09,122.38,46.05,157.64],
+     *    TIMEEXTENT[2002-04-01,2011-10-21],
+     *    ID[“EPSG”,4946,URI[“urn:ogc:def:crs:EPSG::4946”]],
+     *    REMARK[“注:JGD2000ジオセントリックは現在JGD2011に代わりました。”]]
+     * }
      *
      * @throws FactoryException if an error occurred during the WKT parsing.
      */
@@ -148,6 +217,34 @@ public class WKTParserTest extends CRSPa
 
     /**
      * Completes the GeoAPI tests with a check of axis names.
+     * The WKT parsed by this test is (except for quote characters):
+     *
+     * {@preformat wkt
+     *   PROJCRS[“NAD27 / Texas South Central”,
+     *    BASEGEODCRS[“NAD27”,
+     *      DATUM[“North American Datum 1927”,
+     *        ELLIPSOID[“Clarke 1866”, 20925832.164, 294.97869821,
+     *          LENGTHUNIT[“US survey foot”,0.304800609601219]]]],
+     *    CONVERSION[“Texas South Central SPCS27”,
+     *      METHOD[“Lambert Conic Conformal (2SP)”,ID[“EPSG”,9802]],
+     *      PARAMETER[“Latitude of false origin”,27.83333333333333,
+     *        ANGLEUNIT[“degree”,0.0174532925199433],ID[“EPSG”,8821]],
+     *      PARAMETER[“Longitude of false origin”,-99.0,
+     *        ANGLEUNIT[“degree”,0.0174532925199433],ID[“EPSG”,8822]],
+     *      PARAMETER[“Latitude of 1st standard parallel”,28.383333333333,
+     *        ANGLEUNIT[“degree”,0.0174532925199433],ID[“EPSG”,8823]],
+     *      PARAMETER[“Latitude of 2nd standard parallel”,30.283333333333,
+     *        ANGLEUNIT[“degree”,0.0174532925199433],ID[“EPSG”,8824]],
+     *      PARAMETER[“Easting at false origin”,2000000.0,
+     *        LENGTHUNIT[“US survey foot”,0.304800609601219],ID[“EPSG”,8826]],
+     *      PARAMETER[“Northing at false origin”,0.0,
+     *        LENGTHUNIT[“US survey foot”,0.304800609601219],ID[“EPSG”,8827]]],
+     *    CS[Cartesian,2],
+     *      AXIS[“(x)”,east],
+     *      AXIS[“(y)”,north],
+     *      LENGTHUNIT[“US survey foot”,0.304800609601219],
+     *    REMARK[“Fundamental point: Meade’s Ranch KS, latitude 39°13'26.686"N, longitude
98°32'30.506"W.”]]
+     * }
      *
      * @throws FactoryException if an error occurred during the WKT parsing.
      */
@@ -173,6 +270,14 @@ public class WKTParserTest extends CRSPa
 
     /**
      * Completes the GeoAPI tests with a check of axis name and vertical datum type.
+     * The WKT parsed by this test is (except for quote characters):
+     *
+     * {@preformat wkt
+     *   VERTCRS[“NAVD88”,
+     *    VDATUM[“North American Vertical Datum 1988”],
+     *    CS[vertical,1],
+     *      AXIS[“gravity-related height (H)”,up],LENGTHUNIT[“metre”,1.0]]
+     * }
      *
      * @throws FactoryException if an error occurred during the WKT parsing.
      */
@@ -184,4 +289,104 @@ public class WKTParserTest extends CRSPa
         assertEquals("name", AxisNames.GRAVITY_RELATED_HEIGHT, cs.getAxis(0).getName().getCode());
         assertEquals("datumType", VerticalDatumType.GEOIDAL, ((VerticalCRS) object).getDatum().getVerticalDatumType());
     }
+
+    /**
+     * Completes the GeoAPI tests with a check of axis name.
+     * The WKT parsed by this test is (except for quote characters):
+     *
+     * {@preformat wkt
+     *   TIMECRS[“GPS Time”,
+     *     TDATUM[“Time origin”,TIMEORIGIN[1980-01-01T00:00:00.0Z]],
+     *     CS[temporal,1],AXIS[“time”,future],TIMEUNIT[“day”,86400.0]]
+     * }
+     *
+     * @throws FactoryException if an error occurred during the WKT parsing.
+     */
+    @Test
+    @Override
+    public void testTemporal() throws FactoryException {
+        super.testTemporal();
+        final CoordinateSystem cs = object.getCoordinateSystem();
+        assertEquals("name", AxisNames.TIME, cs.getAxis(0).getName().getCode());
+    }
+
+    /**
+     * Completes the GeoAPI tests with a check of axis names.
+     * The WKT parsed by this test is (except for quote characters):
+     *
+     * {@preformat wkt
+     *   ENGINEERINGCRS[“Astra Minas Grid”,
+     *    ENGINEERINGDATUM[“Astra Minas”],
+     *    CS[Cartesian,2],
+     *      AXIS[“northing (X)”,north,ORDER[1]],
+     *      AXIS[“westing (Y)”,west,ORDER[2]],
+     *      LENGTHUNIT[“metre”,1.0],
+     *    ID[“EPSG”,5800]]
+     * }
+     *
+     * @throws FactoryException if an error occurred during the WKT parsing.
+     */
+    @Test
+    @Override
+    public void testEngineering() throws FactoryException {
+        super.testEngineering();
+        final CoordinateSystem cs = object.getCoordinateSystem();
+        assertEquals("name", AxisNames.NORTHING, cs.getAxis(0).getName().getCode());
+        assertEquals("name", AxisNames.WESTING,  cs.getAxis(1).getName().getCode());
+    }
+
+    /**
+     * Completes the GeoAPI tests with a check of axis names.
+     * The WKT parsed by this test is (except for quote characters):
+     *
+     * {@preformat wkt
+     *   ENGCRS[“A construction site CRS”,
+     *    EDATUM[“P1”,ANCHOR[“Peg in south corner”]],
+     *    CS[Cartesian,2],
+     *      AXIS[“site east”,southWest,ORDER[1]],
+     *      AXIS[“site north”,southEast,ORDER[2]],
+     *      LENGTHUNIT[“metre”,1.0],
+     *    TIMEEXTENT[“date/time t1”,“date/time t2”]]
+     * }
+     *
+     * @throws FactoryException if an error occurred during the WKT parsing.
+     */
+    @Test
+    @Override
+    public void testEngineeringInclined() throws FactoryException {
+        super.testEngineeringInclined();
+        final CoordinateSystem cs = object.getCoordinateSystem();
+        assertEquals("name", "site east",  cs.getAxis(0).getName().getCode());
+        assertEquals("name", "site north", cs.getAxis(1).getName().getCode());
+    }
+
+    /**
+     * Completes the GeoAPI tests with a check of axis names.
+     * The WKT parsed by this test is (except for quote characters):
+     *
+     * {@preformat wkt
+     *   ENGCRS[“A ship-centred CRS”,
+     *    EDATUM[“Ship reference point”,ANCHOR[“Centre of buoyancy”]],
+     *    CS[Cartesian,3],
+     *      AXIS[“(x)”,forward],
+     *      AXIS[“(y)”,starboard],
+     *      AXIS[“(z)”,down],
+     *      LENGTHUNIT[“metre”,1.0]]
+     * }
+     *
+     * @throws FactoryException if an error occurred during the WKT parsing.
+     */
+    @Test
+    @Override
+    public void testEngineeringForShip() throws FactoryException {
+        super.testEngineeringForShip();
+        final CoordinateSystem cs = object.getCoordinateSystem();
+        /*
+         * In this case we had no axis names, so Apache SIS reused the abbreviations.
+         * This could change in any future SIS version if we update Transliterator.
+         */
+        assertEquals("name", "x", cs.getAxis(0).getName().getCode());
+        assertEquals("name", "y", cs.getAxis(1).getName().getCode());
+        assertEquals("name", "z", cs.getAxis(2).getName().getCode());
+    }
 }



Mime
View raw message