sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1735424 - in /sis/branches/JDK8: core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ core/sis-referencing/src/main/java/org/apache/sis/referencing/ core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/ core/sis-re...
Date Thu, 17 Mar 2016 13:35:49 GMT
Author: desruisseaux
Date: Thu Mar 17 13:35:49 2016
New Revision: 1735424

URL: http://svn.apache.org/viewvc?rev=1735424&view=rev
Log:
Consolidate our abbreviations for spherical CS. In particular, we distinguish two kinds of
spherical CS:
  - Geodetic case with (spherical latitude, spherical longitude, geocentric radius) axes
  - Engineering case with (distance, bearing, elevation) axes.

In the geodetic case, the radius abbreviation is upper-case "R".
In the engineering case, the radius (or distance) abbreviation is lower-case "r".

Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisDirections.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisNames.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/metadata/AxisDirectionsTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultEngineeringCRSTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultSphericalCSTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java
    sis/branches/JDK8/src/main/config/logging.properties

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisDirections.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisDirections.java?rev=1735424&r1=1735423&r2=1735424&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisDirections.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisDirections.java
[UTF-8] Thu Mar 17 13:35:49 2016
@@ -626,14 +626,15 @@ public final class AxisDirections extend
         if (name.length() == 1) {
             return name;                    // Most common cases are "x", "y", "z", "t",
"i" and "j".
         }
+        /*
+         * Direction may be both "compass" (e.g. North) or "non-compass" (e.g. away from).
+         * Even if the radius at θ = 0° is oriented toward North, but we do not want the
"N" abbreviation.
+         */
+        if (contains(name, "radius", true)) {
+            return contains(name, "Geocentric", false) ? "R" : "r";
+        }
         if (isCompass(direction)) {
             /*
-             * Radius at θ = 0° may be oriented toward North, but we do not want the "N"
abbreviation.
-             */
-            if (contains(name, "radius", true)) {
-                return "r";
-            }
-            /*
              * NORTH, EAST, SOUTH, WEST and all intercardinal directions (SOUTH_SOUTH_WEST,
etc.):
              * we will use the acronym (e.g. "SE" for SOUTH_EAST), unless the axis is likely
to be
              * a longitude or latitude axis. We detect those later cases by the unit of measurement.
@@ -653,7 +654,10 @@ public final class AxisDirections extend
              * use "h" as the fallback for unknown vertical axis.
              */
             if (UP.equals(direction)) {
-                return contains(name, "Gravity", false) ? "H" : contains(name, "Geocentric",
false) ? "r": "h";
+                if (contains(name, "Gravity",    false)) return "H";
+                if (contains(name, "Elevation",  false)) return "φ";
+                if (contains(name, "Geocentric", false)) return "r";
+                return "h";
             } else if (DOWN.equals(direction)) {
                 return "D";                         // "Depth"
             } else if (isGeocentric(direction)) {

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisNames.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisNames.java?rev=1735424&r1=1735423&r2=1735424&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisNames.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisNames.java
[UTF-8] Thu Mar 17 13:35:49 2016
@@ -54,7 +54,8 @@ public final class AxisNames {
 
     /**
      * The ISO 19111 <cite>"spherical longitude"</cite> name. Abbreviation used
by SIS is "θ" (theta)
-     * for consistency with the EPSG "long" abbreviation, but some other conventions use
"φ" instead.
+     * for consistency with ISO 19162 <cite>Axis name and abbreviation</cite>
section,
+     * but some other conventions use φ or Ω instead.
      * Direction in the EPSG database is "East", but "counterClockwise" may also be used.
      *
      * @see <a href="http://en.wikipedia.org/wiki/Spherical_coordinate_system">Spherical
coordinate system on Wikipedia</a>
@@ -64,7 +65,8 @@ public final class AxisNames {
 
     /**
      * The ISO 19111 <cite>"spherical latitude"</cite> name. Abbreviation used
by SIS is "φ′" (phi prime)
-     * for consistency with the EPSG "lat" abbreviation, but some other conventions use "θ"
instead.
+     * for consistency with ISO 19162 <cite>Axis name and abbreviation</cite>
section,
+     * but some other conventions use θ, Ω or Ψ instead.
      * Direction in the EPSG database is "North", but the "Up" direction may also be used
with a similar
      * axis named "elevation".
      */
@@ -101,7 +103,11 @@ public final class AxisNames {
     public static final String GEOCENTRIC_Z = "Geocentric Z";
 
     /**
-     * The ISO 19111 <cite>"geocentric radius"</cite> name. Abbreviation is lower
case <cite>"r"</cite>.
+     * The ISO 19111 <cite>"geocentric radius"</cite> name. Abbreviation is upper
case <cite>"R"</cite>
+     * for consistency with EPSG database.
+     *
+     * <div class="note"><b>Note:</b>Lower case <cite>"r"</cite>
is used for non-geocentric radius
+     * or axes named "distance" with "awayFrom" direction.</div>
      */
     public static final String GEOCENTRIC_RADIUS = "Geocentric radius";
 

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java?rev=1735424&r1=1735423&r2=1735424&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java
[UTF-8] Thu Mar 17 13:35:49 2016
@@ -391,7 +391,7 @@ final class StandardDefinitions {
                        rm   = RangeMeaning.WRAPAROUND;
                        break;
             case 62:   name = "Geocentric radius";
-                       abrv = "r";                          // See HardCodedAxes.GEOCENTRIC_RADIUS
in tests.
+                       abrv = "R";                          // See HardCodedAxes.GEOCENTRIC_RADIUS
in tests.
                        unit = SI.METRE;
                        dir  = AxisDirection.UP;
                        rm   = RangeMeaning.EXACT;

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java?rev=1735424&r1=1735423&r2=1735424&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java
[UTF-8] Thu Mar 17 13:35:49 2016
@@ -99,6 +99,30 @@ final class Normalizer implements Compar
     };
 
     /**
+     * Number of bits by which to shift the {@link AxisDirection#ordinal()} value in order
to make room for
+     * inserting intermediate values between them. A shift of 2 make room for {@literal 1
<< 2} intermediate
+     * values. Those intermediate values are declared in the {@link #ORDER} map.
+     *
+     * @see #order(AxisDirection)
+     */
+    private static final int SHIFT = 2;
+
+    /**
+     * Custom code list values to handle as if the where defined between two GeoAPI values.
+     *
+     * @see #order(AxisDirection)
+     */
+    private static final Map<AxisDirection,Integer> ORDER = new HashMap<>();
+    static {
+        final Map<AxisDirection,Integer> m = ORDER;
+        // Get ordinal of last compass direction defined by GeoAPI. We will continue on the
horizontal plane.
+        final int horizontal = (AxisDirection.NORTH.ordinal() + (AxisDirections.COMPASS_COUNT
- 1)) << SHIFT;
+        m.put(AxisDirections.AWAY_FROM,         horizontal + 1);
+        m.put(AxisDirections.COUNTER_CLOCKWISE, horizontal + 2);
+        m.put(AxisDirections.CLOCKWISE,         horizontal + 3);
+    }
+
+    /**
      * The axis to be compared by {@link #compareTo(Normalizer)}.
      */
     private final CoordinateSystemAxis axis;
@@ -128,30 +152,39 @@ final class Normalizer implements Compar
     }
 
     /**
+     * Returns the order of the given axis direction.
+     */
+    private static int order(final AxisDirection dir) {
+        final Integer p = ORDER.get(dir);
+        return (p != null) ? p : (dir.ordinal() << SHIFT);
+    }
+
+    /**
      * Compares two axis for an order that try to favor right-handed coordinate systems.
      * Compass directions like North and East are first. Vertical directions like Up or Down
are next.
      */
     @Override
     public int compareTo(final Normalizer that) {
-        final int d = unitOrder - that.unitOrder;
-        if (d != 0) {
-            return d;
-        }
-        final AxisDirection d1 = this.axis.getDirection();
-        final AxisDirection d2 = that.axis.getDirection();
-        final int compass = AxisDirections.angleForCompass(d2, d1);
-        if (compass != Integer.MIN_VALUE) {
-            return compass;
-        }
-        if (meridian != null) {
-            if (that.meridian != null) {
-                return meridian.compareTo(that.meridian);
+        int d = unitOrder - that.unitOrder;
+        if (d == 0) {
+            final AxisDirection d1 = this.axis.getDirection();
+            final AxisDirection d2 = that.axis.getDirection();
+            d = AxisDirections.angleForCompass(d2, d1);
+            if (d == Integer.MIN_VALUE) {
+                if (meridian != null) {
+                    if (that.meridian != null) {
+                        d = meridian.compareTo(that.meridian);
+                    } else {
+                        d = -1;
+                    }
+                } else if (that.meridian != null) {
+                    d = +1;
+                } else {
+                    d = order(d1) - order(d2);
+                }
             }
-            return -1;
-        } else if (that.meridian != null) {
-            return +1;
         }
-        return d1.ordinal() - d2.ordinal();
+        return d;
     }
 
     /**
@@ -201,22 +234,8 @@ final class Normalizer implements Compar
             return axis;
         }
         final String abbreviation = axis.getAbbreviation();
-        String newAbbr = abbreviation;
-        if (!sameDirection) {
-            if (AxisDirections.isCompass(direction)) {
-                if (CharSequences.isAcronymForWords(abbreviation, direction.name())) {
-                    if (newDir.equals(AxisDirection.EAST)) {
-                        newAbbr = "E";
-                    } else if (newDir.equals(AxisDirection.NORTH)) {
-                        newAbbr = "N";
-                    }
-                }
-            } else if (newDir.equals(AxisDirection.UP)) {
-                newAbbr = "z";
-            } else if (newDir.equals(AxisDirection.FUTURE)) {
-                newAbbr = "t";
-            }
-        }
+        final String newAbbr = sameDirection ? abbreviation :
+                AxisDirections.suggestAbbreviation(axis.getName().getCode(), newDir, newUnit);
         final Map<String,Object> properties = new HashMap<>();
         if (newAbbr.equals(abbreviation)) {
             properties.putAll(IdentifiedObjects.getProperties(axis, EXCLUDES));
@@ -287,12 +306,6 @@ final class Normalizer implements Compar
             changed |= sort(axes, angularUnitOrder);
             if (angularUnitOrder == 1) {                            // Cylindrical or polar
                 /*
-                 * Direction "awayFrom" (r) should be first.
-                 */
-                if (AxisDirections.AWAY_FROM.equals(axes[1].getDirection()) && Units.isLinear(axes[0].getUnit()))
{
-                    ArraysExt.swap(axes, 0, 1);
-                }
-                /*
                  * Change (r,z,θ) to (r,θ,z) order in CylindricalCS. The check on unit
of
                  * measurements should be always true, but we verify as a paranoiac check.
                  */
@@ -301,7 +314,7 @@ final class Normalizer implements Compar
                 }
                 /*
                  * If we were not allowed to normalize the axis direction, we may have a
-                 * left-handed coordinate system here. Is so, make it right-handed.
+                 * left-handed coordinate system here. If so, make it right-handed.
                  */
                 if (AxisDirections.CLOCKWISE.equals(axes[1].getDirection()) && isLengthAndAngle(axes,
0)) {
                     ArraysExt.swap(axes, 0, 1);

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/metadata/AxisDirectionsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/metadata/AxisDirectionsTest.java?rev=1735424&r1=1735423&r2=1735424&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/metadata/AxisDirectionsTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/metadata/AxisDirectionsTest.java
[UTF-8] Thu Mar 17 13:35:49 2016
@@ -32,6 +32,9 @@ import org.junit.Test;
 import static org.junit.Assert.*;
 import static java.lang.StrictMath.abs;
 import static org.opengis.referencing.cs.AxisDirection.*;
+import static org.apache.sis.internal.metadata.AxisDirections.AWAY_FROM;
+import static org.apache.sis.internal.metadata.AxisDirections.CLOCKWISE;
+import static org.apache.sis.internal.metadata.AxisDirections.COUNTER_CLOCKWISE;
 
 
 /**
@@ -63,6 +66,9 @@ public final strictfp class AxisDirectio
         assertEquals(UP,                AxisDirections.absolute(DOWN));
         assertEquals(FUTURE,            AxisDirections.absolute(FUTURE));
         assertEquals(FUTURE,            AxisDirections.absolute(PAST));
+        assertEquals(AWAY_FROM,         AxisDirections.absolute(AWAY_FROM));
+        assertEquals(COUNTER_CLOCKWISE, AxisDirections.absolute(CLOCKWISE));
+        assertEquals(COUNTER_CLOCKWISE, AxisDirections.absolute(COUNTER_CLOCKWISE));
     }
 
     /**
@@ -82,6 +88,9 @@ public final strictfp class AxisDirectio
         assertEquals(UP,                AxisDirections.opposite(DOWN));
         assertEquals(PAST,              AxisDirections.opposite(FUTURE));
         assertEquals(FUTURE,            AxisDirections.opposite(PAST));
+        assertEquals(COUNTER_CLOCKWISE, AxisDirections.opposite(CLOCKWISE));
+        assertEquals(CLOCKWISE,         AxisDirections.opposite(COUNTER_CLOCKWISE));
+        assertNull  (                   AxisDirections.opposite(AWAY_FROM));
     }
 
     /**
@@ -381,7 +390,10 @@ public final strictfp class AxisDirectio
         assertEquals("φ′",  AxisDirections.suggestAbbreviation("Spherical latitude", 
   NORTH,         NonSI.DEGREE_ANGLE));
         assertEquals("h",   AxisDirections.suggestAbbreviation("Ellipsoidal height",    
UP,               SI.METRE));
         assertEquals("H",   AxisDirections.suggestAbbreviation("Gravity-related height",
UP,               SI.METRE));
-        assertEquals("r",   AxisDirections.suggestAbbreviation("Geocentric radius",     
UP,               SI.METRE));
+        assertEquals("φ",   AxisDirections.suggestAbbreviation("Elevation",            
 UP,               SI.METRE));
+        assertEquals("R",   AxisDirections.suggestAbbreviation("Geocentric radius",     
UP,               SI.METRE));
+        assertEquals("r",   AxisDirections.suggestAbbreviation("Distance",              
AWAY_FROM,        SI.METRE));
+        assertEquals("θ",   AxisDirections.suggestAbbreviation("Bearing",              
 CLOCKWISE,     NonSI.DEGREE_ANGLE));
         assertEquals("X",   AxisDirections.suggestAbbreviation("not needed",            
GEOCENTRIC_X,     SI.METRE));
         assertEquals("Y",   AxisDirections.suggestAbbreviation("not needed",            
GEOCENTRIC_Y,     SI.METRE));
         assertEquals("Z",   AxisDirections.suggestAbbreviation("not needed",            
GEOCENTRIC_Z,     SI.METRE));

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultEngineeringCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultEngineeringCRSTest.java?rev=1735424&r1=1735423&r2=1735424&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultEngineeringCRSTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultEngineeringCRSTest.java
[UTF-8] Thu Mar 17 13:35:49 2016
@@ -86,7 +86,7 @@ public final strictfp class DefaultEngin
                 "  CS[spherical, 3],\n" +
                 "    AXIS[“Spherical latitude (U)”, north, ORDER[1], ANGLEUNIT[“degree”,
0.017453292519943295]],\n" +
                 "    AXIS[“Spherical longitude (V)”, east, ORDER[2], ANGLEUNIT[“degree”,
0.017453292519943295]],\n" +
-                "    AXIS[“Geocentric radius (r)”, up, ORDER[3], LENGTHUNIT[“metre”,
1]]]",
+                "    AXIS[“Geocentric radius (R)”, up, ORDER[3], LENGTHUNIT[“metre”,
1]]]",
                 crs);
     }
 
@@ -102,7 +102,7 @@ public final strictfp class DefaultEngin
                 "  CS[spherical, 3],\n" +
                 "    Axis[“Spherical latitude (U)”, north, Unit[“degree”, 0.017453292519943295]],\n"
+
                 "    Axis[“Spherical longitude (V)”, east, Unit[“degree”, 0.017453292519943295]],\n"
+
-                "    Axis[“Geocentric radius (r)”, up, Unit[“metre”, 1]]]",
+                "    Axis[“Geocentric radius (R)”, up, Unit[“metre”, 1]]]",
                 crs);
     }
 
@@ -192,7 +192,7 @@ public final strictfp class DefaultEngin
                 "    <gml:axis>\n" +
                 "      <gml:CoordinateSystemAxis uom=\"urn:ogc:def:uom:EPSG::9001\" gml:id=\"GeocentricRadius\">\n"
+
                 "        <gml:name>Geocentric radius</gml:name>\n" +
-                "        <gml:axisAbbrev>r</gml:axisAbbrev>\n" +
+                "        <gml:axisAbbrev>R</gml:axisAbbrev>\n" +
                 "        <gml:axisDirection codeSpace=\"EPSG\">up</gml:axisDirection>\n"
+
                 "        <gml:minimumValue>0.0</gml:minimumValue>\n" +
                 "        <gml:rangeMeaning codeSpace=\"EPSG\">exact</gml:rangeMeaning>\n"
+
@@ -222,6 +222,6 @@ public final strictfp class DefaultEngin
         assertEquals("cs.axis[2].name", "Geocentric radius",   cs.getAxis(2).getName().getCode());
         assertEquals("cs.axis[0].abbreviation", "φ′",          cs.getAxis(0).getAbbreviation());
         assertEquals("cs.axis[1].abbreviation", "θ",           cs.getAxis(1).getAbbreviation());
-        assertEquals("cs.axis[2].abbreviation", "r",           cs.getAxis(2).getAbbreviation());
+        assertEquals("cs.axis[2].abbreviation", "R",           cs.getAxis(2).getAbbreviation());
     }
 }

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=1735424&r1=1735423&r2=1735424&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] Thu Mar 17 13:35:49 2016
@@ -18,6 +18,7 @@ package org.apache.sis.referencing.cs;
 
 import java.util.Collections;
 import org.opengis.referencing.cs.AxisDirection;
+import org.apache.sis.internal.metadata.AxisDirections;
 import org.apache.sis.test.TestCase;
 import org.apache.sis.test.DependsOn;
 import org.junit.Test;
@@ -36,11 +37,20 @@ import static org.opengis.test.Assert.*;
 @DependsOn(AbstractCSTest.class)
 public final strictfp class DefaultSphericalCSTest extends TestCase {
     /**
-     * Tests {@link DefaultSphericalCS#forConvention(AxesConvention)} with a change of axis
order.
+     * Tests a spherical CRS conforms to EPSG:8.9:6404 definition.
+     * Expected axes are:
+     *
+     * <ol>
+     *   <li>Spherical latitude (φ′)</li>
+     *   <li>Spherical longitude (θ)</li>
+     *   <li>Geocentric radius (R)</li>
+     * </ol>
      */
     @Test
-    public void testChangeAxisOrder() {
+    public void testGeodetic() {
         final DefaultSphericalCS cs = HardCodedCS.SPHERICAL;
+        assertEquals("EPSG abbreviation for geocentric radius should be upper-case", "R",
cs.getAxis(2).getAbbreviation());
+
         final DefaultSphericalCS normalized = cs.forConvention(AxesConvention.CONVENTIONALLY_ORIENTED);
         assertNotSame("Should create a new CoordinateSystem.", cs, normalized);
         assertAxisDirectionsEqual("Normalized", normalized,
@@ -52,7 +62,32 @@ public final strictfp class DefaultSpher
                 Collections.singletonMap(AbstractCS.NAME_KEY, "Spherical CS: East (°), North
(°), Up (m)."),
                 HardCodedAxes.SPHERICAL_LONGITUDE,
                 HardCodedAxes.SPHERICAL_LATITUDE,
-                HardCodedAxes.GEOCENTRIC_RADIUS
-        ), normalized);
+                HardCodedAxes.GEOCENTRIC_RADIUS), normalized);
+    }
+
+    /**
+     * Tests a spherical CRS conforms to the example given in ISO 19162.
+     * Expected axes are:
+     *
+     * <ol>
+     *   <li>Distance (r)</li>
+     *   <li>Longitude</li>
+     *   <li>Elevation</li>
+     * </ol>
+     *
+     * This order is not exactly the usual engineering axis order.
+     * But this is the order expected by the {@code SphericalToCartesian} transform.
+     */
+    @Test
+    public void testEngineering() {
+        final DefaultSphericalCS cs = HardCodedCS.SPHERICAL_ENGINEERING;
+        assertEquals("Abbreviation for distance should be lower-case", "r", cs.getAxis(0).getAbbreviation());
+
+        final DefaultSphericalCS normalized = cs.forConvention(AxesConvention.NORMALIZED);
+        assertNotSame("Should create a new CoordinateSystem.", cs, normalized);
+        assertAxisDirectionsEqual("Normalized", normalized,
+                AxisDirections.COUNTER_CLOCKWISE,
+                AxisDirection.UP,
+                AxisDirections.AWAY_FROM);
     }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java?rev=1735424&r1=1735423&r2=1735424&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java
[UTF-8] Thu Mar 17 13:35:49 2016
@@ -165,20 +165,24 @@ public final strictfp class HardCodedAxe
      * Axis for radius in a {@linkplain org.apache.sis.referencing.crs.DefaultGeocentricCRS
geocentric CRS}
      * using {@linkplain org.apache.sis.referencing.cs.DefaultSphericalCS spherical CS}.
      * Increasing ordinates values go {@linkplain AxisDirection#UP up} and units are {@linkplain
SI#METRE metres}.
-     * The ISO 19111 name is <cite>"geocentric radius"</cite> and the abbreviation
is lower case <cite>"r"</cite>.
+     * The ISO 19111 name is <cite>"geocentric radius"</cite> and the abbreviation
is upper-case <cite>"R"</cite>.
      *
-     * <div class="note"><b>Note:</b> EPSG dataset 8.9 uses upper-case
<cite>"R"</cite>.
-     * In this class, we use the ISO 19111 abbreviation instead.</div>
+     * <div class="note"><b>Note:</b>
+     * The uses upper-case <cite>"R"</cite> come from EPSG dataset 8.9.
+     * ISO 19111 and 19162 use lower-case <cite>"r"</cite> instead,
+     * but with "awayFrom" direction instead of "geocentricRadius".
+     * In this class, <cite>"r"</cite> is taken by {@link #DISTANCE}.</div>
      *
      * <p>This axis is usually part of a {@link #SPHERICAL_LONGITUDE}, {@link #SPHERICAL_LATITUDE},
      * {@link #GEOCENTRIC_RADIUS} set.</p>
      *
+     * @see #DISTANCE
      * @see #ALTITUDE
      * @see #ELLIPSOIDAL_HEIGHT
      * @see #GRAVITY_RELATED_HEIGHT
      * @see #DEPTH
      */
-    public static final DefaultCoordinateSystemAxis GEOCENTRIC_RADIUS = create(AxisNames.GEOCENTRIC_RADIUS,
"r",
+    public static final DefaultCoordinateSystemAxis GEOCENTRIC_RADIUS = create(AxisNames.GEOCENTRIC_RADIUS,
"R",
             AxisDirection.UP, SI.METRE, 0, Double.POSITIVE_INFINITY, RangeMeaning.EXACT);
 
     /**
@@ -191,6 +195,7 @@ public final strictfp class HardCodedAxe
      * <p>This axis is close to the definition found in the EPSG database, except for
the "long" abbreviation which
      * is replaced by "θ". Note that other conventions exist, in which the meaning of φ
and θ are interchanged.
      * ISO mentions also the symbol Ω, but it is not clear if it applies to longitude or
latitude.
+     * The "θ" abbreviation used here is found in ISO 19162.
      * See {@link AxisNames#SPHERICAL_LONGITUDE} for other information.</p>
      *
      * <p>This axis is usually part of a {@link #SPHERICAL_LONGITUDE}, {@link #SPHERICAL_LATITUDE},
@@ -216,6 +221,7 @@ public final strictfp class HardCodedAxe
      * which is replaced by "φ′". Note that other conventions exist, in which the meaning
of φ and θ are
      * interchanged or in which this axis is named "elevation" and is oriented toward "Up".
      * Other conventions use symbol Ψ or Ω.
+     * The "φ" abbreviation used here is found in ISO 19162.
      * See {@link AxisNames#SPHERICAL_LATITUDE} for other information.</p>
      *
      * <p>This axis is usually part of a {@link #SPHERICAL_LONGITUDE}, {@link #SPHERICAL_LATITUDE},
@@ -380,19 +386,31 @@ public final strictfp class HardCodedAxe
 
     /**
      * An axis for a distance from an origin.
-     * This is part of a polar coordinate system.
+     * This is part of a polar or engineering spherical coordinate system
+     * (not to be confused with geodetic spherical coordinate system).
+     *
+     * @see #GEOCENTRIC_RADIUS
      */
     public static final DefaultCoordinateSystemAxis DISTANCE = create("Distance", "r",
             AxisDirections.AWAY_FROM, SI.METRE, 0, Double.POSITIVE_INFINITY, RangeMeaning.EXACT);
 
     /**
      * An axis with clockwise orientation.
-     * This is part of a polar coordinate system.
+     * This is part of a polar or engineering spherical coordinate system
+     * (not to be confused with geodetic spherical coordinate system).
      */
     public static final DefaultCoordinateSystemAxis BEARING = create("Bearing", "θ",
             AxisDirections.CLOCKWISE, NonSI.DEGREE_ANGLE, -180, +180, RangeMeaning.WRAPAROUND);
 
     /**
+     * An axis with for elevation angle.
+     * This is part of an engineering spherical coordinate system
+     * (not to be confused with geodetic spherical coordinate system).
+     */
+    public static final DefaultCoordinateSystemAxis ELEVATION = create("Elevation", "φ",
+            AxisDirection.UP, NonSI.DEGREE_ANGLE, -90, +90, RangeMeaning.WRAPAROUND);
+
+    /**
      * Axis for time values in a {@linkplain org.apache.sis.referencing.cs.DefaultTimeCS
time CS}.
      * Increasing time go toward {@linkplain AxisDirection#FUTURE future} and units are {@linkplain
NonSI#DAY days}.
      * The abbreviation is lower case <cite>"t"</cite>.

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java?rev=1735424&r1=1735423&r2=1735424&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedCS.java
[UTF-8] Thu Mar 17 13:35:49 2016
@@ -84,12 +84,14 @@ public final strictfp class HardCodedCS
             HardCodedAxes.LATITUDE_gon);
 
     /**
-     * A three-dimensional spherical CS with
+     * A three-dimensional spherical CS for geodetic use with
      * <var>{@linkplain HardCodedAxes#SPHERICAL_LATITUDE latitude}</var>,
      * <var>{@linkplain HardCodedAxes#SPHERICAL_LONGITUDE longitude}</var>,
      * <var>{@linkplain HardCodedAxes#GEOCENTRIC_RADIUS radius}</var> axes.
      * This axis order is the one of EPSG:6404.
      * Note that this is not a right-handed system.
+     *
+     * @see #SPHERICAL_ENGINEERING
      */
     public static final DefaultSphericalCS SPHERICAL = new DefaultSphericalCS(
             singletonMap(NAME_KEY, "Spherical"),
@@ -98,6 +100,18 @@ public final strictfp class HardCodedCS
             HardCodedAxes.GEOCENTRIC_RADIUS);
 
     /**
+     * A three-dimensional spherical CS for geodetic use with
+     * <var>{@linkplain HardCodedAxes#DISTANCE distance}</var>,
+     * <var>{@linkplain HardCodedAxes#BEARING bearing}</var>,
+     * <var>{@linkplain HardCodedAxes#ELEVATION elevation}</var> axes.
+     */
+    public static final DefaultSphericalCS SPHERICAL_ENGINEERING = new DefaultSphericalCS(
+            singletonMap(NAME_KEY, SPHERICAL.getName()),
+            HardCodedAxes.DISTANCE,
+            HardCodedAxes.BEARING,
+            HardCodedAxes.ELEVATION);
+
+    /**
      * A three-dimensional Cartesian CS with geocentric
      * <var>{@linkplain HardCodedAxes#GEOCENTRIC_X x}</var>,
      * <var>{@linkplain HardCodedAxes#GEOCENTRIC_Y y}</var>,

Modified: sis/branches/JDK8/src/main/config/logging.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/src/main/config/logging.properties?rev=1735424&r1=1735423&r2=1735424&view=diff
==============================================================================
--- sis/branches/JDK8/src/main/config/logging.properties [UTF-8] (original)
+++ sis/branches/JDK8/src/main/config/logging.properties [UTF-8] Thu Mar 17 13:35:49 2016
@@ -17,7 +17,10 @@
 handlers= java.util.logging.ConsoleHandler
 
 # Default global logging level.
-.level= FINE
+.level= CONFIG
+
+# Enable debugging information for Apache SIS packages.
+org.apache.sis.level= FINE
 
 # Set the message that are printed on the console to FINE and above.
 # FINE provides debugging information normally hidden in production.



Mime
View raw message