sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1649315 - in /sis/branches/JDK8/core/sis-referencing/src: main/java/org/apache/sis/referencing/cs/ test/java/org/apache/sis/referencing/crs/ test/java/org/apache/sis/referencing/cs/
Date Sun, 04 Jan 2015 11:16:53 GMT
Author: desruisseaux
Date: Sun Jan  4 11:16:53 2015
New Revision: 1649315

URL: http://svn.apache.org/r1649315
Log:
AxesConcention documentation, and renamed a few test methods for distinguish
whether we are testing CONVENTIONALLY_ORIENTED or NORMALIZED enum value.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/AbstractCRSTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultSphericalCSTest.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java?rev=1649315&r1=1649314&r2=1649315&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
[UTF-8] Sun Jan  4 11:16:53 2015
@@ -22,37 +22,54 @@ import org.opengis.referencing.cs.AxisDi
 /**
  * High-level characteristics about the axes of a coordinate system.
  * This enumeration provides a convenient way to identify some common axes conventions like
- * (<var>longitude</var>, <var>latitude</var>) axis order or the
[0 … 360]° range of longitude values
- * (instead than the more usual [-180 … +180]° range). Apache SIS Coordinate System objects
can be made
+ * axis order or range of longitude values. Apache SIS Coordinate System objects can be made
  * compliant to a given convention by calls to their {@code forConvention(AxesConvention)}
method.
- * The following table summarizes the coordinate system aspects that may be modified:
+ *
+ * <p>The following table summarizes the coordinate system aspects that may be modified
by each enum value,
+ * with an example of change applied by the enum. Blank cells mean that the property is not
changed by the
+ * enum value.</p>
  *
  * <table class="sis">
- *   <caption>Coordinate system properties concerned by enumeration values</caption>
+ *   <caption>Coordinate system properties changed by enum values</caption>
  *   <tr>
  *     <th>Property</th>
- *     <th>Enumeration values</th>
  *     <th>Example</th>
+ *     <th>{@linkplain #NORMALIZED}</th>
+ *     <th>{@linkplain #CONVENTIONALLY_ORIENTED}</th>
+ *     <th>{@linkplain #RIGHT_HANDED}</th>
+ *     <th>{@linkplain #POSITIVE_RANGE}</th>
  *   </tr>
  *   <tr>
  *     <td>Axis order</td>
- *     <td>{@link #NORMALIZED}, {@link #CONVENTIONALLY_ORIENTED}, {@link #RIGHT_HANDED}</td>
  *     <td>(<var>longitude</var>, <var>latitude</var>)</td>
+ *     <td style="text-align:center">✔</td>
+ *     <td style="text-align:center">✔</td>
+ *     <td style="text-align:center">✔</td>
+ *     <td></td>
  *   </tr>
  *   <tr>
  *     <td>Axis direction</td>
- *     <td>{@link #NORMALIZED}, {@link #CONVENTIONALLY_ORIENTED}</td>
  *     <td>({@linkplain AxisDirection#EAST east}, {@linkplain AxisDirection#NORTH north})</td>
+ *     <td style="text-align:center">✔</td>
+ *     <td style="text-align:center">✔</td>
+ *     <td></td>
+ *     <td></td>
  *   </tr>
  *   <tr>
  *     <td>Unit of measurement</td>
- *     <td>{@link #NORMALIZED}</td>
- *     <td>Angular degrees, metres</td>
+ *     <td>Angular degrees &amp; metres</td>
+ *     <td style="text-align:center">✔</td>
+ *     <td></td>
+ *     <td></td>
+ *     <td></td>
  *   </tr>
  *   <tr>
  *     <td>Range of values</td>
- *     <td>{@link #POSITIVE_RANGE}</td>
  *     <td>[0 … 360]° of longitude</td>
+ *     <td></td>
+ *     <td></td>
+ *     <td></td>
+ *     <td style="text-align:center">✔</td>
  *   </tr>
  * </table>
  *
@@ -97,7 +114,7 @@ public enum AxesConvention {
      *
      * <ul>
      *   <li>Axes are oriented and ordered as defined for {@link #CONVENTIONALLY_ORIENTED}
coordinate systems.</li>
-     *   <li>Known units are normalized:
+     *   <li>Known units are normalized (this list may be expanded in future SIS versions):
      *     <ul>
      *       <li>Angular units are set to {@link javax.measure.unit.NonSI#DEGREE_ANGLE}.</li>
      *       <li>Linear units are set to {@link javax.measure.unit.SI#METRE}.</li>
@@ -123,7 +140,7 @@ public enum AxesConvention {
      * (e.g. {@code SOUTH} → {@code NORTH}):</p>
      *
      * <table class="sis">
-     *   <caption>Directions used by convention</caption>
+     *   <caption>Axis directions used by convention</caption>
      *   <tr>
      *     <th>Preferred {@link AxisDirection}</th>
      *     <th>Purpose</th>

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/AbstractCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/AbstractCRSTest.java?rev=1649315&r1=1649314&r2=1649315&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/AbstractCRSTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/AbstractCRSTest.java
[UTF-8] Sun Jan  4 11:16:53 2015
@@ -33,16 +33,16 @@ import static org.apache.sis.test.Assert
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.5
  * @module
  */
 @DependsOn(org.apache.sis.referencing.cs.AbstractCSTest.class)
 public final strictfp class AbstractCRSTest extends TestCase {
     /**
-     * Tests {@link AbstractCRS#forConvention(AxesConvention)}.
+     * Tests {@link AbstractCRS#forConvention(AxesConvention)} with {@link AxesConvention#RIGHT_HANDED}.
      */
     @Test
-    public void testForConvention() {
+    public void testForRightHandedConvention() {
         final AbstractCRS toTest, expected, actual;
         toTest   =  new AbstractCRS(singletonMap(NAME_KEY, "My CRS"),
                     new AbstractCS (singletonMap(NAME_KEY, "My strange CS"),
@@ -54,8 +54,10 @@ public final strictfp class AbstractCRST
 
         assertEquals("forConvention(RIGHT_HANDED)", expected, actual);
         assertSame(actual,   toTest  .forConvention(AxesConvention.RIGHT_HANDED));
+        assertSame(actual,   toTest  .forConvention(AxesConvention.CONVENTIONALLY_ORIENTED));
         assertSame(actual,   toTest  .forConvention(AxesConvention.NORMALIZED));
         assertSame(expected, expected.forConvention(AxesConvention.RIGHT_HANDED));
+        assertSame(expected, expected.forConvention(AxesConvention.CONVENTIONALLY_ORIENTED));
         assertSame(expected, expected.forConvention(AxesConvention.NORMALIZED));
     }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java?rev=1649315&r1=1649314&r2=1649315&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
[UTF-8] Sun Jan  4 11:16:53 2015
@@ -38,7 +38,7 @@ import static org.apache.sis.test.TestUt
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4 (derived from geotk-3.20)
- * @version 0.4
+ * @version 0.5
  * @module
  */
 @DependsOn({
@@ -75,12 +75,12 @@ public final strictfp class DefaultGeogr
 
     /**
      * Tests the {@link DefaultGeographicCRS#forConvention(AxesConvention)} method
-     * for {@link AxesConvention#NORMALIZED}.
+     * for {@link AxesConvention#CONVENTIONALLY_ORIENTED}.
      */
     @Test
-    public void testNormalize() {
+    public void testConventionalOrientation() {
         final DefaultGeographicCRS crs = DefaultGeographicCRS.castOrCopy(CommonCRS.WGS84.geographic3D());
-        final DefaultGeographicCRS normalized = crs.forConvention(AxesConvention.NORMALIZED);
+        final DefaultGeographicCRS normalized = crs.forConvention(AxesConvention.CONVENTIONALLY_ORIENTED);
         assertNotSame(crs, normalized);
         final EllipsoidalCS cs = normalized.getCoordinateSystem();
         final EllipsoidalCS ref = crs.getCoordinateSystem();

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java?rev=1649315&r1=1649314&r2=1649315&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/AbstractCSTest.java
[UTF-8] Sun Jan  4 11:16:53 2015
@@ -36,7 +36,7 @@ import static org.apache.sis.test.Assert
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.5
  * @module
  */
 @DependsOn({

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java?rev=1649315&r1=1649314&r2=1649315&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCartesianCSTest.java
[UTF-8] Sun Jan  4 11:16:53 2015
@@ -39,7 +39,7 @@ import static org.apache.sis.test.TestUt
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4 (derived from geotk-2.2)
- * @version 0.4
+ * @version 0.5
  * @module
  */
 @DependsOn({
@@ -148,52 +148,53 @@ public final strictfp class DefaultCarte
     }
 
     /**
-     * Creates a Cartesian CS using the provided test axis, invoke {@link AbstractCS#standard}
-     * with it and compare with the expected axis.
+     * Creates a Cartesian CS using the provided test axis, invokes {@link AbstractCS#forConvention(AxesConvention)}
+     * on it and compares with the expected axes.
      *
      * @param expectedX The name of the expected {@link AxisDirection} of x axis after normalization.
      * @param expectedY The name of the expected {@link AxisDirection} of y axis after normalization.
      * @param toTestX   The name of the {@link AxisDirection} value for the x axis of the
CS to normalize.
      * @param toTestY   The name of the {@link AxisDirection} value for the y axis of the
CS to normalize.
      */
-    private static void assertNormalizationEquals(
+    private static void assertConventionallyOrientedEquals(
             final String expectedX, final String expectedY,
             final String toTestX,   final String toTestY)
     {
         DefaultCartesianCS cs = createCS(toTestX, toTestY);
-        cs = cs.forConvention(AxesConvention.NORMALIZED);
+        cs = cs.forConvention(AxesConvention.CONVENTIONALLY_ORIENTED);
         assertEqualsIgnoreMetadata(createCS(expectedX, expectedY), cs);
     }
 
     /**
-     * Asserts that the coordinate system made of the given axes is normalized.
-     * This method also ensures that swapping the axes and normalizing give back the original
CS.
+     * Asserts that the coordinate system made of the given axes has conventional orientation.
+     * Then ensures that swapping the axes and applying conventional orientation gives back
the original CS.
      */
-    private static void assertNormalized(final String x, final String y) {
-        assertNormalizationEquals(x, y, x, y); // Expect no-op.
-        assertNormalizationEquals(x, y, y, x); // Expect normalization.
+    private static void testConventionalOrientation(final String x, final String y) {
+        assertConventionallyOrientedEquals(x, y, x, y); // Expect no-op.
+        assertConventionallyOrientedEquals(x, y, y, x); // Expect normalization.
     }
 
     /**
-     * Tests {@link DefaultCartesianCS#forConvention(AxesConvention)} with {@link AxesConvention#NORMALIZED}.
+     * Tests {@link DefaultCartesianCS#forConvention(AxesConvention)} with
+     * {@link AxesConvention#CONVENTIONALLY_ORIENTED}.
      */
     @Test
     @DependsOnMethod("testConstructor")
-    public void testNormalization() {
-        // ----------- Axis to test ------ Expected axis --
-        assertNormalizationEquals("East", "North",    "East", "North");
-        assertNormalizationEquals("East", "North",    "North", "East");
-        assertNormalizationEquals("East", "North",    "South", "East");
-        assertNormalizationEquals("East", "North",    "South", "West");
-
-        assertNormalized("East",                       "North");
-        assertNormalized("South-East",                 "North-East");
-        assertNormalized("North along  90 deg East",   "North along   0 deg");
-        assertNormalized("North along  90 deg East",   "North along   0 deg");
-        assertNormalized("North along  75 deg West",   "North along 165 deg West");
-        assertNormalized("South along  90 deg West",   "South along   0 deg");
-        assertNormalized("South along 180 deg",        "South along  90 deg West");
-        assertNormalized("North along 130 deg West",   "North along 140 deg East");
+    public void testConventionalOrientation() {
+        // -------------------------------- Axes to test ------ Expected axes --
+        assertConventionallyOrientedEquals("East", "North",    "East", "North");
+        assertConventionallyOrientedEquals("East", "North",    "North", "East");
+        assertConventionallyOrientedEquals("East", "North",    "South", "East");
+        assertConventionallyOrientedEquals("East", "North",    "South", "West");
+
+        testConventionalOrientation("East",                       "North");
+        testConventionalOrientation("South-East",                 "North-East");
+        testConventionalOrientation("North along  90 deg East",   "North along   0 deg");
+        testConventionalOrientation("North along  90 deg East",   "North along   0 deg");
+        testConventionalOrientation("North along  75 deg West",   "North along 165 deg West");
+        testConventionalOrientation("South along  90 deg West",   "South along   0 deg");
+        testConventionalOrientation("South along 180 deg",        "South along  90 deg West");
+        testConventionalOrientation("North along 130 deg West",   "North along 140 deg East");
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultSphericalCSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultSphericalCSTest.java?rev=1649315&r1=1649314&r2=1649315&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultSphericalCSTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultSphericalCSTest.java
[UTF-8] Sun Jan  4 11:16:53 2015
@@ -30,17 +30,17 @@ import static org.apache.sis.referencing
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.5
  * @module
  */
 @DependsOn(AbstractCSTest.class)
 public final strictfp class DefaultSphericalCSTest extends TestCase {
     /**
-     * Tests the normalization of a coordinate system.
+     * Tests the conventional orientation of a coordinate system.
      */
     @Test
-    public void testNormalize() {
-        final AbstractCS normalized = SPHERICAL.forConvention(AxesConvention.NORMALIZED);
+    public void testConventionalOrientation() {
+        final AbstractCS normalized = SPHERICAL.forConvention(AxesConvention.CONVENTIONALLY_ORIENTED);
         assertNotSame(SPHERICAL, normalized);
         assertEquals(new DefaultSphericalCS(
             Collections.singletonMap(AbstractCS.NAME_KEY, "Spherical CS: East (deg), North
(deg), Up (m)."),



Mime
View raw message