Author: desruisseaux
Date: Wed Jan 22 19:02:40 2014
New Revision: 1560476

URL: http://svn.apache.org/r1560476
Log:
Documentation clarification, fixed EPSG codes for geographic 3D CRS and added 
tests.

Modified:
    
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
    
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
    
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
    
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
    
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java

Modified: 
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java?rev=1560476&r1=1560475&r2=1560476&view=diff
==============================================================================
--- 
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
 [UTF-8] (original)
+++ 
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
 [UTF-8] Wed Jan 22 19:02:40 2014
@@ -59,17 +59,23 @@ public final class CRS extends Static {
      * on any installation of Apache SIS version 0.4 or above:
      *
      * <blockquote><table class="sis">
-     *   <tr><th>Code</th>      <th>Enum</th>                                  
<th>CRS Type</th>   <th>Description</th></tr>
-     *   <tr><td>CRS:27</td>    <td>{@link CommonCRS#NAD27  NAD27}</td>  
<td>Geographic</td> <td>Like EPSG:4267 except for (<var>longitude</var>, 
<var>latitude</var>) axis order</td></tr>
-     *   <tr><td>CRS:83</td>    <td>{@link CommonCRS#NAD83  NAD83}</td>  
<td>Geographic</td> <td>Like EPSG:4269 except for (<var>longitude</var>, 
<var>latitude</var>) axis order</td></tr>
-     *   <tr><td>CRS:84</td>    <td>{@link CommonCRS#WGS84  WGS84}</td>  
<td>Geographic</td> <td>Like EPSG:4326 except for (<var>longitude</var>, 
<var>latitude</var>) axis order</td></tr>
-     *   <tr><td>EPSG:4047</td> <td>{@link CommonCRS#SPHERE SPHERE}</td> 
<td>Geographic</td> <td>GRS 1980 Authalic Sphere</td></tr>
-     *   <tr><td>EPSG:4230</td> <td>{@link CommonCRS#ED50   ED50}</td>   
<td>Geographic</td> <td>European Datum 1950</td></tr>
-     *   <tr><td>EPSG:4258</td> <td>{@link CommonCRS#ETRS89 ETRS89}</td> 
<td>Geographic</td> <td>European Terrestrial Reference Frame 1989</td></tr>
-     *   <tr><td>EPSG:4267</td> <td>{@link CommonCRS#NAD27  NAD27}</td>  
<td>Geographic</td> <td>North American Datum 1927</td></tr>
-     *   <tr><td>EPSG:4269</td> <td>{@link CommonCRS#NAD83  NAD83}</td>  
<td>Geographic</td> <td>North American Datum 1983</td></tr>
-     *   <tr><td>EPSG:4322</td> <td>{@link CommonCRS#WGS72  WGS72}</td>  
<td>Geographic</td> <td>World Geodetic System 1972</td></tr>
-     *   <tr><td>EPSG:4326</td> <td>{@link CommonCRS#WGS84  WGS84}</td>  
<td>Geographic</td> <td>World Geodetic System 1984</td></tr>
+     *   <tr><th>Code</th>      <th>Enum</th>                            
<th>CRS Type</th>      <th>Description</th></tr>
+     *   <tr><td>CRS:27</td>    <td>{@link CommonCRS#NAD27  NAD27}</td>  
<td>Geographic</td>    <td>Like EPSG:4267 except for (<var>longitude</var>, 
<var>latitude</var>) axis order</td></tr>
+     *   <tr><td>CRS:83</td>    <td>{@link CommonCRS#NAD83  NAD83}</td>  
<td>Geographic</td>    <td>Like EPSG:4269 except for (<var>longitude</var>, 
<var>latitude</var>) axis order</td></tr>
+     *   <tr><td>CRS:84</td>    <td>{@link CommonCRS#WGS84  WGS84}</td>  
<td>Geographic</td>    <td>Like EPSG:4326 except for (<var>longitude</var>, 
<var>latitude</var>) axis order</td></tr>
+     *   <tr><td>EPSG:4047</td> <td>{@link CommonCRS#SPHERE SPHERE}</td> 
<td>Geographic</td>    <td>GRS 1980 Authalic Sphere</td></tr>
+     *   <tr><td>EPSG:4230</td> <td>{@link CommonCRS#ED50   ED50}</td>   
<td>Geographic</td>    <td>European Datum 1950</td></tr>
+     *   <tr><td>EPSG:4258</td> <td>{@link CommonCRS#ETRS89 ETRS89}</td> 
<td>Geographic</td>    <td>European Terrestrial Reference Frame 1989</td></tr>
+     *   <tr><td>EPSG:4267</td> <td>{@link CommonCRS#NAD27  NAD27}</td>  
<td>Geographic</td>    <td>North American Datum 1927</td></tr>
+     *   <tr><td>EPSG:4269</td> <td>{@link CommonCRS#NAD83  NAD83}</td>  
<td>Geographic</td>    <td>North American Datum 1983</td></tr>
+     *   <tr><td>EPSG:4322</td> <td>{@link CommonCRS#WGS72  WGS72}</td>  
<td>Geographic</td>    <td>World Geodetic System 1972</td></tr>
+     *   <tr><td>EPSG:4326</td> <td>{@link CommonCRS#WGS84  WGS84}</td>  
<td>Geographic</td>    <td>World Geodetic System 1984</td></tr>
+     *   <tr><td>EPSG:4936</td> <td>{@link CommonCRS#ETRS89 ETRS89}</td> 
<td>Geocentric</td>    <td>European Terrestrial Reference Frame 1989</td></tr>
+     *   <tr><td>EPSG:4937</td> <td>{@link CommonCRS#ETRS89 ETRS89}</td> 
<td>Geographic 3D</td> <td>European Terrestrial Reference Frame 1989</td></tr>
+     *   <tr><td>EPSG:4978</td> <td>{@link CommonCRS#WGS84  WGS84}</td>  
<td>Geocentric</td>    <td>World Geodetic System 1984</td></tr>
+     *   <tr><td>EPSG:4979</td> <td>{@link CommonCRS#WGS84  WGS84}</td>  
<td>Geographic 3D</td> <td>World Geodetic System 1984</td></tr>
+     *   <tr><td>EPSG:4984</td> <td>{@link CommonCRS#WGS72  WGS72}</td>  
<td>Geocentric</td>    <td>World Geodetic System 1972</td></tr>
+     *   <tr><td>EPSG:4985</td> <td>{@link CommonCRS#WGS72  WGS72}</td>  
<td>Geographic 3D</td> <td>World Geodetic System 1972</td></tr>
      *   <tr><td>EPSG:5715</td> <td>{@link CommonCRS.Vertical#DEPTH  
DEPTH}</td> <td>Vertical</td> <td>Mean Sea Level depth</td></tr>
      *   <tr><td>EPSG:5714</td> <td>{@link CommonCRS.Vertical#MEAN_SEA_LEVEL 
MEAN_SEA_LEVEL}</td> <td>Vertical</td> <td>Mean Sea Level height</td></tr>
      * </table></blockquote>
@@ -122,14 +128,16 @@ public final class CRS extends Static {
                 }
             } else if (authority.equalsIgnoreCase("EPSG")) {
                 final int n = Integer.parseInt(value);
-                for (final CommonCRS candidate : CommonCRS.values()) {
-                    if (candidate.geographic == n) {
-                        return candidate.geographic();
+                if (n != 0) { // CommonCRS uses 0 as a sentinel value for "no 
EPSG code".
+                    for (final CommonCRS candidate : CommonCRS.values()) {
+                        if (candidate.geographic == n) return 
candidate.geographic();
+                        if (candidate.geocentric == n) return 
candidate.geocentric();
+                        if (candidate.geo3D      == n) return 
candidate.geographic3D();
                     }
-                }
-                for (final CommonCRS.Vertical candidate : 
CommonCRS.Vertical.values()) {
-                    if (candidate.isEPSG && candidate.crs == n) {
-                        return candidate.crs();
+                    for (final CommonCRS.Vertical candidate : 
CommonCRS.Vertical.values()) {
+                        if (candidate.isEPSG && candidate.crs == n) {
+                            return candidate.crs();
+                        }
                     }
                 }
             } else {

Modified: 
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java?rev=1560476&r1=1560475&r2=1560476&view=diff
==============================================================================
--- 
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
 [UTF-8] (original)
+++ 
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
 [UTF-8] Wed Jan 22 19:02:40 2014
@@ -124,7 +124,7 @@ public enum CommonCRS {
      *   <tr><th>Ellipsoid axes unit:</th>     <td>{@link SI#METRE}</td></tr>
      * </table></blockquote>
      */
-    WGS84((short) 4326, (short) 0, (short) 4978, (short) 6326, (short) 7030),
+    WGS84((short) 4326, (short) 4979, (short) 4978, (short) 6326, (short) 
7030),
 
     /**
      * World Geodetic System 1972.
@@ -140,7 +140,7 @@ public enum CommonCRS {
      *   <tr><th>Ellipsoid axes unit:</th>     <td>{@link SI#METRE}</td></tr>
      * </table></blockquote>
      */
-    WGS72((short) 4322, (short) 0, (short) 4984, (short) 6322, (short) 7043),
+    WGS72((short) 4322, (short) 4985, (short) 4984, (short) 6322, (short) 
7043),
 
     /**
      * European Terrestrial Reference System 1989.
@@ -162,7 +162,7 @@ public enum CommonCRS {
      *        The <cite>Web Map Server</cite> <code>"CRS:83"</code> authority 
code uses the NAD83 datum,
      *        while the <code>"IGNF:MILLER"</code> authority code uses the 
GRS80 datum.}
      */
-    ETRS89((short) 4258, (short) 0, (short) 4936, (short) 6258, (short) 7019),
+    ETRS89((short) 4258, (short) 4937, (short) 4936, (short) 6258, (short) 
7019),
 
     /**
      * North American Datum 1983.

Modified: 
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java?rev=1560476&r1=1560475&r2=1560476&view=diff
==============================================================================
--- 
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
 [UTF-8] (original)
+++ 
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
 [UTF-8] Wed Jan 22 19:02:40 2014
@@ -49,8 +49,9 @@ import org.opengis.referencing.cs.Coordi
  * {@link #RIGHT_HANDED} or {@link #NORMALIZED} enumeration value.</p>
  *
  * {@section Normalized coordinate systems}
- * The definition of <cite>normalized coordinate systems</cite> is somewhat 
fuzzy.
- * This concept appears in the Web Map Services (WMS) 1.3 specification, 
quoted here:
+ * <cite>Right-handed</cite> coordinate systems have a precise meaning in 
Apache SIS.
+ * However SIS defines also <cite>normalized</cite> coordinate systems in a 
more heuristic way.
+ * A similar concept appears in the Web Map Services (WMS) 1.3 specification, 
quoted here:
  *
  * <blockquote><font size="-1"><b>6.7.2 Map CS</b> —
  * The usual orientation of the Map CS shall be such that the <var>i</var> 
axis is parallel to the East-to-West axis
@@ -59,18 +60,9 @@ import org.opengis.referencing.cs.Coordi
  * orthographic projection over the South Pole. The convention to be followed 
is that, wherever possible, East shall
  * be to the right edge and North shall be toward the upper edge of the Map 
CS.</font></blockquote>
  *
- * In addition to WMS, this method is used together with
- * {@link org.apache.sis.referencing.cs.CoordinateSystems#swapAndScaleAxes 
CoordinateSystems.swapAndScaleAxes(…)}
- * for the creation of transformation steps, as in the example below:
- *
- * {@preformat java
- *     Matrix step1 = swapAndScaleAxes(sourceCS, 
sourceCS.forConvention(NORMALIZED));
- *     Matrix step2 = ... some coordinate operation working on normalized axes 
...
- *     Matrix step3 = swapAndScaleAxes(targetCS.forConvention(NORMALIZED), 
targetCS);
- * }
- *
- * A rational for normalized axes order and units is explained in the 
<cite>Axis units and directions</cite>
- * section of {@linkplain org.apache.sis.referencing.operation.projection map 
projection package description}.
+ * In addition to WMS, Apache SIS uses normalized coordinate systems in map 
projections.
+ * More information are provided in the <cite>Axis units and directions</cite> 
section of
+ * {@linkplain org.apache.sis.referencing.operation.projection map projection 
package}.
  *
  * {@section Range of longitude values}
  * Most geographic CRS have a longitude axis defined in the [-180 … +180]° 
range. All map projections in Apache SIS are

Modified: 
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java?rev=1560476&r1=1560475&r2=1560476&view=diff
==============================================================================
--- 
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
 [UTF-8] (original)
+++ 
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
 [UTF-8] Wed Jan 22 19:02:40 2014
@@ -206,12 +206,12 @@ public final class CoordinateSystems ext
 
     /**
      * Returns an affine transform between two coordinate systems.
-     * The two coordinate systems must implement the same GeoAPI coordinate 
system interface
-     * (for example both of them shall implement {@link 
org.opengis.referencing.cs.CartesianCS},
-     * or both of them shall implement {@link 
org.opengis.referencing.cs.EllipsoidalCS}).
+     * The two coordinate systems must implement the same GeoAPI coordinate 
system interface.
+     * For example if {@code sourceCRS} is a {@link 
org.opengis.referencing.cs.CartesianCS},
+     * then {@code targetCRS} must be a {@code CartesianCS} too.
      * Only units and axes order (e.g. transforming from
-     * ({@linkplain AxisDirection#NORTH NORTH},{@linkplain AxisDirection#WEST 
WEST}) to
-     * ({@linkplain AxisDirection#EAST EAST},{@linkplain AxisDirection#NORTH 
NORTH})
+     * ({@linkplain AxisDirection#NORTH North}, {@linkplain AxisDirection#WEST 
West}) to
+     * ({@linkplain AxisDirection#EAST East}, {@linkplain AxisDirection#NORTH 
North})
      * are taken in account by this method.
      *
      * <blockquote><font size="-1"><b>Example:</b>

Modified: 
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
URL: 
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java?rev=1560476&r1=1560475&r2=1560476&view=diff
==============================================================================
--- 
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
 [UTF-8] (original)
+++ 
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
 [UTF-8] Wed Jan 22 19:02:40 2014
@@ -16,7 +16,7 @@
  */
 package org.apache.sis.referencing;
 
-import org.opengis.referencing.crs.GeographicCRS;
+import org.opengis.referencing.crs.SingleCRS;
 import org.opengis.util.FactoryException;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
@@ -41,7 +41,7 @@ public final strictfp class CRSTest exte
     /**
      * Asserts that the result of {@link CRS#forCode(String)} is the given CRS.
      */
-    private static void verifyForCode(final GeographicCRS expected, final 
String code) throws FactoryException {
+    private static void verifyForCode(final SingleCRS expected, final String 
code) throws FactoryException {
         assertSame(code, expected, CRS.forCode(code));
     }
 
@@ -52,17 +52,23 @@ public final strictfp class CRSTest exte
      */
     @Test
     public void testForEpsgCode() throws FactoryException {
-        verifyForCode(CommonCRS.WGS84 .geographic(), "EPSG:4326");
-        verifyForCode(CommonCRS.WGS84 .geographic(), 
"urn:ogc:def:crs:EPSG::4326");
-        verifyForCode(CommonCRS.WGS84 .geographic(), 
"http://www.opengis.net/gml/srs/epsg.xml#4326";);
-        verifyForCode(CommonCRS.WGS72 .geographic(), "EPSG:4322");
-        verifyForCode(CommonCRS.SPHERE.geographic(), "EPSG:4047");
-        verifyForCode(CommonCRS.NAD83 .geographic(), "EPSG:4269");
-        verifyForCode(CommonCRS.NAD27 .geographic(), "EPSG:4267");
-        verifyForCode(CommonCRS.ETRS89.geographic(), "EPSG:4258");
-        verifyForCode(CommonCRS.ED50  .geographic(), "EPSG:4230");
-        assertSame("EPSG:5714", CommonCRS.Vertical.MEAN_SEA_LEVEL.crs(), 
CRS.forCode("EPSG:5714"));
-        assertSame("EPSG:5715", CommonCRS.Vertical.DEPTH.crs(), 
CRS.forCode("EPSG:5715"));
+        verifyForCode(CommonCRS.WGS84 .geographic(),   "EPSG:4326");
+        verifyForCode(CommonCRS.WGS84 .geographic(),   
"urn:ogc:def:crs:EPSG::4326");
+        verifyForCode(CommonCRS.WGS84 .geographic(),   
"http://www.opengis.net/gml/srs/epsg.xml#4326";);
+        verifyForCode(CommonCRS.WGS72 .geographic(),   "EPSG:4322");
+        verifyForCode(CommonCRS.SPHERE.geographic(),   "EPSG:4047");
+        verifyForCode(CommonCRS.NAD83 .geographic(),   "EPSG:4269");
+        verifyForCode(CommonCRS.NAD27 .geographic(),   "EPSG:4267");
+        verifyForCode(CommonCRS.ETRS89.geographic(),   "EPSG:4258");
+        verifyForCode(CommonCRS.ED50  .geographic(),   "EPSG:4230");
+        verifyForCode(CommonCRS.WGS84 .geocentric(),   "EPSG:4978");
+        verifyForCode(CommonCRS.WGS72 .geocentric(),   "EPSG:4984");
+        verifyForCode(CommonCRS.ETRS89.geocentric(),   "EPSG:4936");
+        verifyForCode(CommonCRS.WGS84 .geographic3D(), "EPSG:4979");
+        verifyForCode(CommonCRS.WGS72 .geographic3D(), "EPSG:4985");
+        verifyForCode(CommonCRS.ETRS89.geographic3D(), "EPSG:4937");
+        verifyForCode(CommonCRS.Vertical.MEAN_SEA_LEVEL.crs(), "EPSG:5714");
+        verifyForCode(CommonCRS.Vertical.DEPTH.crs(), "EPSG:5715");
     }
 
     /**


Reply via email to