sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1555662 - in /sis/branches/JDK7/core/sis-referencing/src/test: java/org/apache/sis/referencing/ java/org/apache/sis/referencing/crs/ java/org/apache/sis/test/suite/ resources/org/apache/sis/referencing/crs/ resources/org/apache/sis/referen...
Date Mon, 06 Jan 2014 05:19:31 GMT
Author: desruisseaux
Date: Mon Jan  6 05:19:30 2014
New Revision: 1555662

URL: http://svn.apache.org/r1555662
Log:
Added tests for DefaultGeodeticCRS.

Added:
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeodeticCRSTest.java
  (with props)
    sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/
    sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/WGS
84.xml   (with props)
Modified:
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectVerifier.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
    sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/cs/CartesianCS.xml
    sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/cs/EllipsoidalCS.xml

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectVerifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectVerifier.java?rev=1555662&r1=1555661&r2=1555662&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectVerifier.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticObjectVerifier.java
[UTF-8] Mon Jan  6 05:19:30 2014
@@ -26,11 +26,13 @@ import org.opengis.referencing.datum.Ell
 import org.opengis.referencing.datum.PrimeMeridian;
 import org.opengis.referencing.datum.GeodeticDatum;
 import org.opengis.referencing.datum.VerticalDatum;
+import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CartesianCS;
 import org.opengis.referencing.cs.EllipsoidalCS;
 import org.opengis.referencing.cs.RangeMeaning;
+import org.opengis.referencing.crs.GeodeticCRS;
 
 import static org.apache.sis.test.Assert.*;
 
@@ -211,6 +213,37 @@ public final strictfp class GeodeticObje
     }
 
     /**
+     * Asserts that the given CRS is the WGS 84 one.
+     * This method verifies the following properties:
+     *
+     * <table class="sis">
+     * <tr><th>Property</th> <th>Expected value</th></tr>
+     * <tr><td>{@linkplain ReferenceIdentifier#getCode() Code} of the {@linkplain
GeodeticCRS#getName() name}</td>
+     *     <td>{@code "WGS 84"}</td></tr>
+     * <tr><td>{@linkplain GeodeticCRS#getDomainOfValidity() Domain of validity}</td>
+     *     <td>{@linkplain #assertIsWorld(GeographicBoundingBox) Is world} or absent</td></tr>
+     * <tr><td>{@linkplain GeodeticCRS#getDatum() Datum}</td>
+     *     <td>{@linkplain #assertIsWGS84(GeodeticDatum, boolean) Is WGS84}</td></tr>
+     * <tr><td>{@linkplain GeodeticCRS#getCoordinateSystem() Coordinate system}</td>
+     *     <td>{@linkplain #assertIsGeodetic2D(EllipsoidalCS, boolean) Is for a 2D
geodetic CRS}</td></tr>
+     * </table>
+     *
+     * @param crs The coordinate reference system to verify.
+     * @param isExtentMandatory {@code true} if the CRS and datum domains of validity are
required to contain an
+     *        {@code Extent} element for the world, or {@code false} if optional.
+     * @param isRangeMandatory {@code true} if the coordinate system axes range and range
meaning properties
+     *        shall be defined, or {@code false} if they are optional.
+     */
+    public static void assertIsWGS84(final GeodeticCRS crs, final boolean isExtentMandatory,
final boolean isRangeMandatory) {
+        assertEquals("name", "WGS 84", crs.getName().getCode());
+        assertIsWorld(crs.getDomainOfValidity(), isExtentMandatory);
+        assertIsWGS84(crs.getDatum(), isExtentMandatory);
+        final CoordinateSystem cs = crs.getCoordinateSystem();
+        assertInstanceOf("coordinateSystem", EllipsoidalCS.class, cs);
+        assertIsGeodetic2D((EllipsoidalCS) cs, isRangeMandatory);
+    }
+
+    /**
      * Asserts that the given datum is the Mean Sea Level one.
      * This method verifies the following properties:
      *
@@ -312,10 +345,10 @@ public final strictfp class GeodeticObje
      * </ul>
      *
      * @param cs The coordinate system to verify.
-     * @param rangeIsMandatory {@code true} if the axes range and range meaning properties
shall be defined,
+     * @param isRangeMandatory {@code true} if the axes range and range meaning properties
shall be defined,
      *        or {@code false} if they are optional.
      */
-    public static void assertIsGeodetic2D(final EllipsoidalCS cs, final boolean rangeIsMandatory)
{
+    public static void assertIsGeodetic2D(final EllipsoidalCS cs, final boolean isRangeMandatory)
{
         assertEquals("dimension", 2, cs.getDimension());
         final CoordinateSystemAxis latitude  = cs.getAxis(0);
         final CoordinateSystemAxis longitude = cs.getAxis(1);
@@ -327,8 +360,8 @@ public final strictfp class GeodeticObje
         assertEquals("axis[1].direction", AxisDirection.EAST,   longitude.getDirection());
         assertEquals("axis[0].unit",      NonSI.DEGREE_ANGLE,   latitude .getUnit());
         assertEquals("axis[1].unit",      NonSI.DEGREE_ANGLE,   longitude.getUnit());
-        verifyRange(latitude,   -90,  +90, RangeMeaning.EXACT, rangeIsMandatory);
-        verifyRange(longitude, -180, +180, RangeMeaning.WRAPAROUND, rangeIsMandatory);
+        verifyRange(latitude,   -90,  +90, RangeMeaning.EXACT, isRangeMandatory);
+        verifyRange(longitude, -180, +180, RangeMeaning.WRAPAROUND, isRangeMandatory);
     }
 
     /**

Added: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeodeticCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeodeticCRSTest.java?rev=1555662&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeodeticCRSTest.java
(added)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeodeticCRSTest.java
[UTF-8] Mon Jan  6 05:19:30 2014
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.referencing.crs;
+
+import javax.xml.bind.JAXBException;
+import org.opengis.test.Validators;
+import org.apache.sis.referencing.GeodeticObjectVerifier;
+import org.apache.sis.test.XMLTestCase;
+import org.apache.sis.test.DependsOn;
+import org.junit.Test;
+
+import static org.apache.sis.test.Assert.*;
+
+
+/**
+ * Tests {@link DefaultGeodeticCRS}
+ *
+ * @author  Cédric Briançon (Geomatys)
+ * @author  Guilhem Legal (Geomatys)
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.4 (derived from geotk-3.04)
+ * @version 0.4
+ * @module
+ */
+@DependsOn({
+    org.apache.sis.referencing.cs.DefaultEllipsoidalCSTest.class,
+    org.apache.sis.referencing.datum.DefaultGeodeticDatumTest.class
+})
+public final strictfp class DefaultGeodeticCRSTest extends XMLTestCase {
+    /**
+     * An XML file in this package containing a Cartesian coordinate system definition.
+     */
+    private static final String XML_FILE = "WGS 84.xml";
+
+    /**
+     * Tests (un)marshalling of a geodetic coordinate reference system.
+     *
+     * @throws JAXBException If an error occurred during unmarshalling.
+     */
+    @Test
+    public void testXML() throws JAXBException {
+        final DefaultGeodeticCRS crs = unmarshalFile(DefaultGeodeticCRS.class, XML_FILE);
+        Validators.validate(crs);
+        GeodeticObjectVerifier.assertIsWGS84(crs, false, true);
+        /*
+         * Values in the following tests are specific to our XML file.
+         * The actual texts in the EPSG database are more descriptive.
+         */
+        assertEquals("scope", "Horizontal component of 3D system.", crs.getScope().toString());
+        /*
+         * Marshal and compare with the original file.
+         */
+        assertMarshalEqualsFile(XML_FILE, crs, "xmlns:*", "xsi:schemaLocation");
+    }
+}

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeodeticCRSTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeodeticCRSTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1555662&r1=1555661&r2=1555662&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] Mon Jan  6 05:19:30 2014
@@ -66,6 +66,7 @@ import org.junit.BeforeClass;
     org.apache.sis.referencing.cs.DefaultCartesianCSTest.class,
     org.apache.sis.referencing.cs.DefaultEllipsoidalCSTest.class,
     org.apache.sis.referencing.cs.CoordinateSystemsTest.class,
+    org.apache.sis.referencing.crs.DefaultGeodeticCRSTest.class,
     org.apache.sis.referencing.StandardDefinitionsTest.class,
     org.apache.sis.referencing.GeodeticObjectsTest.class,
 

Added: sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/WGS
84.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/WGS%2084.xml?rev=1555662&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/WGS
84.xml (added)
+++ sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/WGS
84.xml Mon Jan  6 05:19:30 2014
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<gml:GeodeticCRS xsi:schemaLocation = "http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/coordinateReferenceSystems.xsd"
+                   xmlns:gml          = "http://www.opengis.net/gml/3.2"
+                   xmlns:gmd          = "http://www.isotc211.org/2005/gmd"
+                   xmlns:gco          = "http://www.isotc211.org/2005/gco"
+                   xmlns:xsi          = "http://www.w3.org/2001/XMLSchema-instance"
+                   gml:id             = "epsg-crs-4326">
+
+  <gml:identifier codeSpace="OGP">urn:ogc:def:crs:EPSG::4326</gml:identifier>
+  <gml:name>WGS 84</gml:name>
+  <gml:scope>Horizontal component of 3D system.</gml:scope>
+  <gml:ellipsoidalCS>
+    <gml:EllipsoidalCS gml:id="epsg-cs-6422">
+      <gml:identifier codeSpace="OGP">urn:ogc:def:cs:EPSG::6422</gml:identifier>
+      <gml:name>Latitude (north), Longitude (east)</gml:name>
+      <gml:axis>
+        <gml:CoordinateSystemAxis gml:id="epsg-axis-106" uom="urn:ogc:def:uom:EPSG::9122">
+          <gml:identifier codeSpace="OGP">urn:ogc:def:axis:EPSG::106</gml:identifier>
+          <gml:name>Geodetic latitude</gml:name>
+          <gml:axisAbbrev>φ</gml:axisAbbrev>
+          <gml:axisDirection codeSpace="EPSG">north</gml:axisDirection>
+          <gml:minimumValue>-90</gml:minimumValue>
+          <gml:maximumValue>+90</gml:maximumValue>
+          <gml:rangeMeaning codeSpace="EPSG">exact</gml:rangeMeaning>
+        </gml:CoordinateSystemAxis>
+      </gml:axis>
+      <gml:axis>
+        <gml:CoordinateSystemAxis gml:id="epsg-axis-107" uom="urn:ogc:def:uom:EPSG::9122">
+          <gml:identifier codeSpace="OGP">urn:ogc:def:axis:EPSG::107</gml:identifier>
+          <gml:name>Geodetic longitude</gml:name>
+          <gml:axisAbbrev>λ</gml:axisAbbrev>
+          <gml:axisDirection codeSpace="EPSG">east</gml:axisDirection>
+          <gml:minimumValue>-180</gml:minimumValue>
+          <gml:maximumValue>+180</gml:maximumValue>
+          <gml:rangeMeaning codeSpace="EPSG">wraparound</gml:rangeMeaning>
+        </gml:CoordinateSystemAxis>
+      </gml:axis>
+    </gml:EllipsoidalCS>
+  </gml:ellipsoidalCS>
+  <gml:geodeticDatum>
+    <gml:GeodeticDatum gml:id="epsg-datum-6326">
+      <gml:identifier codeSpace="EPSG">urn:ogc:def:datum:EPSG::6326</gml:identifier>
+      <gml:name>World Geodetic System 1984</gml:name>
+      <gml:scope>Satellite navigation.</gml:scope>
+      <gml:primeMeridian>
+        <gml:PrimeMeridian gml:id = "epsg-meridian-8901">
+          <gml:identifier codeSpace="OGP">urn:ogc:def:meridian:EPSG::8901</gml:identifier>
+          <gml:name>Greenwich</gml:name>
+          <gml:greenwichLongitude uom="urn:ogc:def:uom:EPSG::9102">0</gml:greenwichLongitude>
+        </gml:PrimeMeridian>
+      </gml:primeMeridian>
+      <gml:ellipsoid>
+        <gml:Ellipsoid gml:id = "epsg-ellipsoid-7030">
+          <gml:identifier codeSpace="OGP">urn:ogc:def:ellipsoid:EPSG::7030</gml:identifier>
+          <gml:name>WGS 84</gml:name>
+          <gml:semiMajorAxis uom="urn:ogc:def:uom:EPSG::9001">6378137.0</gml:semiMajorAxis>
+          <gml:secondDefiningParameter>
+            <gml:SecondDefiningParameter>
+              <gml:inverseFlattening uom="urn:ogc:def:uom:EPSG::9201">298.257223563</gml:inverseFlattening>
+            </gml:SecondDefiningParameter>
+          </gml:secondDefiningParameter>
+        </gml:Ellipsoid>
+      </gml:ellipsoid>
+    </gml:GeodeticDatum>
+  </gml:geodeticDatum>
+</gml:GeodeticCRS>

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/WGS
84.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/WGS
84.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/cs/CartesianCS.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/cs/CartesianCS.xml?rev=1555662&r1=1555661&r2=1555662&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/cs/CartesianCS.xml
(original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/cs/CartesianCS.xml
Mon Jan  6 05:19:30 2014
@@ -22,6 +22,7 @@
                  xmlns:gml          = "http://www.opengis.net/gml/3.2"
                  xmlns:xsi          = "http://www.w3.org/2001/XMLSchema-instance"
                  gml:id             = "epsg-cs-4400">
+
   <gml:identifier codeSpace="OGP">urn:ogc:def:cs:EPSG::4400</gml:identifier>
   <gml:name>Easting, northing (E,N)</gml:name>
   <gml:remarks>Used in ProjectedCRS.</gml:remarks>

Modified: sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/cs/EllipsoidalCS.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/cs/EllipsoidalCS.xml?rev=1555662&r1=1555661&r2=1555662&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/cs/EllipsoidalCS.xml
(original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/referencing/cs/EllipsoidalCS.xml
Mon Jan  6 05:19:30 2014
@@ -22,6 +22,7 @@
                    xmlns:gml          = "http://www.opengis.net/gml/3.2"
                    xmlns:xsi          = "http://www.w3.org/2001/XMLSchema-instance"
                    gml:id             = "epsg-cs-6422">
+
   <gml:identifier codeSpace="OGP">urn:ogc:def:cs:EPSG::6422</gml:identifier>
   <gml:name>Latitude (north), Longitude (east)</gml:name>
   <gml:remarks>Used in two-dimensional GeographicCRS.</gml:remarks>



Mime
View raw message