sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1679636 [2/5] - in /sis/trunk: ./ application/sis-console/src/main/java/org/apache/sis/console/ application/sis-console/src/test/java/org/apache/sis/console/ core/sis-feature/src/main/java/org/apache/sis/feature/ core/sis-metadata/src/main...
Date Fri, 15 May 2015 19:42:43 GMT
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java [UTF-8] Fri May 15 19:42:41 2015
@@ -20,18 +20,34 @@ import java.util.Map;
 import javax.xml.bind.annotation.XmlTransient;
 import org.opengis.parameter.GeneralParameterValue;
 import org.opengis.referencing.datum.Datum;
+import org.opengis.referencing.datum.GeodeticDatum;
+import org.opengis.referencing.datum.VerticalDatum;
+import org.opengis.referencing.datum.TemporalDatum;
+import org.opengis.referencing.datum.EngineeringDatum;
 import org.opengis.referencing.crs.SingleCRS;
 import org.opengis.referencing.crs.DerivedCRS;
+import org.opengis.referencing.crs.GeodeticCRS;
+import org.opengis.referencing.crs.VerticalCRS;
+import org.opengis.referencing.crs.TemporalCRS;
+import org.opengis.referencing.crs.ProjectedCRS;
+import org.opengis.referencing.crs.EngineeringCRS;
 import org.opengis.referencing.cs.CoordinateSystem;
+import org.opengis.referencing.cs.EllipsoidalCS;
+import org.opengis.referencing.cs.VerticalCS;
+import org.opengis.referencing.cs.TimeCS;
 import org.opengis.referencing.operation.Conversion;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.NoninvertibleTransformException;
 import org.opengis.geometry.MismatchedDimensionException;
+import org.apache.sis.referencing.AbstractIdentifiedObject;
 import org.apache.sis.referencing.operation.DefaultOperationMethod;
+import org.apache.sis.referencing.cs.AxesConvention;
 import org.apache.sis.internal.referencing.WKTUtilities;
+import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.io.wkt.FormattableObject;
 import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.util.ComparisonMode;
+import org.apache.sis.util.Classes;
 
 
 /**
@@ -41,6 +57,21 @@ import org.apache.sis.util.ComparisonMod
  * can not be {@linkplain DefaultProjectedCRS projected CRS} themselves, but may be derived from a projected CRS
  * (for example in order to use a {@linkplain org.apache.sis.referencing.cs.DefaultPolarCS polar coordinate system}).
  *
+ * <p>A {@code DerivedCRS} instance may also implement one of the interfaces listed below,
+ * provided that the conditions in the right column are meet (derived from ISO 19162):</p>
+ *
+ * <table class="sis">
+ *   <caption>Derived CRS types</caption>
+ *   <tr><th>Type</th>                   <th>Conditions</th></tr>
+ *   <tr><td>{@link GeodeticCRS}</td>    <td>Base CRS is also a {@code GeodeticCRS} and is associated to the same type of coordinate system.</td></tr>
+ *   <tr><td>{@link VerticalCRS}</td>    <td>Base CRS is also a {@code VerticalCRS} and coordinate system is a {@code VerticalCS}.</td></tr>
+ *   <tr><td>{@link TemporalCRS}</td>    <td>Base CRS is also a {@code TemporalCRS} and coordinate system is a {@code TimeCS}.</td></tr>
+ *   <tr><td>{@link EngineeringCRS}</td> <td>Base CRS is a {@code GeodeticCRS}, {@code ProjectedCRS} or {@code EngineeringCRS}.</td></tr>
+ * </table>
+ *
+ * Those specialized subclasses can be inferred automatically by the {@link #create create(…)} static method.
+ * Alternatively, users can create their own {@code DefaultDerivedCRS} subclass implementing the desired interface.
+ *
  * <div class="section">Immutability and thread safety</div>
  * This base class is immutable and thus thread-safe if the property <em>values</em> (not necessarily the map itself)
  * given to the constructor are also immutable. Most SIS subclasses and related classes are immutable under similar
@@ -113,21 +144,28 @@ public class DefaultDerivedCRS extends A
      *   </tr>
      * </table>
      *
+     * The supplied {@code conversion} argument shall <strong>not</strong> includes the operation steps
+     * for performing {@linkplain org.apache.sis.referencing.cs.CoordinateSystems#swapAndScaleAxes unit
+     * conversions and change of axis order} since those operations will be inferred by this constructor.
+     *
      * @param  properties The properties to be given to the new derived CRS object.
-     * @param  baseCRS Coordinate reference system to base the derived CRS on.
-     * @param  conversionFromBase The conversion from the base CRS to this derived CRS.
-     * @param  derivedCS The coordinate system for the derived CRS. The number of axes
+     * @param  baseCRS    Coordinate reference system to base the derived CRS on.
+     * @param  conversion The defining conversion from a {@linkplain AxesConvention#NORMALIZED normalized} base
+     *                    to a normalized derived CRS.
+     * @param  derivedCS  The coordinate system for the derived CRS. The number of axes
      *         must match the target dimension of the {@code baseToDerived} transform.
      * @throws MismatchedDimensionException if the source and target dimension of {@code baseToDerived}
      *         do not match the dimension of {@code base} and {@code derivedCS} respectively.
+     *
+     * @see #create(Map, SingleCRS, Conversion, CoordinateSystem)
      */
-    public DefaultDerivedCRS(final Map<String,?>    properties,
-                             final SingleCRS        baseCRS,
-                             final Conversion       conversionFromBase,
-                             final CoordinateSystem derivedCS)
+    protected DefaultDerivedCRS(final Map<String,?>    properties,
+                                final SingleCRS        baseCRS,
+                                final Conversion       conversion,
+                                final CoordinateSystem derivedCS)
             throws MismatchedDimensionException
     {
-        super(properties, Conversion.class, baseCRS, conversionFromBase, derivedCS);
+        super(properties, baseCRS, conversion, derivedCS);
     }
 
     /**
@@ -142,7 +180,42 @@ public class DefaultDerivedCRS extends A
      * @see #castOrCopy(DerivedCRS)
      */
     protected DefaultDerivedCRS(final DerivedCRS crs) {
-        super(crs, Conversion.class);
+        super(crs);
+    }
+
+    /**
+     * Creates a derived CRS from a defining conversion and a type inferred from the given arguments.
+     * This method expects the same arguments and performs the same work than the
+     * {@linkplain #DefaultDerivedCRS(Map, SingleCRS, Conversion, CoordinateSystem) above constructor},
+     * except that the {@code DerivedCRS} instance returned by this method may additionally implement
+     * the {@link GeodeticCRS}, {@link VerticalCRS}, {@link TemporalCRS} or {@link EngineeringCRS} interface.
+     * See the class javadoc for more information.
+     *
+     * @param  properties The properties to be given to the new derived CRS object.
+     * @param  baseCRS    Coordinate reference system to base the derived CRS on.
+     * @param  conversion The defining conversion from a normalized base to a normalized derived CRS.
+     * @param  derivedCS  The coordinate system for the derived CRS. The number of axes
+     *         must match the target dimension of the {@code baseToDerived} transform.
+     * @return The newly created derived CRS, potentially implementing an additional CRS interface.
+     * @throws MismatchedDimensionException if the source and target dimension of {@code baseToDerived}
+     *         do not match the dimension of {@code base} and {@code derivedCS} respectively.
+     *
+     * @see #DefaultDerivedCRS(Map, SingleCRS, Conversion, CoordinateSystem)
+     */
+    public static DefaultDerivedCRS create(final Map<String,?>    properties,
+                                           final SingleCRS        baseCRS,
+                                           final Conversion       conversion,
+                                           final CoordinateSystem derivedCS)
+            throws MismatchedDimensionException
+    {
+        if (baseCRS != null && derivedCS != null) {
+            final String type = getType(baseCRS, derivedCS);
+            if (WKTKeywords.GeodeticCRS   .equals(type)) return new Geodetic   (properties, (GeodeticCRS) baseCRS, conversion, (EllipsoidalCS) derivedCS);
+            if (WKTKeywords.VerticalCRS   .equals(type)) return new Vertical   (properties, (VerticalCRS) baseCRS, conversion,    (VerticalCS) derivedCS);
+            if (WKTKeywords.TimeCRS       .equals(type)) return new Temporal   (properties, (TemporalCRS) baseCRS, conversion,        (TimeCS) derivedCS);
+            if (WKTKeywords.EngineeringCRS.equals(type)) return new Engineering(properties,               baseCRS, conversion,                 derivedCS);
+        }
+        return new DefaultDerivedCRS(properties, baseCRS, conversion, derivedCS);
     }
 
     /**
@@ -156,8 +229,25 @@ public class DefaultDerivedCRS extends A
      *         given object itself), or {@code null} if the argument was null.
      */
     public static DefaultDerivedCRS castOrCopy(final DerivedCRS object) {
-        return (object == null) || (object instanceof DefaultDerivedCRS)
-                ? (DefaultDerivedCRS) object : new DefaultDerivedCRS(object);
+        if (object == null || object instanceof DefaultDerivedCRS) {
+            return (DefaultDerivedCRS) object;
+        } else {
+            final String type = getType((SingleCRS) object.getBaseCRS(), object.getCoordinateSystem());
+            if (WKTKeywords.GeodeticCRS   .equals(type)) return new Geodetic   (object);
+            if (WKTKeywords.VerticalCRS   .equals(type)) return new Vertical   (object);
+            if (WKTKeywords.TimeCRS       .equals(type)) return new Temporal   (object);
+            if (WKTKeywords.EngineeringCRS.equals(type)) return new Engineering(object);
+            return new DefaultDerivedCRS(object);
+        }
+    }
+
+    /**
+     * Returns the type of conversion associated to this {@code DefaultDerivedCRS}.
+     * Must be a hard-coded, constant value (not dependent on object state).
+     */
+    @Override
+    final Class<Conversion> getConversionType() {
+        return Conversion.class;
     }
 
     /**
@@ -221,6 +311,25 @@ public class DefaultDerivedCRS extends A
     }
 
     /**
+     * {@inheritDoc}
+     *
+     * @return {@inheritDoc}
+     */
+    @Override
+    public DefaultDerivedCRS forConvention(final AxesConvention convention) {
+        return (DefaultDerivedCRS) super.forConvention(convention);
+    }
+
+    /**
+     * Returns a coordinate reference system of the same type than this CRS but with different axes.
+     */
+    @Override
+    AbstractCRS createSameType(final Map<String,?> properties, final CoordinateSystem derivedCS) {
+        final Conversion conversionFromBase = super.getConversionFromBase();
+        return new DefaultDerivedCRS(properties, (SingleCRS) conversionFromBase.getSourceCRS(), conversionFromBase, derivedCS);
+    }
+
+    /**
      * Compares this coordinate reference system with the specified object for equality.
      *
      * @param  object The object to compare to {@code this}.
@@ -248,12 +357,23 @@ public class DefaultDerivedCRS extends A
      * Formats the inner part of the <cite>Well Known Text</cite> (WKT) representation of this CRS.
      *
      * @return {@code "Fitted_CS"} (WKT 1) or a type-dependent keyword (WKT 2).
+     *
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#93">WKT 2 specification</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {
+        final Conversion conversion = getConversionFromBase();  // Gives to users a chance to override.
+        if (conversion == null) {
+            /*
+             * Should never happen except temporarily at construction time, or if the user invoked the copy
+             * constructor with an invalid Conversion, or if the user overrides the getConversionFromBase()
+             * method. Delegates to the super-class method for avoiding a NullPointerException. That method
+             * returns 'null', which will cause the WKT to be declared invalid.
+             */
+            return super.formatTo(formatter);
+        }
         WKTUtilities.appendName(this, formatter, null);
         final boolean isWKT1 = (formatter.getConvention().majorVersion() == 1);
-        final Conversion conversion = getConversionFromBase();  // Gives to users a chance to override.
         /*
          * Both WKT 1 and WKT 2 format the base CRS. But WKT 1 formats the MathTransform before the base CRS,
          * while WKT 2 formats the conversion method and parameter values after the base CRS.
@@ -272,7 +392,7 @@ public class DefaultDerivedCRS extends A
         formatter.newLine();
         formatter.append(WKTUtilities.toFormattable(getBaseCRS()));
         if (isWKT1) {
-            return "Fitted_CS";
+            return WKTKeywords.Fitted_CS;
         } else {
             formatter.append(new FormattableObject() {     // Format inside a "DefiningConversion" element.
                 @Override protected String formatTo(final Formatter formatter) {
@@ -283,13 +403,223 @@ public class DefaultDerivedCRS extends A
                     for (final GeneralParameterValue param : conversion.getParameterValues().values()) {
                         WKTUtilities.append(param, formatter);
                     }
-                    return "DerivingConversion";
+                    return WKTKeywords.DerivingConversion;
                 }
             });
             if (!isBaseCRS(formatter)) {
                 formatCS(formatter, getCoordinateSystem(), isWKT1);
             }
-            return "EngineeringCRS"; // TODO: may be GeodeticCRS, VerticalCRS, etc.
+            return keyword();
+        }
+    }
+
+    /**
+     * Return the WKT 2 keyword for this {@code DerivedCRS}, or {@code null} if unknown.
+     * Inner subclasses will override this method for returning a constant value instead
+     * than trying to infer it from the components.
+     */
+    String keyword() {
+        return getType(getBaseCRS(), getCoordinateSystem());
+    }
+
+    /**
+     * Returns the WKT 2 keyword for a {@code DerivedCRS} having the given base CRS and derived coordinate system.
+     * Note that an ambiguity exists if the given base CRS is a {@code GeodeticCRS}, as the result could be either
+     * {@code "GeodeticCRS"} or {@code "EngineeringCRS"}. The current implementation returns the former if the
+     * derived coordinate system is of the same kind than the base coordinate system.
+     */
+    static String getType(final SingleCRS baseCRS, final CoordinateSystem derivedCS) {
+        final Class<?> type;
+        if (baseCRS instanceof AbstractIdentifiedObject) {
+            // For avoiding ambiguity if a user chooses to implement more
+            // than 1 CRS interface (not recommended, but may happen).
+            type = ((AbstractIdentifiedObject) baseCRS).getInterface();
+        } else {
+            type = baseCRS.getClass();
+        }
+        if (GeodeticCRS.class.isAssignableFrom(type)) {
+            if (Classes.implementSameInterfaces(derivedCS.getClass(),
+                    baseCRS.getCoordinateSystem().getClass(), CoordinateSystem.class))
+            {
+                return WKTKeywords.GeodeticCRS;
+            } else {
+                return WKTKeywords.EngineeringCRS;
+            }
+        } else if (VerticalCRS.class.isAssignableFrom(type) && derivedCS instanceof VerticalCS) {
+            return WKTKeywords.VerticalCRS;
+        } else if (TemporalCRS.class.isAssignableFrom(type) && derivedCS instanceof TimeCS) {
+            return WKTKeywords.TimeCRS;
+        } else if (ProjectedCRS.class.isAssignableFrom(type) || EngineeringCRS.class.isAssignableFrom(type)) {
+            return WKTKeywords.EngineeringCRS;
+        } else {
+            return null;
+        }
+    }
+
+
+
+
+    /**
+     * A derived geodetic CRS.  Note that base CRS of kind {@link GeodeticCRS} can be used both with this class
+     * and with {@link org.apache.sis.referencing.crs.DefaultDerivedCRS.Engineering}. Consequently an ambiguity
+     * may exist when choosing the kind if {@code DerivedCRS} to create for a given {@code GeodeticCRS}.
+     */
+    @XmlTransient
+    private static final class Geodetic extends DefaultDerivedCRS implements GeodeticCRS {
+        /** For cross-version compatibility. */
+        private static final long serialVersionUID = -1263243517380302846L;
+
+        /** Creates a copy of the given CRS. */
+        Geodetic(DerivedCRS other) {
+            super(other);
+        }
+
+        /** Creates a new geodetic CRS derived from the given one. */
+        Geodetic(Map<String,?> properties, GeodeticCRS baseCRS, Conversion conversion, EllipsoidalCS derivedCS) {
+            super(properties, baseCRS, conversion, derivedCS);
+        }
+
+        /** Returns the datum of the base geodetic CRS. */
+        @Override public GeodeticDatum getDatum() {
+            return (GeodeticDatum) super.getDatum();
+        }
+
+        /** Returns the coordinate system given at construction time. */
+        @Override public EllipsoidalCS getCoordinateSystem() {
+            return (EllipsoidalCS) super.getCoordinateSystem();
+        }
+
+        /** Returns a coordinate reference system of the same type than this CRS but with different axes. */
+        @Override AbstractCRS createSameType(final Map<String,?> properties, final CoordinateSystem derivedCS) {
+            final Conversion conversionFromBase = getConversionFromBase();
+            return new Geodetic(properties, (GeodeticCRS) conversionFromBase.getSourceCRS(),
+                    conversionFromBase, (EllipsoidalCS) derivedCS);
+        }
+
+        /** Returns the WKT keyword for this derived CRS type.*/
+        @Override String keyword() {
+            return WKTKeywords.GeodeticCRS;
+        }
+    }
+
+    /**
+     * A derived vertical CRS.
+     */
+    @XmlTransient
+    private static final class Vertical extends DefaultDerivedCRS implements VerticalCRS {
+        /** For cross-version compatibility. */
+        private static final long serialVersionUID = -5599709829566076972L;
+
+        /** Creates a copy of the given CRS. */
+        Vertical(DerivedCRS other) {
+            super(other);
+        }
+
+        /** Creates a new vertical CRS derived from the given one. */
+        Vertical(Map<String,?> properties, VerticalCRS baseCRS, Conversion conversion, VerticalCS derivedCS) {
+            super(properties, baseCRS, conversion, derivedCS);
+        }
+
+        /** Returns the datum of the base vertical CRS. */
+        @Override public VerticalDatum getDatum() {
+            return (VerticalDatum) super.getDatum();
+        }
+
+        /** Returns the coordinate system given at construction time. */
+        @Override public VerticalCS getCoordinateSystem() {
+            return (VerticalCS) super.getCoordinateSystem();
+        }
+
+        /** Returns a coordinate reference system of the same type than this CRS but with different axes. */
+        @Override AbstractCRS createSameType(final Map<String,?> properties, final CoordinateSystem derivedCS) {
+            final Conversion conversionFromBase = getConversionFromBase();
+            return new Vertical(properties, (VerticalCRS) conversionFromBase.getSourceCRS(),
+                    conversionFromBase, (VerticalCS) derivedCS);
+        }
+
+        /** Returns the WKT keyword for this derived CRS type.*/
+        @Override String keyword() {
+            return WKTKeywords.VerticalCRS;
+        }
+    }
+
+    /**
+     * A derived temporal CRS.
+     */
+    @XmlTransient
+    private static final class Temporal extends DefaultDerivedCRS implements TemporalCRS {
+        /** For cross-version compatibility. */
+        private static final long serialVersionUID = -4721311735720248819L;
+
+        /** Creates a copy of the given CRS. */
+        Temporal(DerivedCRS other) {
+            super(other);
+        }
+
+        /** Creates a new temporal CRS derived from the given one. */
+        Temporal(Map<String,?> properties, TemporalCRS baseCRS, Conversion conversion, TimeCS derivedCS) {
+            super(properties, baseCRS, conversion, derivedCS);
+        }
+
+        /** Returns the datum of the base temporal CRS. */
+        @Override public TemporalDatum getDatum() {
+            return (TemporalDatum) super.getDatum();
+        }
+
+        /** Returns the coordinate system given at construction time. */
+        @Override public TimeCS getCoordinateSystem() {
+            return (TimeCS) super.getCoordinateSystem();
+        }
+
+        /** Returns a coordinate reference system of the same type than this CRS but with different axes. */
+        @Override AbstractCRS createSameType(final Map<String,?> properties, final CoordinateSystem derivedCS) {
+            final Conversion conversionFromBase = getConversionFromBase();
+            return new Temporal(properties, (TemporalCRS) conversionFromBase.getSourceCRS(),
+                    conversionFromBase, (TimeCS) derivedCS);
+        }
+
+        /** Returns the WKT keyword for this derived CRS type.*/
+        @Override String keyword() {
+            return WKTKeywords.TimeCRS;
+        }
+    }
+
+    /**
+     * An derived engineering CRS. ISO 19162 restricts the base CRS to {@code EngineeringCRS}, {@code ProjectedCRS}
+     * or {@code GeodeticCRS}. Note that in the later case, an ambiguity may exist with the
+     * {@link org.apache.sis.referencing.crs.DefaultDerivedCRS.Geodetic} when deciding which {@code DerivedCRS} to
+     * create.
+     */
+    @XmlTransient
+    private static final class Engineering extends DefaultDerivedCRS implements EngineeringCRS {
+        /** For cross-version compatibility. */
+        private static final long serialVersionUID = 42334975023270039L;
+
+        /** Creates a copy of the given CRS. */
+        Engineering(DerivedCRS other) {
+            super(other);
+        }
+
+        /** Creates a new temporal CRS derived from the given one. */
+        Engineering(Map<String,?> properties, SingleCRS baseCRS, Conversion conversion, CoordinateSystem derivedCS) {
+            super(properties, baseCRS, conversion, derivedCS);
+        }
+
+        /** Returns the datum of the base engineering CRS. */
+        @Override public EngineeringDatum getDatum() {
+            final Datum datum = super.getDatum();
+            return (datum instanceof EngineeringDatum) ? (EngineeringDatum) datum : null;
+        }
+
+        /** Returns a coordinate reference system of the same type than this CRS but with different axes. */
+        @Override AbstractCRS createSameType(final Map<String,?> properties, final CoordinateSystem derivedCS) {
+            final Conversion conversionFromBase = getConversionFromBase();
+            return new Engineering(properties, (SingleCRS) conversionFromBase.getSourceCRS(), conversionFromBase, derivedCS);
+        }
+
+        /** Returns the WKT keyword for this derived CRS type.*/
+        @Override String keyword() {
+            return WKTKeywords.EngineeringCRS;
         }
     }
 }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java [UTF-8] Fri May 15 19:42:41 2015
@@ -32,13 +32,15 @@ import org.opengis.referencing.cs.UserDe
 import org.opengis.referencing.datum.EngineeringDatum;
 import org.apache.sis.referencing.cs.AxesConvention;
 import org.apache.sis.referencing.AbstractReferenceSystem;
+import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.io.wkt.Formatter;
 
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
 
 
 /**
- * A contextually local coordinate reference system. It can be divided into two broad categories:
+ * A 1-, 2- or 3-dimensional contextually local coordinate reference system.
+ * It can be divided into two broad categories:
  *
  * <ul>
  *   <li>earth-fixed systems applied to engineering activities on or near the surface of the earth;</li>
@@ -256,11 +258,13 @@ public class DefaultEngineeringCRS exten
      * Formats this CRS as a <cite>Well Known Text</cite> {@code EngineeringCRS[…]} element.
      *
      * @return {@code "EngineeringCRS"} (WKT 2) or {@code "Local_CS"} (WKT 1).
+     *
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#74">WKT 2 specification</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {
         super.formatTo(formatter);
-        return (formatter.getConvention().majorVersion() == 1) ? "Local_CS"
-               : isBaseCRS(formatter) ? "BaseEngCRS" : "EngineeringCRS";
+        return (formatter.getConvention().majorVersion() == 1) ? WKTKeywords.Local_CS
+               : isBaseCRS(formatter) ? WKTKeywords.BaseEngCRS : WKTKeywords.EngineeringCRS;
     }
 }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeocentricCRS.java [UTF-8] Fri May 15 19:42:41 2015
@@ -29,8 +29,8 @@ import org.apache.sis.referencing.Abstra
 
 
 /**
- * A 3D coordinate reference system with the origin at the approximate centre of mass of the earth.
- * A geocentric CRS deals with the earth's curvature by taking a 3D spatial view, which obviates
+ * A 3-dimensional coordinate reference system with the origin at the approximate centre of mass of the earth.
+ * A geocentric CRS deals with the earth's curvature by taking a 3-dimensional spatial view, which obviates
  * the need to model the earth's curvature.
  *
  * <p><b>Used with coordinate system type:</b>
@@ -38,6 +38,29 @@ import org.apache.sis.referencing.Abstra
  *   {@linkplain org.apache.sis.referencing.cs.DefaultSphericalCS Spherical}.
  * </p>
  *
+ * <div class="section">Creating new geocentric CRS instances</div>
+ * New instances can be created either directly by specifying all information to a factory method (choices 3
+ * and 4 below), or indirectly by specifying the identifier of an entry in a database (choices 1 and 2 below).
+ * Choice 1 in the following list is the easiest but most restrictive way to get a geocentric CRS.
+ * The other choices provide more freedom.
+ *
+ * <ol>
+ *   <li>Create a {@code GeocentricCRS} from one of the static convenience shortcuts listed in
+ *       {@link org.apache.sis.referencing.CommonCRS#geocentric()}.</li>
+ *   <li>Create a {@code GeocentricCRS} from an identifier in a database by invoking
+ *       {@link org.opengis.referencing.crs.CRSAuthorityFactory#createGeocentricCRS(String)}.</li>
+ *   <li>Create a {@code GeocentricCRS} by invoking the {@code CRSFactory.createGeocentricCRS(…)} method
+ *       (implemented for example by {@link org.apache.sis.referencing.GeodeticObjectFactory}).</li>
+ *   <li>Create a {@code GeocentricCRS} by invoking the
+ *       {@linkplain #DefaultGeocentricCRS(Map, GeodeticDatum, CartesianCS) constructor}.</li>
+ * </ol>
+ *
+ * <b>Example:</b> the following code gets a geocentric CRS using the <cite>World Geodetic System 1984</cite> datum:
+ *
+ * {@preformat java
+ *     GeodeticDatum datum = CommonCRS.WGS84.geocentric();
+ * }
+ *
  * <div class="section">Immutability and thread safety</div>
  * This class is immutable and thus thread-safe if the property <em>values</em> (not necessarily the map itself),
  * the coordinate system and the datum instances given to the constructor are also immutable. Unless otherwise noted
@@ -121,7 +144,7 @@ public class DefaultGeocentricCRS extend
      *
      * @param properties The properties to be given to the coordinate reference system.
      * @param datum The datum.
-     * @param cs The coordinate system.
+     * @param cs The coordinate system, which must be three-dimensional.
      */
     public DefaultGeocentricCRS(final Map<String,?> properties,
                                 final GeodeticDatum datum,
@@ -254,6 +277,8 @@ public class DefaultGeocentricCRS extend
      * </div>
      *
      * @return {@code "GeodeticCRS"} (WKT 2) or {@code "GeocCS"} (WKT 1).
+     *
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#49">WKT 2 specification</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java [UTF-8] Fri May 15 19:42:41 2015
@@ -29,6 +29,7 @@ import org.opengis.referencing.crs.Geode
 import org.opengis.referencing.datum.GeodeticDatum;
 import org.opengis.referencing.datum.PrimeMeridian;
 import org.apache.sis.internal.referencing.Legacy;
+import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.internal.referencing.WKTUtilities;
 import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.referencing.AbstractReferenceSystem;
@@ -40,7 +41,7 @@ import static org.apache.sis.internal.re
 
 
 /**
- * A 2D or 3D coordinate reference system based on a geodetic datum.
+ * A 2- or 3-dimensional coordinate reference system based on a geodetic datum.
  * The CRS is geographic if associated with an ellipsoidal coordinate system,
  * or geocentric if associated with a spherical or Cartesian coordinate system.
  *
@@ -240,9 +241,9 @@ class DefaultGeodeticCRS extends Abstrac
          * have a GeodeticCRS. We need to make the choice in this base class. The CS type is a sufficient criterion.
          */
         if (isWKT1) {
-            return (cs instanceof EllipsoidalCS) ? "GeogCS" : "GeocCS";
+            return (cs instanceof EllipsoidalCS) ? WKTKeywords.GeogCS : WKTKeywords.GeocCS;
         } else {
-            return isBaseCRS ? "BaseGeodCRS" : "GeodeticCRS";
+            return isBaseCRS ? WKTKeywords.BaseGeodCRS : WKTKeywords.GeodeticCRS;
         }
     }
 }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeographicCRS.java [UTF-8] Fri May 15 19:42:41 2015
@@ -43,7 +43,7 @@ import static org.apache.sis.internal.ut
 
 
 /**
- * A coordinate reference system based on an ellipsoidal approximation of the geoid.
+ * A 2- or 3-dimensional coordinate reference system based on an ellipsoidal approximation of the geoid.
  * This provides an accurate representation of the geometry of geographic features
  * for a large portion of the earth's surface.
  *
@@ -51,6 +51,31 @@ import static org.apache.sis.internal.ut
  *   {@linkplain org.apache.sis.referencing.cs.DefaultEllipsoidalCS Ellipsoidal}.
  * </p>
  *
+ * <div class="section">Creating new geographic CRS instances</div>
+ * New instances can be created either directly by specifying all information to a factory method (choices 3
+ * and 4 below), or indirectly by specifying the identifier of an entry in a database (choices 1 and 2 below).
+ * Choice 1 in the following list is the easiest but most restrictive way to get a geographic CRS.
+ * The other choices provide more freedom.
+ *
+ * <ol>
+ *   <li>Create a {@code GeographicCRS} from one of the static convenience shortcuts listed in
+ *       {@link org.apache.sis.referencing.CommonCRS#geographic()} or
+ *       {@link org.apache.sis.referencing.CommonCRS#geographic3D()}.</li>
+ *   <li>Create a {@code GeographicCRS} from an identifier in a database by invoking
+ *       {@link org.opengis.referencing.crs.CRSAuthorityFactory#createGeographicCRS(String)}.</li>
+ *   <li>Create a {@code GeographicCRS} by invoking the {@code CRSFactory.createGeographicCRS(…)} method
+ *       (implemented for example by {@link org.apache.sis.referencing.GeodeticObjectFactory}).</li>
+ *   <li>Create a {@code GeographicCRS} by invoking the
+ *       {@linkplain #DefaultGeographicCRS(Map, GeodeticDatum, EllipsoidalCS) constructor}.</li>
+ * </ol>
+ *
+ * <b>Example:</b> the following code gets a two-dimensional geographic CRS
+ * using the <cite>World Geodetic System 1984</cite> datum:
+ *
+ * {@preformat java
+ *     GeodeticDatum datum = CommonCRS.WGS84.geographic();
+ * }
+ *
  * <div class="section">Immutability and thread safety</div>
  * This class is immutable and thus thread-safe if the property <em>values</em> (not necessarily the map itself),
  * the coordinate system and the datum instances given to the constructor are also immutable. Unless otherwise noted
@@ -133,7 +158,7 @@ public class DefaultGeographicCRS extend
      *
      * @param properties The properties to be given to the coordinate reference system.
      * @param datum The datum.
-     * @param cs The coordinate system.
+     * @param cs The two- or three-dimensional coordinate system.
      */
     public DefaultGeographicCRS(final Map<String,?> properties,
                                 final GeodeticDatum datum,
@@ -301,6 +326,8 @@ public class DefaultGeographicCRS extend
      * </div>
      *
      * @return {@code "GeodeticCRS"} (WKT 2) or {@code "GeogCS"} (WKT 1).
+     *
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#49">WKT 2 specification</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultImageCRS.java [UTF-8] Fri May 15 19:42:41 2015
@@ -25,6 +25,7 @@ import org.opengis.referencing.cs.Affine
 import org.opengis.referencing.crs.ImageCRS;
 import org.opengis.referencing.cs.CartesianCS;
 import org.opengis.referencing.datum.ImageDatum;
+import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.referencing.cs.AxesConvention;
 import org.apache.sis.referencing.AbstractReferenceSystem;
 import org.apache.sis.io.wkt.Formatter;
@@ -33,9 +34,9 @@ import static org.apache.sis.util.Argume
 
 
 /**
- * An engineering coordinate reference system applied to locations in images. Image coordinate
- * reference systems are treated as a separate sub-type because a separate user community exists
- * for images with its own terms of reference.
+ * A 2-dimensional engineering coordinate reference system applied to locations in images.
+ * Image coordinate reference systems are treated as a separate sub-type because a separate
+ * user community exists for images with its own terms of reference.
  *
  * <p><b>Used with coordinate system types:</b>
  *   {@linkplain org.apache.sis.referencing.cs.DefaultCartesianCS Cartesian} or
@@ -261,6 +262,8 @@ public class DefaultImageCRS extends Abs
      * {@code ImageCRS} are defined in the WKT 2 specification only.</div>
      *
      * @return {@code "ImageCRS"}.
+     *
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#79">WKT 2 specification</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {
@@ -268,6 +271,6 @@ public class DefaultImageCRS extends Abs
         if (formatter.getConvention().majorVersion() == 1) {
             formatter.setInvalidWKT(this, null);
         }
-        return "ImageCRS";
+        return WKTKeywords.ImageCRS;
     }
 }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java [UTF-8] Fri May 15 19:42:41 2015
@@ -36,20 +36,23 @@ import org.opengis.referencing.operation
 import org.opengis.referencing.operation.Projection;
 import org.opengis.geometry.MismatchedDimensionException;
 import org.apache.sis.referencing.IdentifiedObjects;
+import org.apache.sis.referencing.cs.AxesConvention;
 import org.apache.sis.referencing.operation.DefaultOperationMethod;
 import org.apache.sis.internal.referencing.ReferencingUtilities;
+import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.internal.referencing.WKTUtilities;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.io.wkt.FormattableObject;
 import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.io.wkt.Convention;
 import org.apache.sis.util.ComparisonMode;
+import org.apache.sis.util.logging.Logging;
 
 import static org.apache.sis.internal.referencing.WKTUtilities.toFormattable;
 
 
 /**
- * A 2D coordinate reference system used to approximate the shape of the earth on a planar surface.
+ * A 2-dimensional coordinate reference system used to approximate the shape of the earth on a planar surface.
  * It is done in such a way that the distortion that is inherent to the approximation is carefully
  * controlled and known. Distortion correction is commonly applied to calculated bearings and
  * distances to produce values that are a close match to actual field values.
@@ -132,21 +135,26 @@ public class DefaultProjectedCRS extends
      *   </tr>
      * </table>
      *
+     * The supplied {@code conversion} argument shall <strong>not</strong> includes the operation steps
+     * for performing {@linkplain org.apache.sis.referencing.cs.CoordinateSystems#swapAndScaleAxes unit
+     * conversions and change of axis order} since those operations will be inferred by this constructor.
+     *
      * @param  properties The properties to be given to the new derived CRS object.
-     * @param  baseCRS Coordinate reference system to base the derived CRS on.
-     * @param  conversionFromBase The conversion from the base CRS to this derived CRS.
-     * @param  derivedCS The coordinate system for the derived CRS. The number of axes
+     * @param  baseCRS    Coordinate reference system to base the derived CRS on.
+     * @param  conversion The defining conversion from a {@linkplain AxesConvention#NORMALIZED normalized} base
+     *                    to a normalized derived CRS.
+     * @param  derivedCS  The coordinate system for the derived CRS. The number of axes
      *         must match the target dimension of the {@code baseToDerived} transform.
      * @throws MismatchedDimensionException if the source and target dimension of {@code baseToDerived}
      *         do not match the dimension of {@code base} and {@code derivedCS} respectively.
      */
     public DefaultProjectedCRS(final Map<String,?> properties,
                                final GeographicCRS baseCRS,
-                               final Conversion    conversionFromBase,
+                               final Conversion    conversion,
                                final CartesianCS   derivedCS)
             throws MismatchedDimensionException
     {
-        super(properties, Projection.class, baseCRS, conversionFromBase, derivedCS);
+        super(properties, baseCRS, conversion, derivedCS);
     }
 
     /**
@@ -161,7 +169,7 @@ public class DefaultProjectedCRS extends
      * @see #castOrCopy(ProjectedCRS)
      */
     protected DefaultProjectedCRS(final ProjectedCRS crs) {
-        super(crs, Projection.class);
+        super(crs);
     }
 
     /**
@@ -180,6 +188,15 @@ public class DefaultProjectedCRS extends
     }
 
     /**
+     * Returns the type of conversion associated to this {@code DefaultProjectedCRS}.
+     * Must be a hard-coded, constant value (not dependent on object state).
+     */
+    @Override
+    final Class<Projection> getConversionType() {
+        return Projection.class;
+    }
+
+    /**
      * Returns the GeoAPI interface implemented by this class.
      * The SIS implementation returns {@code ProjectedCRS.class}.
      *
@@ -245,7 +262,9 @@ public class DefaultProjectedCRS extends
      */
     @Override
     @XmlElement(name="cartesianCS", required = true)
-    public CartesianCS getCoordinateSystem() {
+    public final CartesianCS getCoordinateSystem() {
+        // See AbstractDerivedCRS.createConversionFromBase(…) for
+        // an explanation about why this method is declared final.
         return (CartesianCS) super.getCoordinateSystem();
     }
 
@@ -257,6 +276,25 @@ public class DefaultProjectedCRS extends
     }
 
     /**
+     * {@inheritDoc}
+     *
+     * @return {@inheritDoc}
+     */
+    @Override
+    public DefaultProjectedCRS forConvention(final AxesConvention convention) {
+        return (DefaultProjectedCRS) super.forConvention(convention);
+    }
+
+    /**
+     * Returns a coordinate reference system of the same type than this CRS but with different axes.
+     */
+    @Override
+    final AbstractCRS createSameType(final Map<String,?> properties, final CoordinateSystem cs) {
+        final Projection conversion = super.getConversionFromBase();
+        return new DefaultProjectedCRS(properties, (GeographicCRS) conversion.getSourceCRS(), conversion, (CartesianCS) cs);
+    }
+
+    /**
      * Compares this coordinate reference system with the specified object for equality.
      *
      * @param  object The object to compare to {@code this}.
@@ -331,9 +369,19 @@ public class DefaultProjectedCRS extends
      * </div>
      *
      * @return {@code "ProjectedCRS"} (WKT 2) or {@code "ProjCS"} (WKT 1).
+     *
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#57">WKT 2 specification</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {
+        if (super.getConversionFromBase() == null) {
+            /*
+             * Should never happen except temporarily at construction time, or if the user invoked the copy constructor
+             * with an invalid Conversion. Delegates to the super-class method for avoiding a NullPointerException.
+             * That method returns 'null', which will cause the WKT to be declared invalid.
+             */
+            return super.formatTo(formatter);
+        }
         WKTUtilities.appendName(this, formatter, null);
         final Convention    convention = formatter.getConvention();
         final boolean       isWKT1     = (convention.majorVersion() == 1);
@@ -367,7 +415,7 @@ public class DefaultProjectedCRS extends
         }
         formatter.removeContextualUnit(unit);
         formatter.addContextualUnit(oldUnit);
-        return isWKT1 ? "ProjCS" : isBaseCRS ? "BaseProjCRS" : "ProjectedCRS";
+        return isWKT1 ? WKTKeywords.ProjCS : isBaseCRS ? WKTKeywords.BaseProjCRS : WKTKeywords.ProjectedCRS;
     }
 
     /**
@@ -391,7 +439,7 @@ public class DefaultProjectedCRS extends
             WKTUtilities.appendName(conversion, formatter, null);
             formatter.newLine();
             append(formatter);
-            return "Conversion";
+            return WKTKeywords.Conversion;
         }
 
         /** Formats this {@code Conversion} element without the conversion name. */
@@ -411,7 +459,23 @@ public class DefaultProjectedCRS extends
                      * the lengths are different from the ones declared in the datum.
                      */
                     if (param instanceof ParameterValue<?>) {
-                        final double value = ((ParameterValue<?>) param).doubleValue(axisUnit);
+                        final double value;
+                        try {
+                            value = ((ParameterValue<?>) param).doubleValue(axisUnit);
+                        } catch (IllegalStateException e) {
+                            /*
+                             * May happen if the 'conversionFromBase' parameter group does not provide values
+                             * for "semi_major" or "semi_minor" axis length. This should not happen with SIS
+                             * implementation, but may happen with user-defined map projection implementations.
+                             * Since the intend of this check was to skip those parameters anyway, it is okay
+                             * for the purpose of WKT formatting if there is no parameter for axis lengths.
+                             */
+                            Logging.recoverableException(DefaultProjectedCRS.class, "formatTo", e);
+                            continue;
+                        }
+                        if (Double.isNaN(value)) {
+                            continue;
+                        }
                         final double expected = (name == Constants.SEMI_MINOR)   // using '==' is okay here.
                                 ? ellipsoid.getSemiMinorAxis() : ellipsoid.getSemiMajorAxis();
                         if (value == expected) {

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultTemporalCRS.java [UTF-8] Fri May 15 19:42:41 2015
@@ -29,6 +29,7 @@ import org.opengis.referencing.crs.Tempo
 import org.opengis.referencing.datum.TemporalDatum;
 import org.apache.sis.referencing.cs.AxesConvention;
 import org.apache.sis.referencing.AbstractReferenceSystem;
+import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.measure.Units;
 
@@ -36,7 +37,7 @@ import static org.apache.sis.util.Argume
 
 
 /**
- * A 1D coordinate reference system used for the recording of time.
+ * A 1-dimensional coordinate reference system used for the recording of time.
  * The Apache SIS implementation provides the following methods in addition to the OGC/ISO properties:
  *
  * <ul>
@@ -304,6 +305,8 @@ public class DefaultTemporalCRS extends
      * {@code TimeCRS} is defined in the WKT 2 specification only.</div>
      *
      * @return {@code "TimeCRS"}.
+     *
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#88">WKT 2 specification</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {
@@ -311,6 +314,6 @@ public class DefaultTemporalCRS extends
         if (formatter.getConvention().majorVersion() == 1) {
             formatter.setInvalidWKT(this, null);
         }
-        return isBaseCRS(formatter) ? "BaseTimeCRS" : "TimeCRS";
+        return isBaseCRS(formatter) ? WKTKeywords.BaseTimeCRS : WKTKeywords.TimeCRS;
     }
 }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java [UTF-8] Fri May 15 19:42:41 2015
@@ -26,13 +26,14 @@ import org.opengis.referencing.crs.Verti
 import org.opengis.referencing.datum.VerticalDatum;
 import org.apache.sis.referencing.cs.AxesConvention;
 import org.apache.sis.referencing.AbstractReferenceSystem;
+import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.io.wkt.Formatter;
 
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
 
 
 /**
- * A 1D coordinate reference system used for recording heights or depths.
+ * A 1-dimensional coordinate reference system used for recording heights or depths.
  * Vertical CRSs make use of the direction of gravity to define the concept of height or depth,
  * but the relationship with gravity may not be straightforward.
  *
@@ -234,11 +235,13 @@ public class DefaultVerticalCRS extends
      * Formats this CRS as a <cite>Well Known Text</cite> {@code VerticalCRS[…]} element.
      *
      * @return {@code "VerticalCRS"} (WKT 2) or {@code "Vert_CS"} (WKT 1).
+     *
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#69">WKT 2 specification</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {
         super.formatTo(formatter);
-        return (formatter.getConvention().majorVersion() == 1) ? "Vert_CS"
-               : isBaseCRS(formatter) ? "BaseVertCRS" : "VerticalCRS";
+        return (formatter.getConvention().majorVersion() == 1) ? WKTKeywords.Vert_CS
+               : isBaseCRS(formatter) ? WKTKeywords.BaseVertCRS : WKTKeywords.VerticalCRS;
     }
 }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java [UTF-8] Fri May 15 19:42:41 2015
@@ -35,6 +35,7 @@ import org.opengis.referencing.cs.Coordi
 import org.apache.sis.referencing.AbstractIdentifiedObject;
 import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.internal.referencing.AxisDirections;
+import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.resources.Errors;
@@ -438,6 +439,8 @@ public class AbstractCS extends Abstract
      * {@code CS} is defined in the WKT 2 specification only.</div>
      *
      * @return {@code "CS"}.
+     *
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#36">WKT 2 specification</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {
@@ -447,6 +450,6 @@ public class AbstractCS extends Abstract
         }
         formatter.append(type, null);
         formatter.append(getDimension());
-        return "CS";
+        return WKTKeywords.CS;
     }
 }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java [UTF-8] Fri May 15 19:42:41 2015
@@ -209,14 +209,16 @@ 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 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})
      * are taken in account by this method.
      *
+     * <div class="section">Conditions</div>
+     * The two coordinate systems must implement the same GeoAPI coordinate system interface.
+     * For example if {@code sourceCS} is a {@link org.opengis.referencing.cs.CartesianCS},
+     * then {@code targetCS} must be a {@code CartesianCS} too.
+     *
      * <div class="note"><b>Example:</b>
      * If coordinates in {@code sourceCS} are (<var>x</var>,<var>y</var>) tuples in metres
      * and coordinates in {@code targetCS} are (<var>-y</var>,<var>x</var>) tuples in centimetres,

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCartesianCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCartesianCS.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCartesianCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCartesianCS.java [UTF-8] Fri May 15 19:42:41 2015
@@ -121,15 +121,15 @@ public class DefaultCartesianCS extends
      * </table>
      *
      * @param properties The properties to be given to the identified object.
-     * @param axis0 The first axis.
-     * @param axis1 The second axis.
+     * @param axis0 The first  axis (e.g. “Easting”).
+     * @param axis1 The second axis (e.g. “Northing”).
      */
     public DefaultCartesianCS(final Map<String,?>   properties,
                               final CoordinateSystemAxis axis0,
                               final CoordinateSystemAxis axis1)
     {
         super(properties, axis0, axis1);
-        ensurePerpendicularAxis();
+        ensurePerpendicularAxis(properties);
     }
 
     /**
@@ -138,9 +138,9 @@ public class DefaultCartesianCS extends
      * {@linkplain AbstractCS#AbstractCS(Map,CoordinateSystemAxis[]) super-class constructor}.
      *
      * @param properties The properties to be given to the identified object.
-     * @param axis0 The first axis.
-     * @param axis1 The second axis.
-     * @param axis2 The third axis.
+     * @param axis0 The first  axis (e.g. “Geocentric X”).
+     * @param axis1 The second axis (e.g. “Geocentric Y”).
+     * @param axis2 The third  axis (e.g. “Geocentric Z”).
      */
     public DefaultCartesianCS(final Map<String,?>   properties,
                               final CoordinateSystemAxis axis0,
@@ -148,7 +148,7 @@ public class DefaultCartesianCS extends
                               final CoordinateSystemAxis axis2)
     {
         super(properties, axis0, axis1, axis2);
-        ensurePerpendicularAxis();
+        ensurePerpendicularAxis(properties);
     }
 
     /**
@@ -164,7 +164,7 @@ public class DefaultCartesianCS extends
      */
     protected DefaultCartesianCS(final CartesianCS cs) {
         super(cs);
-        ensurePerpendicularAxis();
+        ensurePerpendicularAxis(null);
     }
 
     /**
@@ -185,7 +185,7 @@ public class DefaultCartesianCS extends
     /**
      * Ensures that all axes are perpendicular.
      */
-    private void ensurePerpendicularAxis() throws IllegalArgumentException {
+    private void ensurePerpendicularAxis(final Map<String,?> properties) throws IllegalArgumentException {
         final int dimension = getDimension();
         for (int i=0; i<dimension; i++) {
             final AxisDirection axis0 = getAxis(i).getDirection();
@@ -198,7 +198,7 @@ public class DefaultCartesianCS extends
                  * they are not really for Cartesian CS because we do not know the grid geometry.
                  */
                 if (angle != null && Math.abs(angle.degrees()) != 90) {
-                    throw new IllegalArgumentException(Errors.format(
+                    throw new IllegalArgumentException(Errors.getResources(properties).getString(
                             Errors.Keys.NonPerpendicularDirections_2, axis0, axis1));
                 }
             }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java [UTF-8] Fri May 15 19:42:41 2015
@@ -38,7 +38,9 @@ import org.opengis.referencing.cs.Spheri
 import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.internal.referencing.AxisDirections;
+import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.referencing.AbstractIdentifiedObject;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.NamedIdentifier;
@@ -54,7 +56,6 @@ import org.apache.sis.io.wkt.Convention;
 import org.apache.sis.io.wkt.ElementKind;
 import org.apache.sis.io.wkt.CharEncoding;
 import org.apache.sis.io.wkt.FormattableObject;
-import org.apache.sis.internal.referencing.ReferencingUtilities;
 
 import static java.lang.Double.doubleToLongBits;
 import static java.lang.Double.NEGATIVE_INFINITY;
@@ -779,6 +780,8 @@ public class DefaultCoordinateSystemAxis
      * {@link org.apache.sis.io.wkt.WKTFormat#setCharEncoding(CharEncoding)}.
      *
      * @return {@code "Axis"}.
+     *
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#39">WKT 2 specification</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {
@@ -853,7 +856,7 @@ public class DefaultCoordinateSystemAxis
                 formatter.append(getUnit());
             }
         }
-        return "Axis";
+        return WKTKeywords.Axis;
     }
 
     /**
@@ -906,7 +909,7 @@ public class DefaultCoordinateSystemAxis
         @Override
         protected String formatTo(final Formatter formatter) {
             formatter.append(index);
-            return "Order";
+            return WKTKeywords.Order;
         }
     }
 }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java [UTF-8] Fri May 15 19:42:41 2015
@@ -113,8 +113,8 @@ public class DefaultEllipsoidalCS extend
      * </table>
      *
      * @param properties The properties to be given to the identified object.
-     * @param axis0 The first axis.
-     * @param axis1 The second axis.
+     * @param axis0 The first  axis (e.g. “Geodetic latitude”).
+     * @param axis1 The second axis (e.g. “Geodetic longitude”).
      */
     public DefaultEllipsoidalCS(final Map<String,?>   properties,
                                 final CoordinateSystemAxis axis0,
@@ -124,7 +124,7 @@ public class DefaultEllipsoidalCS extend
         for (int i=0; i<2; i++) {
             final AxisDirection direction = super.getAxis(i).getDirection();
             if (AxisDirections.isVertical(direction)) {
-                throw new IllegalArgumentException(Errors.format(
+                throw new IllegalArgumentException(Errors.getResources(properties).getString(
                         Errors.Keys.IllegalAxisDirection_2, "EllipdoicalCS (2D)", direction));
             }
         }
@@ -136,9 +136,9 @@ public class DefaultEllipsoidalCS extend
      * {@linkplain AbstractCS#AbstractCS(Map,CoordinateSystemAxis[]) super-class constructor}.
      *
      * @param properties The properties to be given to the identified object.
-     * @param axis0 The first axis.
-     * @param axis1 The second axis.
-     * @param axis2 The third axis.
+     * @param axis0 The first  axis (e.g. “Geodetic latitude”).
+     * @param axis1 The second axis (e.g. “Geodetic longitude”).
+     * @param axis2 The third  axis (e.g. “Ellipsoidal height”).
      */
     public DefaultEllipsoidalCS(final Map<String,?>   properties,
                                 final CoordinateSystemAxis axis0,

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultSphericalCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultSphericalCS.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultSphericalCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultSphericalCS.java [UTF-8] Fri May 15 19:42:41 2015
@@ -117,9 +117,9 @@ public class DefaultSphericalCS extends
      * </table>
      *
      * @param properties The properties to be given to the identified object.
-     * @param axis0 The first axis.
-     * @param axis1 The second axis.
-     * @param axis2 The third axis.
+     * @param axis0 The first  axis (e.g. “Spherical latitude”).
+     * @param axis1 The second axis (e.g. “Spherical longitude”).
+     * @param axis2 The third  axis (e.g. “Geocentric radius”).
      */
     public DefaultSphericalCS(final Map<String,?>   properties,
                               final CoordinateSystemAxis axis0,

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultVerticalCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultVerticalCS.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultVerticalCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultVerticalCS.java [UTF-8] Fri May 15 19:42:41 2015
@@ -126,7 +126,7 @@ public class DefaultVerticalCS extends A
      * </table>
      *
      * @param properties The properties to be given to the identified object.
-     * @param axis       The axis.
+     * @param axis       The single axis (e.g. “height” or “depth”).
      */
     public DefaultVerticalCS(final Map<String,?> properties, final CoordinateSystemAxis axis) {
         super(properties, axis);

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java [UTF-8] Fri May 15 19:42:41 2015
@@ -24,6 +24,7 @@ import org.apache.sis.util.iso.Types;
 import org.apache.sis.measure.Longitude;
 import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.internal.referencing.AxisDirections;
+import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.io.wkt.FormattableObject;
 import org.apache.sis.io.wkt.Formatter;
 
@@ -292,11 +293,13 @@ final class DirectionAlongMeridian exten
      *
      * @param  formatter The formatter where to format the inner content of this WKT element.
      * @return {@code "Meridian"}.
+     *
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#40">WKT 2 specification</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {
         formatter.append(meridian);
         formatter.append(NonSI.DEGREE_ANGLE);
-        return "Meridian";
+        return WKTKeywords.Meridian;
     }
 }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java [UTF-8] Fri May 15 19:42:41 2015
@@ -29,6 +29,7 @@ import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.internal.util.DoubleDouble;
+import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.operation.matrix.MatrixSIS;
 
@@ -606,7 +607,7 @@ public class BursaWolfParameters extends
         formatter.append(rZ);
         formatter.append(dS);
         if (isToWGS84()) {
-            return "ToWGS84";
+            return WKTKeywords.ToWGS84;
         }
         formatter.setInvalidWKT(BursaWolfParameters.class, null);
         String name = IdentifiedObjects.getUnicodeIdentifier(getTargetDatum());

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java [UTF-8] Fri May 15 19:42:41 2015
@@ -35,6 +35,7 @@ import org.apache.sis.internal.jaxb.gco.
 import org.apache.sis.internal.jaxb.referencing.SecondDefiningParameter;
 import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.internal.referencing.Formulas;
+import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.AbstractIdentifiedObject;
 import org.apache.sis.io.wkt.Formatter;
@@ -90,8 +91,8 @@ import org.apache.sis.internal.jdk7.Obje
  *       {@link org.apache.sis.referencing.CommonCRS#ellipsoid()}.</li>
  *   <li>Create an {@code Ellipsoid} from an identifier in a database by invoking
  *       {@link org.opengis.referencing.datum.DatumAuthorityFactory#createEllipsoid(String)}.</li>
- *   <li>Create an {@code Ellipsoid} by invoking the {@code createEllipsoid(…)} or {@code createFlattenedSphere(…)}
- *       methods defined in the {@link org.opengis.referencing.datum.DatumFactory} interface.</li>
+ *   <li>Create an {@code Ellipsoid} by invoking the {@code DatumFactory.createEllipsoid(…)} or {@code createFlattenedSphere(…)}
+ *       method (implemented for example by {@link org.apache.sis.referencing.GeodeticObjectFactory}).</li>
  *   <li>Create a {@code DefaultEllipsoid} by invoking the
  *       {@link #createEllipsoid(Map, double, double, Unit) createEllipsoid(…)} or
  *       {@link #createFlattenedSphere(Map, double, double, Unit) createFlattenedSphere(…)}
@@ -757,6 +758,8 @@ public class DefaultEllipsoid extends Ab
      * Formats this ellipsoid as a <cite>Well Known Text</cite> {@code Ellipsoid[…]} element.
      *
      * @return {@code "Ellipsoid"} (WKT 2) or {@code "Spheroid"} (WKT 1).
+     *
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#52">WKT 2 specification</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {
@@ -772,11 +775,11 @@ public class DefaultEllipsoid extends Ab
         final double inverseFlattening = getInverseFlattening();  // Gives to users a chance to override properties.
         formatter.append(isInfinite(inverseFlattening) ? 0 : inverseFlattening);
         if (isWKT1) {
-            return "Spheroid";
+            return WKTKeywords.Spheroid;
         }
         if (!convention.isSimplified() || !SI.METRE.equals(unit)) {
             formatter.append(unit);
         }
-        return "Ellipsoid";
+        return WKTKeywords.Ellipsoid;
     }
 }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java [UTF-8] Fri May 15 19:42:41 2015
@@ -23,6 +23,7 @@ import org.opengis.util.GenericName;
 import org.opengis.util.InternationalString;
 import org.opengis.referencing.ReferenceIdentifier;
 import org.opengis.referencing.datum.EngineeringDatum;
+import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.io.wkt.Formatter;
 
 
@@ -168,6 +169,8 @@ public class DefaultEngineeringDatum ext
      * Formats this datum as a <cite>Well Known Text</cite> {@code EngineeringDatum[…]} element.
      *
      * @return {@code "EngineeringDatum"} (WKT 2) or {@code "Local_Datum"} (WKT 1).
+     *
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#76">WKT 2 specification</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {
@@ -180,8 +183,8 @@ public class DefaultEngineeringDatum ext
              * in WKT 1, but do not have any indication about what the values should be.
              */
             formatter.append(0);
-            return "Local_Datum";
+            return WKTKeywords.Local_Datum;
         }
-        return "EngineeringDatum";
+        return WKTKeywords.EngineeringDatum;
     }
 }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java [UTF-8] Fri May 15 19:42:41 2015
@@ -33,6 +33,7 @@ import org.opengis.referencing.operation
 import org.apache.sis.referencing.operation.matrix.Matrices;
 import org.apache.sis.referencing.operation.matrix.NoninvertibleMatrixException;
 import org.apache.sis.metadata.iso.extent.Extents;
+import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.internal.referencing.ExtentSelector;
 import org.apache.sis.internal.util.CollectionsExt;
 import org.apache.sis.util.logging.Logging;
@@ -98,10 +99,10 @@ import org.apache.sis.internal.jdk7.Obje
  *       {@link org.apache.sis.referencing.CommonCRS#datum()}.</li>
  *   <li>Create a {@code GeodeticDatum} from an identifier in a database by invoking
  *       {@link org.opengis.referencing.datum.DatumAuthorityFactory#createGeodeticDatum(String)}.</li>
- *   <li>Create a {@code GeodeticDatum} by invoking the {@code createGeodeticDatum(…)}
- *       method defined in the {@link org.opengis.referencing.datum.DatumFactory} interface.</li>
+ *   <li>Create a {@code GeodeticDatum} by invoking the {@code DatumFactory.createGeodeticDatum(…)} method
+ *       (implemented for example by {@link org.apache.sis.referencing.GeodeticObjectFactory}).</li>
  *   <li>Create a {@code DefaultGeodeticDatum} by invoking the
- *       {@link #DefaultGeodeticDatum(Map, Ellipsoid, PrimeMeridian) constructor}.</li>
+ *       {@linkplain #DefaultGeodeticDatum(Map, Ellipsoid, PrimeMeridian) constructor}.</li>
  * </ol>
  *
  * <b>Example:</b> the following code gets a <cite>World Geodetic System 1984</cite> datum:
@@ -534,6 +535,8 @@ public class DefaultGeodeticDatum extend
      * as a separated element after the geodetic datum (for compatibility with WKT 1).
      *
      * @return {@code "Datum"}.
+     *
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#51">WKT 2 specification</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {
@@ -557,6 +560,6 @@ public class DefaultGeodeticDatum extend
         }
         // For the WKT 2 case, the ANCHOR[…] element is added by Formatter itself.
         formatter.newLine(); // For writing the ID[…] element on its own line.
-        return "Datum";
+        return WKTKeywords.Datum;
     }
 }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java [UTF-8] Fri May 15 19:42:41 2015
@@ -25,6 +25,7 @@ import org.opengis.util.InternationalStr
 import org.opengis.referencing.ReferenceIdentifier;
 import org.opengis.referencing.datum.ImageDatum;
 import org.opengis.referencing.datum.PixelInCell;
+import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.io.wkt.Convention;
 import org.apache.sis.util.ComparisonMode;
@@ -239,6 +240,8 @@ public class DefaultImageDatum extends A
      * {@code ImageDatum} is defined in the WKT 2 specification only.</div>
      *
      * @return {@code "ImageDatum"}.
+     *
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#81">WKT 2 specification</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {
@@ -249,6 +252,6 @@ public class DefaultImageDatum extends A
         } else if (convention.majorVersion() == 1) {
             formatter.setInvalidWKT(this, null);
         }
-        return "ImageDatum";
+        return WKTKeywords.ImageDatum;
     }
 }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java [UTF-8] Fri May 15 19:42:41 2015
@@ -28,6 +28,7 @@ import org.opengis.util.InternationalStr
 import org.opengis.referencing.ReferenceIdentifier;
 import org.opengis.referencing.datum.PrimeMeridian;
 import org.apache.sis.referencing.AbstractIdentifiedObject;
+import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.internal.jaxb.gco.Measure;
 import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.io.wkt.Formatter;
@@ -60,8 +61,8 @@ import org.apache.sis.internal.jdk7.Obje
  *       {@link org.apache.sis.referencing.CommonCRS#primeMeridian()}.</li>
  *   <li>Create a {@code PrimeMeridian} from an identifier in a database by invoking
  *       {@link org.opengis.referencing.datum.DatumAuthorityFactory#createPrimeMeridian(String)}.</li>
- *   <li>Create a {@code PrimeMeridian} by invoking the {@code createPrimeMeridian(…)}
- *       method defined in the {@link org.opengis.referencing.datum.DatumFactory} interface.</li>
+ *   <li>Create a {@code PrimeMeridian} by invoking the {@code DatumFactory.createPrimeMeridian(…)} method
+ *       (implemented for example by {@link org.apache.sis.referencing.GeodeticObjectFactory}).</li>
  *   <li>Create a {@code DefaultPrimeMeridian} by invoking the
  *       {@linkplain #DefaultPrimeMeridian(Map, double, Unit) constructor}.</li>
  * </ol>
@@ -339,6 +340,8 @@ public class DefaultPrimeMeridian extend
      * Formats this prime meridian as a <cite>Well Known Text</cite> {@code PrimeMeridian[…]} element.
      *
      * @return {@code "PrimeMeridian"} (WKT 2) or {@code "PrimeM"} (WKT 1).
+     *
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#53">WKT 2 specification</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {
@@ -351,12 +354,12 @@ public class DefaultPrimeMeridian extend
         }
         formatter.append(isWKT1 ? getGreenwichLongitude(targetUnit) : getGreenwichLongitude());
         if (isWKT1) {
-            return "PrimeM";
+            return WKTKeywords.PrimeM;
         }
         final Unit<Angle> angularUnit = getAngularUnit();   // Gives to users a chance to override properties.
         if (!convention.isSimplified() || !targetUnit.equals(angularUnit)) {
             formatter.append(angularUnit);
         }
-        return "PrimeMeridian";
+        return WKTKeywords.PrimeMeridian;
     }
 }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java [UTF-8] Fri May 15 19:42:41 2015
@@ -26,6 +26,7 @@ import org.opengis.util.GenericName;
 import org.opengis.util.InternationalString;
 import org.opengis.referencing.ReferenceIdentifier;
 import org.opengis.referencing.datum.TemporalDatum;
+import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.internal.jaxb.gml.UniversalTimeAdapter;
 import org.apache.sis.internal.metadata.MetadataUtilities;
 import org.apache.sis.util.ComparisonMode;
@@ -53,8 +54,8 @@ import org.apache.sis.internal.jdk7.Obje
  *       {@link org.apache.sis.referencing.CommonCRS.Temporal#datum()}.</li>
  *   <li>Create a {@code TemporalDatum} from an identifier in a database by invoking
  *       {@link org.opengis.referencing.datum.DatumAuthorityFactory#createTemporalDatum(String)}.</li>
- *   <li>Create a {@code TemporalDatum} by invoking the {@code createTemporalDatum(…)}
- *       method defined in the {@link org.opengis.referencing.datum.DatumFactory} interface.</li>
+ *   <li>Create a {@code TemporalDatum} by invoking the {@code DatumFactory.createTemporalDatum(…)} method,
+ *       (implemented for example by {@link org.apache.sis.referencing.GeodeticObjectFactory}).</li>
  *   <li>Create a {@code DefaultTemporalDatum} by invoking the
  *       {@linkplain #DefaultTemporalDatum(Map, Date) constructor}.</li>
  * </ol>
@@ -285,6 +286,8 @@ public class DefaultTemporalDatum extend
      * {@code TimeDatum} is defined in the WKT 2 specification only.</div>
      *
      * @return {@code "TimeDatum"}.
+     *
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#90">WKT 2 specification</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {
@@ -293,7 +296,7 @@ public class DefaultTemporalDatum extend
         if (formatter.getConvention().majorVersion() == 1) {
             formatter.setInvalidWKT(this, null);
         }
-        return "TimeDatum";
+        return WKTKeywords.TimeDatum;
     }
 
     /**
@@ -312,7 +315,7 @@ public class DefaultTemporalDatum extend
         @Override
         protected String formatTo(final Formatter formatter) {
             formatter.append(origin);
-            return "TimeOrigin";
+            return WKTKeywords.TimeOrigin;
         }
     }
 }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java?rev=1679636&r1=1679635&r2=1679636&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java [UTF-8] Fri May 15 19:42:41 2015
@@ -29,6 +29,7 @@ import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.internal.jaxb.LegacyNamespaces;
+import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.internal.referencing.VerticalDatumTypes;
 
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
@@ -55,8 +56,8 @@ import org.apache.sis.internal.jdk7.Obje
  *       {@link org.apache.sis.referencing.CommonCRS.Vertical#datum()}.</li>
  *   <li>Create a {@code VerticalDatum} from an identifier in a database by invoking
  *       {@link org.opengis.referencing.datum.DatumAuthorityFactory#createVerticalDatum(String)}.</li>
- *   <li>Create a {@code VerticalDatum} by invoking the {@code createVerticalDatum(…)}
- *       method defined in the {@link org.opengis.referencing.datum.DatumFactory} interface.</li>
+ *   <li>Create a {@code VerticalDatum} by invoking the {@code DatumFactory.createVerticalDatum(…)} method
+ *       (implemented for example by {@link org.apache.sis.referencing.GeodeticObjectFactory}).</li>
  *   <li>Create a {@code DefaultVerticalDatum} by invoking the
  *       {@linkplain #DefaultVerticalDatum(Map, VerticalDatumType) constructor}.</li>
  * </ol>
@@ -317,14 +318,16 @@ public class DefaultVerticalDatum extend
      * completely in ISO 19111:2007.</div>
      *
      * @return {@code "VerticalDatum"} (WKT 2) or {@code "Vert_Datum"} (WKT 1).
+     *
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#71">WKT 2 specification</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {
         super.formatTo(formatter);
         if (formatter.getConvention().majorVersion() == 1) {
             formatter.append(VerticalDatumTypes.toLegacy(type().ordinal()));
-            return "Vert_Datum";
+            return WKTKeywords.Vert_Datum;
         }
-        return "VerticalDatum";
+        return WKTKeywords.VerticalDatum;
     }
 }



Mime
View raw message