sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1719083 - in /sis/branches/JDK8/core/sis-referencing/src: main/java/org/apache/sis/referencing/ main/java/org/apache/sis/referencing/factory/ test/java/org/apache/sis/referencing/ test/java/org/apache/sis/referencing/factory/ test/java/org...
Date Thu, 10 Dec 2015 14:03:42 GMT
Author: desruisseaux
Date: Thu Dec 10 14:03:41 2015
New Revision: 1719083

URL: http://svn.apache.org/viewvc?rev=1719083&view=rev
Log:
Port authority factory for CRS:84, CRS:83 and CRS:27
Add support of CRS:1 and CRS:88 (NAVD88).

Added:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java   (with props)
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/CommonAuthorityFactoryTest.java   (with props)
Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.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/factory/ConcurrentAuthorityFactory.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java?rev=1719083&r1=1719082&r2=1719083&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java [UTF-8] Thu Dec 10 14:03:41 2015
@@ -117,6 +117,8 @@ import static org.apache.sis.internal.ut
  * @since   0.4
  * @version 0.5
  * @module
+ *
+ * @see org.apache.sis.referencing.factory.CommonAuthorityFactory
  */
 @SuppressWarnings("DoubleCheckedLocking")
 public enum CommonCRS {
@@ -789,13 +791,15 @@ public enum CommonCRS {
      *
      * <blockquote><table class="sis">
      *   <caption>Geodetic objects accessible by enumeration constants</caption>
-     *   <tr><th>Name or alias</th>             <th>Object type</th> <th>Enumeration value</th></tr>
-     *   <tr><td>Barometric altitude</td>       <td>CRS, Datum</td>  <td>{@link #BAROMETRIC}</td></tr>
-     *   <!-- <s>Ellipsoidal height</s> intentionally omitted        <td><s>{@link #ELLIPSOIDAL}</s></td> -->
-     *   <tr><td>Mean Sea Level</td>            <td>Datum</td>       <td>{@link #MEAN_SEA_LEVEL}</td></tr>
-     *   <tr><td>Mean Sea Level depth</td>      <td>CRS</td>         <td>{@link #DEPTH}</td></tr>
-     *   <tr><td>Mean Sea Level height</td>     <td>CRS</td>         <td>{@link #MEAN_SEA_LEVEL}</td></tr>
-     *   <tr><td>Other surface</td>             <td>CRS, Datum</td>  <td>{@link #OTHER_SURFACE}</td></tr>
+     *   <tr><th>Name or alias</th>                      <th>Object type</th> <th>Enumeration value</th></tr>
+     *   <tr><td>Barometric altitude</td>                <td>CRS, Datum</td>  <td>{@link #BAROMETRIC}</td></tr>
+     *   <!-- <s>Ellipsoidal height</s> intentionally omitted                 <td><s>{@link #ELLIPSOIDAL}</s></td> -->
+     *   <tr><td>Mean Sea Level</td>                     <td>Datum</td>       <td>{@link #MEAN_SEA_LEVEL}</td></tr>
+     *   <tr><td>Mean Sea Level depth</td>               <td>CRS</td>         <td>{@link #DEPTH}</td></tr>
+     *   <tr><td>Mean Sea Level height</td>              <td>CRS</td>         <td>{@link #MEAN_SEA_LEVEL}</td></tr>
+     *   <tr><td>NAVD88 height</td>                      <td>CRS</td>         <td>{@link #NAVD88}</td></tr>
+     *   <tr><td>North American Vertical Datum 1988</td> <td>Datum</td>       <td>{@link #NAVD88}</td></tr>
+     *   <tr><td>Other surface</td>                      <td>CRS, Datum</td>  <td>{@link #OTHER_SURFACE}</td></tr>
      * </table></blockquote>
      *
      * <div class="note"><b>Note:</b>
@@ -805,8 +809,10 @@ public enum CommonCRS {
      *
      * @author  Martin Desruisseaux (Geomatys)
      * @since   0.4
-     * @version 0.4
+     * @version 0.7
      * @module
+     *
+     * @see org.apache.sis.referencing.factory.CommonAuthorityFactory
      */
     public static enum Vertical {
         /**
@@ -850,6 +856,24 @@ public enum CommonCRS {
         DEPTH(true, (short) 5715, (short) 5100),
 
         /**
+         * North American Vertical Datum 1988 height.
+         *
+         * <blockquote><table class="compact" summary="Mean Sea Level properties.">
+         *   <tr><th>WMS identifier:</th>           <td>CRS:88</td></tr>
+         *   <tr><th>EPSG identifiers:</th>         <td>5703 &nbsp;(<i>datum:</i> 5103)</td></tr>
+         *   <tr><th>Primary names:</th>            <td>"NAVD88 height" &nbsp;(<i>datum:</i> "North American Vertical Datum 1988")</td></tr>
+         *   <tr><th>Abbreviations or aliases:</th> <td>" North American Vertical Datum of 1988 height (m)" &nbsp;(<i>datum:</i> "NAVD88")</td></tr>
+         *   <tr><th>Direction:</th>                <td>{@link AxisDirection#UP}</td></tr>
+         *   <tr><th>Unit:</th>                     <td>{@link SI#METRE}</td></tr>
+         * </table></blockquote>
+         *
+         * @see CommonCRS#NAD83
+         *
+         * @since 0.7
+         */
+        NAVD88(true, (short) 5703, (short) 5103),
+
+        /**
          * Height measured along the normal to the ellipsoid used in the definition of horizontal datum.
          * The unit of measurement is metres.
          *

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=1719083&r1=1719082&r2=1719083&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 Dec 10 14:03:41 2015
@@ -63,7 +63,7 @@ import static org.apache.sis.internal.me
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.7
  * @module
  */
 final class StandardDefinitions {
@@ -99,6 +99,17 @@ final class StandardDefinitions {
     }
 
     /**
+     * Adds to the given properties an additional identifier in the {@code "CRS"} namespace.
+     * This method presume that the only identifier that existed before this method call was the EPSG one.
+     */
+    private static void addWMS(final Map<String,Object> properties, final String code) {
+        properties.put(IDENTIFIERS_KEY, new NamedIdentifier[] {
+            (NamedIdentifier) properties.get(IDENTIFIERS_KEY),
+            new NamedIdentifier(Citations.OGC, code)
+        });
+    }
+
+    /**
      * Creates a geodetic CRS from hard-coded values for the given code.
      *
      * @param  code  The EPSG code.
@@ -197,15 +208,32 @@ final class StandardDefinitions {
      * @return The vertical CRS for the given code.
      */
     static VerticalCRS createVerticalCRS(final short code, final VerticalDatum datum) {
-        final String name, alias, cs;
-        final short c, axis;
+        String cs   = "Vertical CS. Axis: height (H).";   // Default coordinate system
+        short  c    = 6499;                               // EPSG code of above coordinate system.
+        short  axis = 114;                                // Axis of above coordinate system.
+        String wms  = null;
+        final  String name, alias;
         switch (code) {
-            case 5714: name = "MSL height"; alias = "mean sea level height"; cs = "Vertical CS. Axis: height (H)."; c = 6499; axis = 114; break;
-            case 5715: name = "MSL depth";  alias = "mean sea level depth";  cs = "Vertical CS. Axis: depth (D).";  c = 6498; axis = 113; break;
+            case 5703: wms   = "88";
+                       name  = "NAVD88 height";
+                       alias = "North American Vertical Datum of 1988 height (m)";
+                       break;
+            case 5714: name  = "MSL height";
+                       alias = "mean sea level height";
+                       break;
+            case 5715: name  = "MSL depth";
+                       alias = "mean sea level depth";
+                       cs    = "Vertical CS. Axis: depth (D).";
+                       c     = 6498;
+                       axis  = 113;
+                       break;
             default:   throw new AssertionError(code);
         }
-        return new DefaultVerticalCRS(properties(code, name, alias, true), datum,
-                new DefaultVerticalCS(properties(c, cs, null, false), createAxis(axis)));
+        final Map<String,Object> properties = properties(code, name, alias, true);
+        if (wms != null) {
+            addWMS(properties, wms);
+        }
+        return new DefaultVerticalCRS(properties, datum, new DefaultVerticalCS(properties(c, cs, null, false), createAxis(axis)));
     }
 
     /**
@@ -218,7 +246,8 @@ final class StandardDefinitions {
         final String name;
         final String alias;
         switch (code) {
-            case 5100: name = "Mean Sea Level"; alias = "MSL"; break;
+            case 5100: name = "Mean Sea Level";                     alias = "MSL";    break;
+            case 5103: name = "North American Vertical Datum 1988"; alias = "NAVD88"; break;
             default:   throw new AssertionError(code);
         }
         return new DefaultVerticalDatum(properties(code, name, alias, true), VerticalDatumType.GEOIDAL);

Added: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java?rev=1719083&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java (added)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java [UTF-8] Thu Dec 10 14:03:41 2015
@@ -0,0 +1,220 @@
+/*
+ * 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.factory;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.Collections;
+import java.util.Arrays;
+import java.util.Locale;
+import javax.measure.unit.NonSI;
+import org.opengis.util.NameFactory;
+import org.opengis.util.FactoryException;
+import org.opengis.metadata.citation.Citation;
+import org.opengis.referencing.IdentifiedObject;
+import org.opengis.referencing.NoSuchAuthorityCodeException;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.opengis.referencing.crs.CRSAuthorityFactory;
+import org.opengis.referencing.cs.AxisDirection;
+import org.opengis.referencing.cs.CoordinateSystemAxis;
+import org.apache.sis.metadata.iso.citation.Citations;
+import org.apache.sis.metadata.iso.citation.DefaultCitation;
+import org.apache.sis.internal.simple.SimpleIdentifier;
+import org.apache.sis.referencing.CommonCRS;
+import org.apache.sis.referencing.datum.DefaultEngineeringDatum;
+import org.apache.sis.referencing.crs.DefaultEngineeringCRS;
+import org.apache.sis.referencing.cs.DefaultCartesianCS;
+import org.apache.sis.referencing.cs.DefaultCoordinateSystemAxis;
+
+
+/**
+ * The factory for coordinate reference systems in the "{@code OGC}" or "{@code CRS}" namespace.
+ * All namespaces recognized by this factory are defined by the Open Geospatial Consortium (OGC).
+ * Most codes map to one of the constants in the {@link CommonCRS} enumeration.
+ *
+ * <table class="sis">
+ *   <caption>Codes recognized by <code>CommonAuthorityFactory</code></caption>
+ *   <tr><th>Code</th> <th>Name</th>             <th>Datum type</th>  <th>CS type</th>     <th>Axis direction</th></tr>
+ *   <tr><td>   1</td> <td>Computer display</td> <td>Engineering</td> <td>Cartesian</td>   <td>East, South</td></tr>
+ *   <tr><td>  27</td> <td>NAD27</td>            <td>Geodetic</td>    <td>Ellipsoidal</td> <td>East, South</td></tr>
+ *   <tr><td>  83</td> <td>NAD83</td>            <td>Geodetic</td>    <td>Ellipsoidal</td> <td>East, South</td></tr>
+ *   <tr><td>  84</td> <td>WGS84</td>            <td>Geodetic</td>    <td>Ellipsoidal</td> <td>East, South</td></tr>
+ *   <tr><td>  88</td> <td>NAVD88</td>           <td>Vertical</td>    <td>Vertical</td>    <td>Up</td></tr>
+ * </table>
+ *
+ * <div class="section">Note on codes in CRS namespace</div>
+ * The format is usually <code>"CRS:</code><var>n</var><code>"</code> where <var>n</var> is a number like 27, 83 or 84.
+ * However this factory is lenient and allows the {@code CRS} part to be repeated as in {@code "CRS:CRS84"}.
+ * It also accepts {@code "OGC"} as a synonymous of the {@code "CRS"} namespace.
+ *
+ * <div class="note"><b>Examples:</b>
+ * {@code "CRS:27"}, {@code "CRS:83"}, {@code "CRS:84"}, {@code "CRS:CRS84"}, {@code "OGC:CRS84"}.</div>
+ *
+ * @author  Martin Desruisseaux (IRD, Geomatys)
+ * @since   0.7
+ * @version 0.7
+ * @module
+ *
+ * @see CommonCRS
+ * @see Citations#OGC
+ */
+public class CommonAuthorityFactory extends GeodeticAuthorityFactory implements CRSAuthorityFactory {
+    /**
+     * An optional prefix put in front of code. For example a code may be {@code "CRS84"} instead of a plain {@code "84"}.
+     * This is useful in order to understand URN syntax like {@code "urn:ogc:def:crs:OGC:1.3:CRS84"}.
+     * Must be uppercase for this implementation, but parsing will be case-insensitive.
+     */
+    private static final String PREFIX = "CRS";
+
+    /**
+     * Authority codes known to this factory, in the order they are declared in the WMS 1.3 specification.
+     */
+    private static final String[] CODES = {"1", "84", "83", "27", "88"};
+
+    /**
+     * The set of codes known to this factory. Created when first needed.
+     */
+    private Set<String> codes;
+
+    /**
+     * The authority for this factory.
+     */
+    private final Citation authority;
+
+    /**
+     * The "Computer display" reference system (CRS:1). Created when first needed.
+     *
+     * @see #displayCRS()
+     */
+    private CoordinateReferenceSystem displayCRS;
+
+    /**
+     * Constructs a default factory for the {@code CRS} authority.
+     *
+     * @param nameFactory The factory to use for parsing authority code as {@link org.opengis.util.GenericName} instances.
+     */
+    public CommonAuthorityFactory(final NameFactory nameFactory) {
+        super(nameFactory);
+        final DefaultCitation c = new DefaultCitation(Citations.OGC);
+        c.setIdentifiers(Arrays.asList(
+                new SimpleIdentifier(null, "OGC", false),
+                new SimpleIdentifier(null, "CRS", false)
+        ));
+        c.freeze();
+        authority = c;
+    }
+
+    /**
+     * Returns the organization responsible for definition of the CRS codes recognized by this factory.
+     * The authority for this factory is the <cite>Open Geospatial Consortium</cite>.
+     *
+     * @return The OGC authority.
+     */
+    @Override
+    public Citation getAuthority() {
+        return authority;
+    }
+
+    /**
+     * Provides a complete set of the known codes provided by this authority.
+     * The returned set contains only numeric identifiers like {@code "84"}, {@code "27"}, <i>etc</i>.
+     * The authority name ({@code "CRS"}) is not included in the character strings.
+     */
+    @Override
+    @SuppressWarnings("ReturnOfCollectionOrArrayField")     // Because the returned set is unmodifiable.
+    public synchronized Set<String> getAuthorityCodes(final Class<? extends IdentifiedObject> type) {
+        if (codes == null) {
+            codes = Collections.unmodifiableSet(new LinkedHashSet<>(Arrays.asList(CODES)));
+        }
+        return codes;
+    }
+
+    /**
+     * Creates an object from the specified code.
+     * The default implementation delegates to {@link #createCoordinateReferenceSystem(String)}.
+     *
+     * @throws FactoryException if the object creation failed.
+     */
+    @Override
+    public IdentifiedObject createObject(final String code) throws FactoryException {
+        return createCoordinateReferenceSystem(code);
+    }
+
+    /**
+     * Creates a coordinate reference system from the specified code.
+     *
+     * @throws FactoryException if the object creation failed.
+     */
+    @Override
+    public CoordinateReferenceSystem createCoordinateReferenceSystem(final String code) throws FactoryException {
+        String c = trimAuthority(code).toUpperCase(Locale.US);
+        if (c.startsWith(PREFIX)) {
+            /*
+             * "trimAuthority" removed "CRS" when it was separated from the code, as in "CRS:84".
+             * This block removes "CRS" when it is concatenated with the code, as in "CRS84".
+             */
+            c = c.substring(PREFIX.length());
+        }
+        final int n;
+        try {
+            n = Integer.parseInt(c);
+        } catch (NumberFormatException exception) {
+            // If a number can not be parsed, then this is an invalid authority code.
+            NoSuchAuthorityCodeException e = noSuchAuthorityCode(CoordinateReferenceSystem.class, code);
+            e.initCause(exception);
+            throw e;
+        }
+        final CommonCRS crs;
+        switch (n) {
+            case  1: return displayCRS();
+            case 84: crs = CommonCRS.WGS84; break;
+            case 83: crs = CommonCRS.NAD83; break;
+            case 27: crs = CommonCRS.NAD27; break;
+            case 88: return CommonCRS.Vertical.NAVD88.crs();
+            default: throw noSuchAuthorityCode(CoordinateReferenceSystem.class, code);
+        }
+        return crs.normalizedGeographic();
+    }
+
+    /**
+     * Returns the "Computer display" reference system (CRS:1). This is rarely used.
+     */
+    private synchronized CoordinateReferenceSystem displayCRS() {
+        if (displayCRS == null) {
+            final DefaultCartesianCS cs = new DefaultCartesianCS(
+                    Collections.singletonMap(DefaultCartesianCS.NAME_KEY, "Computer display"),
+                    createDisplayAxis("i", AxisDirection.EAST),
+                    createDisplayAxis("j", AxisDirection.SOUTH));
+
+            final Map<String,Object> properties = new HashMap<>(4);
+            properties.put(DefaultEngineeringDatum.NAME_KEY, cs.getName());
+            properties.put(DefaultEngineeringDatum.ANCHOR_POINT_KEY, "Origin is in upper left.");
+            displayCRS = new DefaultEngineeringCRS(properties, new DefaultEngineeringDatum(properties), cs);
+        }
+        return displayCRS;
+    }
+
+    /**
+     * Creates a coordinate axis for "Computer display" (CRS:1).
+     */
+    private static CoordinateSystemAxis createDisplayAxis(final String abbreviation, final AxisDirection direction) {
+        return new DefaultCoordinateSystemAxis(Collections.singletonMap(DefaultCoordinateSystemAxis.NAME_KEY, abbreviation),
+                abbreviation, direction, NonSI.PIXEL);
+    }
+}

Propchange: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java?rev=1719083&r1=1719082&r2=1719083&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java [UTF-8] Thu Dec 10 14:03:41 2015
@@ -221,7 +221,7 @@ public abstract class ConcurrentAuthorit
      * by strong references. Note that those default values may change in any future SIS versions based
      * on experience gained.
      *
-     * @param nameFactory The factory to use for parsing authority code as {@link GenericName} instances.
+     * @param nameFactory The factory to use for parsing authority code as {@link org.opengis.util.GenericName} instances.
      */
     protected ConcurrentAuthorityFactory(final NameFactory nameFactory) {
         this(nameFactory, 100, 8);
@@ -236,7 +236,7 @@ public abstract class ConcurrentAuthorit
      * If a number of object greater than {@code maxStrongReferences} are created, then the strong references
      * for the eldest ones will be replaced by weak references.
      *
-     * @param nameFactory The factory to use for parsing authority code as {@link GenericName} instances.
+     * @param nameFactory The factory to use for parsing authority code as {@link org.opengis.util.GenericName} instances.
      * @param maxStrongReferences The maximum number of objects to keep by strong reference.
      * @param maxConcurrentQueries The maximal amount of backing stores to use concurrently.
      *        If more than this amount of threads are querying this {@code ConcurrentAuthorityFactory} concurrently,

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java?rev=1719083&r1=1719082&r2=1719083&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java [UTF-8] Thu Dec 10 14:03:41 2015
@@ -31,8 +31,10 @@ import org.opengis.util.ScopedName;
 import org.opengis.util.GenericName;
 import org.opengis.util.NameFactory;
 import org.opengis.util.FactoryException;
+import org.opengis.util.InternationalString;
 import org.apache.sis.internal.util.Citations;
 import org.apache.sis.referencing.AbstractIdentifiedObject;
+import org.apache.sis.util.iso.SimpleInternationalString;
 import org.apache.sis.util.iso.AbstractFactory;
 import org.apache.sis.util.resources.Vocabulary;
 import org.apache.sis.util.resources.Errors;
@@ -90,15 +92,15 @@ public abstract class GeodeticAuthorityF
      *
      * {@preformat text
      *   Citation
-     *    ├─ Title ……………………………………………………… EPSG Geodetic Parameter Dataset
-     *    ├─ Identifier ………………………………………… EPSG
-     *    ├─ Online resource (1 of 2)
-     *    │   ├─ Linkage ……………………………………… http://epsg-registry.org/
-     *    │   └─ Function …………………………………… Browse
-     *    └─ Online resource (2 of 2)
-     *        ├─ Linkage ……………………………………… jdbc:derby:/my/path/to/SIS_DATA/Metadata
-     *        ├─ Description …………………………… EPSG dataset version 8.8 on “Apache Derby Embedded JDBC Driver” version 10.12.
-     *        └─ Function …………………………………… Connection
+     *   ├─ Title ……………………………………………………… EPSG Geodetic Parameter Dataset
+     *   ├─ Identifier ………………………………………… EPSG
+     *   ├─ Online resource (1 of 2)
+     *   │  ├─ Linkage ………………………………………… http://epsg-registry.org/
+     *   │  └─ Function ……………………………………… Browse
+     *   └─ Online resource (2 of 2)
+     *      ├─ Linkage ………………………………………… jdbc:derby:/my/path/to/SIS_DATA/Metadata
+     *      ├─ Description ……………………………… EPSG dataset version 8.8 on “Apache Derby Embedded JDBC Driver” version 10.12.
+     *      └─ Function ……………………………………… Connection
      * }
      *
      * The online resource description with a “Connection” function is a SIS extension.</div>
@@ -111,6 +113,22 @@ public abstract class GeodeticAuthorityF
     public abstract Citation getAuthority();
 
     /**
+     * Returns a description of the object corresponding to a code.
+     *
+     * <div class="section">Default implementation</div>
+     * The default implementation invokes {@link #createObject(String)} for the given code
+     * and returns the object {@linkplain AbstractIdentifiedObject#getName() name}.
+     * This may be costly since it involves a full object creation.
+     * Subclasses are encouraged to provide a more efficient implementation if they can.
+     *
+     * @throws FactoryException if an error occurred while fetching the description.
+     */
+    @Override
+    public InternationalString getDescriptionText(final String code) throws FactoryException {
+        return new SimpleInternationalString(createObject(code).getName().getCode());
+    }
+
+    /**
      * Returns an arbitrary object from a code. The returned object will typically be an instance of {@link Datum},
      * {@link CoordinateSystem}, {@link CoordinateReferenceSystem} or {@link CoordinateOperation}.
      *
@@ -118,8 +136,9 @@ public abstract class GeodeticAuthorityF
      * ultimately delegate to this {@code createObject(String)} method. However subclasses are encouraged
      * to override more specific methods for efficiency.</p>
      *
-     * <p>The default implementation always throw an exception. Subclasses should override this method
-     * if they are capable to automatically detect the object type from its code.</p>
+     * <div class="section">Default implementation</div>
+     * The default implementation always throw an exception. Subclasses should override this method
+     * if they are capable to automatically detect the object type from its code.
      *
      * @param  code Value allocated by authority.
      * @return The object for the given code.
@@ -144,8 +163,9 @@ public abstract class GeodeticAuthorityF
      * <code>createCoordinateReferenceSystem(code)</code> if the caller know he is asking for a
      * {@linkplain org.apache.sis.referencing.crs.DefaultGeographicCRS geographic coordinate reference system}).
      *
-     * <p>The default implementation delegates to {@link #createObject(String)} and casts the result.
-     * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.</p>
+     * <div class="section">Default implementation</div>
+     * The default implementation delegates to {@link #createObject(String)} and casts the result.
+     * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
      * @param  code Value allocated by authority.
      * @return The coordinate reference system for the given code.
@@ -165,6 +185,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates a geographic coordinate reference system from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createCoordinateReferenceSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -183,6 +205,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates a geocentric coordinate reference system from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createCoordinateReferenceSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -202,6 +226,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates a projected coordinate reference system from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createCoordinateReferenceSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -220,6 +246,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates a vertical coordinate reference system from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createCoordinateReferenceSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -238,6 +266,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates a temporal coordinate reference system from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createCoordinateReferenceSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -256,6 +286,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates a 3D or 4D coordinate reference system from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createCoordinateReferenceSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -274,6 +306,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates a derived coordinate reference system from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createCoordinateReferenceSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -290,6 +324,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates an engineering coordinate reference system from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createCoordinateReferenceSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -307,6 +343,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates an image coordinate reference system from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createCoordinateReferenceSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -324,6 +362,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Returns an arbitrary datum from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createObject(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -342,6 +382,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates a geodetic datum from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createDatum(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -362,6 +404,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates a vertical datum from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createDatum(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -379,6 +423,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates a temporal datum from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createDatum(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -396,6 +442,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates a engineering datum from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createDatum(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -413,6 +461,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates a image datum from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createDatum(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -430,6 +480,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates an ellipsoid from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createObject(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -448,6 +500,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates a prime meridian from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createObject(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -465,6 +519,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates an extent (usually an domain of validity) from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createObject(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -483,6 +539,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates an arbitrary coordinate system from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createObject(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -501,6 +559,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates an ellipsoidal coordinate system from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createCoordinateSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -520,6 +580,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates a vertical coordinate system from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createCoordinateSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -538,6 +600,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates a temporal coordinate system from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createCoordinateSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -556,6 +620,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates a Cartesian coordinate system from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createCoordinateSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -574,6 +640,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates a spherical coordinate system from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createCoordinateSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -591,6 +659,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates a cylindrical coordinate system from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createCoordinateSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -607,6 +677,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates a polar coordinate system from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createCoordinateSystem(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -623,6 +695,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates a coordinate system axis from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createObject(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -642,6 +716,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates an unit of measurement from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createObject(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -656,6 +732,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates a parameter descriptor from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createObject(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -674,6 +752,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates an operation method from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createObject(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -690,6 +770,8 @@ public abstract class GeodeticAuthorityF
 
     /**
      * Creates an operation from a code.
+     *
+     * <div class="section">Default implementation</div>
      * The default implementation delegates to {@link #createObject(String)} and casts the result.
      * If the result can not be casted, then a {@link NoSuchAuthorityCodeException} is thrown.
      *
@@ -711,7 +793,8 @@ public abstract class GeodeticAuthorityF
      * This method should only extract the information explicitely declared in a database like EPSG.
      * This method should not attempt to infer by itself operations that are not explicitely recorded in the database.
      *
-     * <p>The default implementation returns an empty set.</p>
+     * <div class="section">Default implementation</div>
+     * The default implementation returns an empty set.
      *
      * @param  sourceCRS  Coded value of source coordinate reference system.
      * @param  targetCRS  Coded value of target coordinate reference system.
@@ -760,7 +843,7 @@ public abstract class GeodeticAuthorityF
          * If implementation below is modified, it is probably worth to revisit the overridden method as well.
          */
         code = code.trim();
-        final GenericName name  = nameFactory.parseGenericName(null, code);
+        final GenericName name = nameFactory.parseGenericName(null, code);
         if (name instanceof ScopedName) {
             final GenericName scope = ((ScopedName) name).path();
             if (Citations.identifierMatches(getAuthority(), null, scope.toString())) {

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java?rev=1719083&r1=1719082&r2=1719083&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java [UTF-8] Thu Dec 10 14:03:41 2015
@@ -143,11 +143,12 @@ public final strictfp class CommonCRSTes
             final VerticalDatumType datumType;
             final String axisName, datumName;
             switch (e) {
-                case BAROMETRIC:     axisName = "Barometric altitude";            datumName = "Constant pressure surface"; datumType = VerticalDatumType. BAROMETRIC;    break;
-                case MEAN_SEA_LEVEL: axisName = AxisNames.GRAVITY_RELATED_HEIGHT; datumName = "Mean Sea Level";            datumType = VerticalDatumType. GEOIDAL;       break;
-                case DEPTH:          axisName = AxisNames.DEPTH;                  datumName = "Mean Sea Level";            datumType = VerticalDatumType. GEOIDAL;       break;
-                case ELLIPSOIDAL:    axisName = AxisNames.ELLIPSOIDAL_HEIGHT;     datumName = "Ellipsoid";                 datumType = VerticalDatumTypes.ELLIPSOIDAL;   break;
-                case OTHER_SURFACE:  axisName = "Height";                         datumName = "Other surface";             datumType = VerticalDatumType. OTHER_SURFACE; break;
+                case NAVD88:         axisName = AxisNames.GRAVITY_RELATED_HEIGHT; datumName = "North American Vertical Datum 1988"; datumType = VerticalDatumType. GEOIDAL;       break;
+                case BAROMETRIC:     axisName = "Barometric altitude";            datumName = "Constant pressure surface";          datumType = VerticalDatumType. BAROMETRIC;    break;
+                case MEAN_SEA_LEVEL: axisName = AxisNames.GRAVITY_RELATED_HEIGHT; datumName = "Mean Sea Level";                     datumType = VerticalDatumType. GEOIDAL;       break;
+                case DEPTH:          axisName = AxisNames.DEPTH;                  datumName = "Mean Sea Level";                     datumType = VerticalDatumType. GEOIDAL;       break;
+                case ELLIPSOIDAL:    axisName = AxisNames.ELLIPSOIDAL_HEIGHT;     datumName = "Ellipsoid";                          datumType = VerticalDatumTypes.ELLIPSOIDAL;   break;
+                case OTHER_SURFACE:  axisName = "Height";                         datumName = "Other surface";                      datumType = VerticalDatumType. OTHER_SURFACE; break;
                 default: throw new AssertionError(e);
             }
             final String        name  = e.name();

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java?rev=1719083&r1=1719082&r2=1719083&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/StandardDefinitionsTest.java [UTF-8] Thu Dec 10 14:03:41 2015
@@ -17,11 +17,14 @@
 package org.apache.sis.referencing;
 
 import org.opengis.referencing.crs.GeographicCRS;
+import org.opengis.referencing.crs.VerticalCRS;
+import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
 import org.opengis.referencing.cs.EllipsoidalCS;
 import org.opengis.referencing.datum.Ellipsoid;
 import org.opengis.referencing.datum.PrimeMeridian;
 import org.opengis.referencing.datum.GeodeticDatum;
+import org.opengis.referencing.datum.VerticalDatum;
 import org.apache.sis.test.mock.GeodeticDatumMock;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
@@ -30,6 +33,7 @@ import org.opengis.test.Validators;
 import org.apache.sis.referencing.crs.HardCodedCRS;
 import org.apache.sis.referencing.cs.HardCodedAxes;
 import org.apache.sis.referencing.datum.HardCodedDatum;
+import org.apache.sis.metadata.iso.citation.Citations;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
@@ -40,7 +44,7 @@ import static org.junit.Assert.*;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.7
  * @module
  */
 @DependsOn({
@@ -64,7 +68,7 @@ public final strictfp class StandardDefi
      */
     @Test
     @DependsOnMethod("testCreateAxis")
-    public void testCreateGographicCRS() {
+    public void testCreateGeographicCRS() {
         final PrimeMeridian pm = StandardDefinitions.primeMeridian();
         final EllipsoidalCS cs = (EllipsoidalCS) StandardDefinitions.createCoordinateSystem((short) 6422);
         for (final CommonCRS e : CommonCRS.values()) {
@@ -149,4 +153,37 @@ public final strictfp class StandardDefi
         assertEquals("maximumValue", expected.getMaximumValue(),   actual.getMaximumValue(), STRICT);
         assertEquals("rangeMeaning", expected.getRangeMeaning(),   actual.getRangeMeaning());
     }
+
+    /**
+     * Tests the creation of vertical CRS.
+     *
+     * @since 0.7
+     */
+    @Test
+    @DependsOnMethod("testCreateAxis")
+    public void testCreateVerticalCRS() {
+        VerticalDatum datum;
+        VerticalCRS crs;
+
+        datum = StandardDefinitions.createVerticalDatum(CommonCRS.Vertical.NAVD88.datum);
+        crs = StandardDefinitions.createVerticalCRS(CommonCRS.Vertical.NAVD88.crs, datum);
+        assertEquals("name", "NAVD88 height", crs.getName().getCode());
+        assertEquals("identifier", "5703", IdentifiedObjects.getIdentifier(crs, Citations.EPSG).getCode());
+        assertEquals("identifier",   "88", IdentifiedObjects.getIdentifier(crs, Citations.OGC ).getCode());
+        assertEquals("direction", AxisDirection.UP, crs.getCoordinateSystem().getAxis(0).getDirection());
+
+        datum = StandardDefinitions.createVerticalDatum(CommonCRS.Vertical.MEAN_SEA_LEVEL.datum);
+        crs = StandardDefinitions.createVerticalCRS(CommonCRS.Vertical.MEAN_SEA_LEVEL.crs, datum);
+        assertEquals("name", "MSL height", crs.getName().getCode());
+        assertEquals("identifier", "5714", IdentifiedObjects.getIdentifier(crs, Citations.EPSG).getCode());
+        assertNull  ("identifier", IdentifiedObjects.getIdentifier(crs, Citations.OGC));
+        assertEquals("direction", AxisDirection.UP, crs.getCoordinateSystem().getAxis(0).getDirection());
+
+        datum = StandardDefinitions.createVerticalDatum(CommonCRS.Vertical.DEPTH.datum);
+        crs = StandardDefinitions.createVerticalCRS(CommonCRS.Vertical.DEPTH.crs, datum);
+        assertEquals("name", "MSL depth", crs.getName().getCode());
+        assertEquals("identifier", "5715", IdentifiedObjects.getIdentifier(crs, Citations.EPSG).getCode());
+        assertNull  ("identifier", IdentifiedObjects.getIdentifier(crs, Citations.OGC));
+        assertEquals("direction", AxisDirection.DOWN, crs.getCoordinateSystem().getAxis(0).getDirection());
+    }
 }

Added: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/CommonAuthorityFactoryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/CommonAuthorityFactoryTest.java?rev=1719083&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/CommonAuthorityFactoryTest.java (added)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/CommonAuthorityFactoryTest.java [UTF-8] Thu Dec 10 14:03:41 2015
@@ -0,0 +1,138 @@
+/*
+ * 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.factory;
+
+import org.opengis.util.NameFactory;
+import org.opengis.util.FactoryException;
+import org.opengis.metadata.citation.Citation;
+import org.opengis.referencing.crs.GeographicCRS;
+import org.apache.sis.internal.system.DefaultFactories;
+import org.apache.sis.metadata.iso.citation.Citations;
+import org.apache.sis.referencing.CommonCRS;
+import org.apache.sis.io.wkt.Convention;
+
+// Test imports
+import org.apache.sis.test.DependsOnMethod;
+import org.apache.sis.test.TestCase;
+import org.junit.Test;
+
+import static org.apache.sis.test.MetadataAssert.*;
+
+
+/**
+ * Tests {@link CommonAuthorityFactory}.
+ *
+ * @author  Martin Desruisseaux (IRD, Geomatys)
+ * @since   0.7
+ * @version 0.7
+ * @module
+ */
+public final strictfp class CommonAuthorityFactoryTest extends TestCase {
+    /**
+     * The factory to test.
+     */
+    private final CommonAuthorityFactory factory;
+
+    /**
+     * Initializes the factory to test.
+     */
+    public CommonAuthorityFactoryTest() {
+        factory = new CommonAuthorityFactory(DefaultFactories.forBuildin(NameFactory.class));
+    }
+
+    /**
+     * Checks the authority names.
+     */
+    @Test
+    public void testAuthority() {
+        final Citation authority = factory.getAuthority();
+        assertTrue (Citations.identifierMatches(authority, "CRS"));
+        assertTrue (Citations.identifierMatches(authority, "OGC"));
+        assertFalse(Citations.identifierMatches(authority, "OGP"));
+        assertFalse(Citations.identifierMatches(authority, "EPSG"));
+        assertFalse(Citations.identifierMatches(authority, "AUTO"));
+        assertFalse(Citations.identifierMatches(authority, "AUTO2"));
+    }
+
+    /**
+     * Tests the CRS:84 code.
+     *
+     * @throws FactoryException Should never happen.
+     */
+    @Test
+    @DependsOnMethod("testAuthority")
+    public void testCRS84() throws FactoryException {
+        GeographicCRS crs = factory.createGeographicCRS("CRS:84");
+        assertSame   (crs,  factory.createGeographicCRS("84"));
+        assertSame   (crs,  factory.createGeographicCRS("CRS84"));
+        assertSame   (crs,  factory.createGeographicCRS("CRS:CRS84"));
+        assertSame   (crs,  factory.createGeographicCRS("crs : crs84"));
+        assertSame   (crs,  factory.createGeographicCRS("OGC:84"));         // Not in real use as far as I know.
+        assertSame   (crs,  factory.createGeographicCRS("OGC:CRS84"));
+        assertNotSame(crs,  factory.createGeographicCRS("CRS:83"));
+    }
+
+    /**
+     * Tests the CRS:83 code.
+     *
+     * @throws FactoryException Should never happen.
+     */
+    @Test
+    @DependsOnMethod("testAuthority")
+    public void testCRS83() throws FactoryException {
+        GeographicCRS crs = factory.createGeographicCRS("CRS:83");
+        assertSame   (crs,  factory.createGeographicCRS("83"));
+        assertSame   (crs,  factory.createGeographicCRS("CRS83"));
+        assertSame   (crs,  factory.createGeographicCRS("CRS:CRS83"));
+        assertNotSame(crs,  factory.createGeographicCRS("CRS:84"));
+        assertNotDeepEquals(CommonCRS.WGS84.normalizedGeographic(), crs);
+    }
+
+    /**
+     * Tests the WKT formatting. The main purpose of this test is to ensure that
+     * the authority name is "CRS" and not "Web Map Service CRS".
+     *
+     * @throws FactoryException Should never happen.
+     */
+    @Test
+    @DependsOnMethod("testCRS84")
+    public void testWKT() throws FactoryException {
+        GeographicCRS crs = factory.createGeographicCRS("CRS:84");
+        assertWktEquals(Convention.WKT1,
+                "GEOGCS[“WGS 84”,\n" +
+                "  DATUM[“World Geodetic System 1984”,\n" +
+                "    SPHEROID[“WGS 84”, 6378137.0, 298.257223563]],\n" +
+                "    PRIMEM[“Greenwich”, 0.0],\n" +
+                "  UNIT[“degree”, 0.017453292519943295],\n" +
+                "  AXIS[“Longitude”, EAST],\n" +
+                "  AXIS[“Latitude”, NORTH],\n" +
+                "  AUTHORITY[“CRS”, “84”]]", crs);
+
+        assertWktEquals(Convention.WKT2,
+                "GEODCRS[“WGS 84”,\n" +
+                "  DATUM[“World Geodetic System 1984”,\n" +
+                "    ELLIPSOID[“WGS 84”, 6378137.0, 298.257223563, LENGTHUNIT[“metre”, 1]]],\n" +
+                "    PRIMEM[“Greenwich”, 0.0, ANGLEUNIT[“degree”, 0.017453292519943295]],\n" +
+                "  CS[ellipsoidal, 2],\n" +
+                "    AXIS[“Longitude (L)”, east, ORDER[1]],\n" +
+                "    AXIS[“Latitude (B)”, north, ORDER[2]],\n" +
+                "    ANGLEUNIT[“degree”, 0.017453292519943295],\n" +
+                "  AREA[“World”],\n" +
+                "  BBOX[-90.00, -180.00, 90.00, 180.00],\n" +
+                "  ID[“CRS”, 84, CITATION[“OGC”]]]", crs);
+    }
+}

Propchange: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/CommonAuthorityFactoryTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1719083&r1=1719082&r2=1719083&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Thu Dec 10 14:03:41 2015
@@ -170,6 +170,7 @@ import org.junit.BeforeClass;
     org.apache.sis.referencing.factory.GIGS3004.class,
     org.apache.sis.referencing.factory.GIGS3005.class,
     org.apache.sis.referencing.factory.GeodeticObjectFactoryTest.class,
+    org.apache.sis.referencing.factory.CommonAuthorityFactoryTest.class,
     org.apache.sis.referencing.StandardDefinitionsTest.class,
     org.apache.sis.referencing.CommonCRSTest.class,
     org.apache.sis.referencing.CRSTest.class,



Mime
View raw message