You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2015/06/26 20:03:39 UTC

svn commit: r1687826 [2/3] - in /sis/trunk: ./ core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ core/sis-metadata/src/main/java/org/apache/sis/io/wkt/ core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ core/sis-metadata/src/t...

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -27,7 +27,6 @@ import java.io.IOException;
 import java.text.Format;
 import java.text.NumberFormat;
 import java.text.DateFormat;
-import java.text.SimpleDateFormat;
 import java.text.ParsePosition;
 import java.text.ParseException;
 import javax.measure.unit.Unit;
@@ -39,6 +38,7 @@ import org.opengis.referencing.Identifie
 import org.apache.sis.io.CompoundFormat;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
+import org.apache.sis.internal.util.StandardDateFormat;
 
 
 /**
@@ -51,7 +51,7 @@ import org.apache.sis.util.resources.Err
  *   <li>The preferred authority of {@linkplain IdentifiedObject#getName() object name} to
  *       format (see {@link Formatter#getNameAuthority()} for more information).</li>
  *   <li>The {@linkplain Symbols symbols} to use (curly braces or brackets, <i>etc</i>).</li>
- *   <li>The {@linkplain CharEncoding character encoding} (i.e. replacements to use for Unicode characters).</li>
+ *   <li>The {@link Transliterator transliterator} (i.e. replacements to use for Unicode characters).</li>
  *   <li>Whether ANSI X3.64 colors are allowed or not (default is not).</li>
  *   <li>The indentation.</li>
  * </ul>
@@ -116,26 +116,6 @@ public class WKTFormat extends CompoundF
     static final byte DEFAULT_INDENTATION = 2;
 
     /**
-     * The pattern of dates.
-     *
-     * The JDK7 branch have a 'X' pattern at the end of this format. But JDK6 does not support that pattern.
-     * As a workaround, code using this pattern will append a hard-coded {@code "'Z'"} if the timezone is
-     * known to be UTC.
-     *
-     * @see #createFormat(Class)
-     */
-    static final String DATE_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.S";
-
-    /**
-     * Short version of {@link #DATE_PATTERN}, to be used when formatting temporal extents
-     * if the duration is at least {@link Formatter#TEMPORAL_THRESHOLD}. This pattern must
-     * be a prefix of {@link #DATE_PATTERN}, since we will use that condition for deciding
-     * if this pattern is really shorter (the user could have created his own date format
-     * with a different pattern).
-     */
-    static final String SHORT_DATE_PATTERN = "yyyy-MM-dd";
-
-    /**
      * The symbols to use for this formatter.
      * The same object is also referenced in the {@linkplain #parser} and {@linkplain #formatter}.
      * It appears here for serialization purpose.
@@ -167,13 +147,13 @@ public class WKTFormat extends CompoundF
     private KeywordCase keywordCase;
 
     /**
-     * {@link CharEncoding#UNICODE} for preserving non-ASCII characters. The default value is
-     * {@link CharEncoding#DEFAULT}, which causes replacements like "é" → "e" in all elements
-     * except {@code REMARKS["…"]}. May also be a user-supplied encoding.
+     * {@link Transliterator#IDENTITY} for preserving non-ASCII characters. The default value is
+     * {@link Transliterator#DEFAULT}, which causes replacements like "é" → "e" in all elements
+     * except {@code REMARKS["…"]}. May also be a user-supplied transliterator.
      *
      * <p>A {@code null} value means to infer this property from the {@linkplain #convention}.</p>
      */
-    private CharEncoding encoding;
+    private Transliterator transliterator;
 
     /**
      * The amount of spaces to use in indentation, or {@value #SINGLE_LINE} if indentation is disabled.
@@ -249,9 +229,9 @@ public class WKTFormat extends CompoundF
      * according ISO 19162 specification. Return values can be:
      *
      * <ul>
-     *   <li>{@link CharEncoding#DEFAULT} for performing replacements like "é" → "e"
+     *   <li>{@link Transliterator#DEFAULT} for performing replacements like "é" → "e"
      *       in all WKT elements except {@code REMARKS["…"]}.</li>
-     *   <li>{@link CharEncoding#UNICODE} for preserving non-ASCII characters.</li>
+     *   <li>{@link Transliterator#IDENTITY} for preserving non-ASCII characters.</li>
      *   <li>Any other user-supplied mapping.</li>
      * </ul>
      *
@@ -259,10 +239,10 @@ public class WKTFormat extends CompoundF
      *
      * @since 0.6
      */
-    public CharEncoding getCharEncoding() {
-        CharEncoding result = encoding;
+    public Transliterator getTransliterator() {
+        Transliterator result = transliterator;
         if (result == null) {
-            result = (convention == Convention.INTERNAL) ? CharEncoding.UNICODE : CharEncoding.DEFAULT;
+            result = (convention == Convention.INTERNAL) ? Transliterator.IDENTITY : Transliterator.DEFAULT;
         }
         return result;
     }
@@ -271,15 +251,19 @@ public class WKTFormat extends CompoundF
      * Sets the mapper between Java character sequences and the characters to write in WKT.
      *
      * <p>If this method is never invoked, or if this method is invoked with a {@code null} value,
-     * then the default mapper is {@link CharEncoding#DEFAULT} except for WKT formatted according
+     * then the default mapper is {@link Transliterator#DEFAULT} except for WKT formatted according
      * the {@linkplain Convention#INTERNAL internal convention}.</p>
      *
-     * @param encoding The new mapper to use, or {@code null} for restoring the default value.
+     * @param transliterator The new mapper to use, or {@code null} for restoring the default value.
      *
      * @since 0.6
      */
-    public void setCharEncoding(final CharEncoding encoding) {
-        this.encoding = encoding;
+    public void setTransliterator(final Transliterator transliterator) {
+        if (this.transliterator != transliterator) {
+            this.transliterator = transliterator;
+            updateFormatter(formatter);
+            parser = null;
+        }
     }
 
     /**
@@ -293,11 +277,11 @@ public class WKTFormat extends CompoundF
      *
      * @since 0.5
      *
-     * @deprecated Replaced by {@link #getCharEncoding()}.
+     * @deprecated Replaced by {@link #getTransliterator()}.
      */
     @Deprecated
     public boolean isNonAsciiAllowed() {
-        return getCharEncoding() == CharEncoding.UNICODE;
+        return getTransliterator() == Transliterator.IDENTITY;
     }
 
     /**
@@ -309,11 +293,11 @@ public class WKTFormat extends CompoundF
      *
      * @since 0.5
      *
-     * @deprecated Replaced by {@link #setCharEncoding(CharEncoding)}.
+     * @deprecated Replaced by {@link #setTransliterator(Transliterator)}.
      */
     @Deprecated
     public void setNonAsciiAllowed(final boolean allowed) {
-        setCharEncoding(allowed ? CharEncoding.UNICODE : CharEncoding.DEFAULT);
+        setTransliterator(allowed ? Transliterator.IDENTITY : Transliterator.DEFAULT);
     }
 
     /**
@@ -382,9 +366,11 @@ public class WKTFormat extends CompoundF
      */
     public void setConvention(final Convention convention) {
         ArgumentChecks.ensureNonNull("convention", convention);
-        this.convention = convention;
-        updateFormatter(formatter);
-        parser = null;
+        if (this.convention != convention) {
+            this.convention = convention;
+            updateFormatter(formatter);
+            parser = null;
+        }
     }
 
     /**
@@ -447,8 +433,8 @@ public class WKTFormat extends CompoundF
                 default: toUpperCase = (convention.majorVersion() == 1); break;
             }
             formatter.configure(convention, authority, colors, toUpperCase, indentation);
-            if (encoding != null) {
-                formatter.encoding = encoding;
+            if (transliterator != null) {
+                formatter.transliterator = transliterator;
             }
         }
     }
@@ -509,7 +495,10 @@ public class WKTFormat extends CompoundF
                     (NumberFormat) getFormat(Number.class),
                     (DateFormat)   getFormat(Date.class),
                     (UnitFormat)   getFormat(Unit.class),
-                    convention, getLocale(), factories);
+                    convention,
+                    (transliterator != null) ? transliterator : Transliterator.DEFAULT,
+                    getLocale(),
+                    factories);
         }
         Object object = null;
         try {
@@ -602,11 +591,7 @@ public class WKTFormat extends CompoundF
             return symbols.createNumberFormat();
         }
         if (valueType == Date.class) {
-            final TimeZone timezone = getTimeZone();
-            final DateFormat format = new SimpleDateFormat("UTC".equals(timezone.getID()) ?
-                    DATE_PATTERN + "'Z'" : DATE_PATTERN, symbols.getLocale());
-            format.setTimeZone(timezone);
-            return format;
+            return new StandardDateFormat(symbols.getLocale(), getTimeZone());
         }
         return super.createFormat(valueType);
     }

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -544,7 +544,7 @@ public class ImmutableIdentifier extends
      * @param  formatter The formatter where to format the inner content of this WKT element.
      * @return {@code "Id"} (WKT 2) or {@code "Authority"} (WKT 1).
      *
-     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#33">WKT 2 specification</a>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#33">WKT 2 specification §7.3.4</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultExtentTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultExtentTest.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultExtentTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultExtentTest.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -22,6 +22,7 @@ import javax.xml.bind.JAXBException;
 import org.apache.sis.xml.IdentifierSpace;
 import org.apache.sis.test.XMLTestCase;
 import org.apache.sis.test.DependsOn;
+import org.apache.sis.xml.Namespaces;
 import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
@@ -34,7 +35,7 @@ import static org.apache.sis.test.TestUt
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.4
+ * @version 0.6
  * @module
  */
 @DependsOn(DefaultGeographicBoundingBoxTest.class)
@@ -87,4 +88,33 @@ public final strictfp class DefaultExten
          */
         assertEquals(extent, unmarshal(DefaultExtent.class, xml));
     }
+
+    /**
+     * Tests XML marshalling of the {@link Extents#WORLD} constant, which is a {@code DefaultExtent} instance.
+     *
+     * @throws JAXBException If an error occurred during the during marshalling / unmarshalling processes.
+     *
+     * @since 0.6
+     */
+    @Test
+    public void testWorldConstant() throws JAXBException {
+        final String xml = marshal(Extents.WORLD);
+        assertXmlEquals("<gmd:EX_Extent" +
+                " xmlns:gco=\"" + Namespaces.GCO + '"' +
+                " xmlns:gmd=\"" + Namespaces.GMD + "\">\n" +
+                "  <gmd:description>\n" +
+                "    <gco:CharacterString>World</gco:CharacterString>\n" +
+                "  </gmd:description>\n" +
+                "  <gmd:geographicElement>\n" +
+                "    <gmd:EX_GeographicBoundingBox>\n" +
+                "      <gmd:extentTypeCode>    <gco:Boolean> true </gco:Boolean></gmd:extentTypeCode>\n" +
+                "      <gmd:westBoundLongitude><gco:Decimal> -180 </gco:Decimal></gmd:westBoundLongitude>\n" +
+                "      <gmd:eastBoundLongitude><gco:Decimal>  180 </gco:Decimal></gmd:eastBoundLongitude>\n" +
+                "      <gmd:southBoundLatitude><gco:Decimal>  -90 </gco:Decimal></gmd:southBoundLatitude>\n" +
+                "      <gmd:northBoundLatitude><gco:Decimal>   90 </gco:Decimal></gmd:northBoundLatitude>\n" +
+                "    </gmd:EX_GeographicBoundingBox>\n" +
+                "  </gmd:geographicElement>\n" +
+                "</gmd:EX_Extent>",
+                xml, "xmlns:*", "xsi:schemaLocation");
+    }
 }

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/ExtentsTest.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -37,7 +37,10 @@ import static org.junit.Assert.*;
 
 
 /**
- * Tests {@link Extents}.
+ * Tests {@link Extents} static methods.
+ *
+ * <p><b>Note:</b> the {@link Extents#WORLD} constant is tested in another class,
+ * {@link DefaultExtentTest#testWorldConstant()}.</p>
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -95,7 +95,7 @@ import org.junit.BeforeClass;
 
     org.apache.sis.io.wkt.ConventionTest.class,
     org.apache.sis.io.wkt.SymbolsTest.class,
-    org.apache.sis.io.wkt.CharEncodingTest.class,
+    org.apache.sis.io.wkt.TransliteratorTest.class,
     org.apache.sis.io.wkt.ColorsTest.class,
     org.apache.sis.io.wkt.FormatterTest.class,
     org.apache.sis.io.wkt.ElementTest.class

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -32,6 +32,7 @@ import org.apache.sis.util.logging.Loggi
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.resources.Vocabulary;
 import org.apache.sis.internal.jaxb.Context;
+import org.apache.sis.internal.metadata.AxisDirections;
 import org.apache.sis.referencing.CommonCRS;
 import org.apache.sis.referencing.datum.DefaultPrimeMeridian;
 import org.apache.sis.referencing.crs.DefaultGeographicCRS;

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -19,7 +19,6 @@ package org.apache.sis.internal.referenc
 import java.util.Map;
 import java.util.Iterator;
 import java.util.Collection;
-import java.util.Collections;
 import javax.measure.unit.Unit;
 import javax.measure.quantity.Length;
 
@@ -56,6 +55,7 @@ import org.apache.sis.referencing.Common
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.AbstractIdentifiedObject;
 import org.apache.sis.referencing.cs.AbstractCS;
+import org.apache.sis.referencing.cs.CoordinateSystems;
 import org.apache.sis.referencing.crs.DefaultDerivedCRS;
 import org.apache.sis.referencing.crs.DefaultTemporalCRS;
 import org.apache.sis.referencing.datum.BursaWolfParameters;
@@ -71,6 +71,7 @@ import org.apache.sis.metadata.iso.exten
 import org.apache.sis.metadata.iso.extent.DefaultTemporalExtent;
 import org.apache.sis.metadata.iso.extent.DefaultSpatialTemporalExtent;
 import org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox;
+import org.apache.sis.internal.metadata.AxisDirections;
 import org.apache.sis.internal.metadata.ReferencingServices;
 import org.apache.sis.internal.referencing.provider.Affine;
 import org.apache.sis.internal.system.DefaultFactories;
@@ -501,15 +502,15 @@ public final class ServicesForMetadata e
      * since that legacy format did not specified any information about the coordinate system in use.
      * This method should not need to be invoked for parsing WKT version 2.
      *
+     * @param  properties The coordinate system name, and optionally other properties.
      * @param  axes The axes of the unknown coordinate system.
      * @return An "abstract" coordinate system using the given axes.
      *
      * @since 0.6
      */
     @Override
-    public CoordinateSystem createAbstractCS(final CoordinateSystemAxis[] axes) {
-        return new AbstractCS(Collections.singletonMap(AbstractCS.NAME_KEY,
-                AxisDirections.appendTo(new StringBuilder("CS"), axes)), axes);
+    public CoordinateSystem createAbstractCS(final Map<String,?> properties, final CoordinateSystemAxis[] axes) {
+        return new AbstractCS(properties, axes);
     }
 
     /**
@@ -538,20 +539,19 @@ public final class ServicesForMetadata e
     }
 
     /**
-     * Suggests an abbreviation for the given axis direction. The unit of measurement may be used
-     * for resolving some ambiguities like whether {@link AxisDirection#EAST} is for "x" (Easting)
-     * or "λ" (Longitude).
-     *
-     * @param name      The axis name for which to suggest an abbreviation.
-     * @param direction The axis direction for which to suggest an abbreviation.
-     * @param unit      The axis unit of measurement, for disambiguation.
-     * @return A suggested abbreviation.
+     * Returns an axis direction from a pole along a meridian.
+     * The given meridian is usually, but not necessarily, relative to the Greenwich meridian.
+     *
+     * @param  baseDirection The base direction, which must be {@link AxisDirection#NORTH} or {@link AxisDirection#SOUTH}.
+     * @param  meridian The meridian in degrees, relative to a unspecified (usually Greenwich) prime meridian.
+     *         Meridians in the East hemisphere are positive and meridians in the West hemisphere are negative.
+     * @return The axis direction along the given meridian.
      *
      * @since 0.6
      */
     @Override
-    public String suggestAbbreviation(final String name, final AxisDirection direction, final Unit<?> unit) {
-        return AxisDirections.suggestAbbreviation(name, direction, unit);
+    public AxisDirection directionAlongMeridian(final AxisDirection baseDirection, final double meridian) {
+        return CoordinateSystems.directionAlongMeridian(baseDirection, meridian);
     }
 
     /**

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -867,7 +867,7 @@ public class DefaultParameterValue<T> ex
      * @param  formatter The formatter where to format the inner content of this WKT element.
      * @return {@code "Parameter"} or {@code "ParameterFile"}.
      *
-     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#119">WKT 2 specification</a>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#119">WKT 2 specification §17.2.4</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -781,7 +781,7 @@ public class AbstractIdentifiedObject ex
      *
      * <div class="section">Future evolutions</div>
      * This method implements recommendations from the
-     * <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#139">§B.5.2 of WKT 2 specification</a>,
+     * <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#139">WKT 2 specification §B.5.2</a>,
      * together with heuristic rules learned from experience while trying to provide inter-operability
      * with different data producers. Those rules may be adjusted in any future SIS version according experience
      * gained while working with more data producers.
@@ -1039,7 +1039,7 @@ public class AbstractIdentifiedObject ex
      * @return The {@linkplain org.apache.sis.io.wkt.KeywordCase#CAMEL_CASE CamelCase} keyword
      *         for the WKT element, or {@code null} if unknown.
      *
-     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#21">WKT 2 specification</a>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#21">WKT 2 specification §7</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -41,7 +41,7 @@ import org.opengis.referencing.crs.Verti
 import org.opengis.metadata.extent.Extent;
 import org.opengis.metadata.extent.GeographicBoundingBox;
 import org.apache.sis.internal.util.DefinitionURI;
-import org.apache.sis.internal.referencing.AxisDirections;
+import org.apache.sis.internal.metadata.AxisDirections;
 import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.referencing.cs.DefaultVerticalCS;

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -447,7 +447,7 @@ public class DefaultCompoundCRS extends
      *
      * @return {@code "CompoundCRS"} (WKT 2) or {@code "Compd_CS"} (WKT 1).
      *
-     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#110">WKT 2 specification</a>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#110">WKT 2 specification §16</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {

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=1687826&r1=1687825&r2=1687826&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 Jun 26 18:03:38 2015
@@ -487,7 +487,7 @@ public class DefaultDerivedCRS extends A
      *
      * @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>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#93">WKT 2 specification §15</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {

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=1687826&r1=1687825&r2=1687826&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 Jun 26 18:03:38 2015
@@ -259,7 +259,7 @@ public class DefaultEngineeringCRS exten
      *
      * @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>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#74">WKT 2 specification §11</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {

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=1687826&r1=1687825&r2=1687826&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 Jun 26 18:03:38 2015
@@ -278,7 +278,7 @@ public class DefaultGeocentricCRS extend
      *
      * @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>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#49">WKT 2 specification §8</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {

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=1687826&r1=1687825&r2=1687826&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 Jun 26 18:03:38 2015
@@ -327,7 +327,7 @@ public class DefaultGeographicCRS extend
      *
      * @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>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#49">WKT 2 specification §8</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=1687826&r1=1687825&r2=1687826&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 Jun 26 18:03:38 2015
@@ -263,7 +263,7 @@ public class DefaultImageCRS extends Abs
      *
      * @return {@code "ImageCRS"}.
      *
-     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#79">WKT 2 specification</a>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#79">WKT 2 specification §12</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {

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=1687826&r1=1687825&r2=1687826&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 Jun 26 18:03:38 2015
@@ -369,7 +369,7 @@ public class DefaultProjectedCRS extends
      *
      * @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>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#57">WKT 2 specification §9</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {

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=1687826&r1=1687825&r2=1687826&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 Jun 26 18:03:38 2015
@@ -306,7 +306,7 @@ public class DefaultTemporalCRS extends
      *
      * @return {@code "TimeCRS"}.
      *
-     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#88">WKT 2 specification</a>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#88">WKT 2 specification §14</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {

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=1687826&r1=1687825&r2=1687826&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 Jun 26 18:03:38 2015
@@ -236,7 +236,7 @@ public class DefaultVerticalCRS extends
      *
      * @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>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#69">WKT 2 specification §10</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {

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=1687826&r1=1687825&r2=1687826&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 Jun 26 18:03:38 2015
@@ -34,7 +34,7 @@ import org.opengis.referencing.cs.Coordi
 import org.opengis.referencing.cs.CoordinateSystemAxis;
 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.AxisDirections;
 import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.io.wkt.Formatter;
 import org.apache.sis.util.ComparisonMode;
@@ -456,7 +456,7 @@ public class AbstractCS extends Abstract
      *
      * @return {@code "CS"}.
      *
-     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#36">WKT 2 specification</a>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#36">WKT 2 specification §7.5</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -22,7 +22,7 @@ import javax.measure.unit.NonSI;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystem; // For javadoc
 import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.referencing.AxisDirections;
+import org.apache.sis.internal.metadata.AxisDirections;
 import org.apache.sis.measure.Units;
 
 

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=1687826&r1=1687825&r2=1687826&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 Jun 26 18:03:38 2015
@@ -31,7 +31,7 @@ import org.apache.sis.util.Static;
 import org.apache.sis.util.Classes;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.resources.Errors;
-import org.apache.sis.internal.referencing.AxisDirections;
+import org.apache.sis.internal.metadata.AxisDirections;
 import org.apache.sis.referencing.operation.matrix.Matrices;
 import org.apache.sis.referencing.operation.matrix.MatrixSIS;
 
@@ -68,7 +68,8 @@ public final class CoordinateSystems ext
      *   <li>Inter-cardinal directions <cite>"north-east"</cite> and <cite>"south-south-east"</cite>,
      *       using either {@code '-'}, {@code '_'} or spaces as separator between the cardinal points.</li>
      *   <li>Directions from a pole like <cite>"South along 180 deg"</cite> and <cite>"South along 90° East"</cite>,
-     *       using either the {@code "deg"} or {@code "°"} symbol.</li>
+     *       using either the {@code "deg"} or {@code "°"} symbol. Note that the meridian is not necessarily relative
+     *       to Greenwich (see {@link #directionAlongMeridian directionAlongMeridian(…)} for more information).</li>
      * </ul>
      *
      * @param  name The direction name (e.g. "north", "north-east", <i>etc.</i>).
@@ -101,6 +102,33 @@ public final class CoordinateSystems ext
     }
 
     /**
+     * Returns an axis direction from a pole along a meridian.
+     * The given meridian is usually, but not necessarily, relative to the Greenwich meridian.
+     *
+     * <div class="note"><b>Example:</b>
+     * {@code directionAlongMeridian(AxisDirection.SOUTH, -90)} returns an axis direction for
+     * <cite>“South along 90°W”</cite>.</div>
+     *
+     * <div class="section">Reference meridian</div>
+     * The reference meridian depends on the context. It is usually the prime meridian of the
+     * {@linkplain org.apache.sis.referencing.datum.DefaultGeodeticDatum geodetic datum} of the
+     * {@linkplain org.apache.sis.referencing.crs.DefaultGeographicCRS geographic CRS} instance
+     * that contains (through its coordinate system) the axes having those directions.
+     * This policy is consistent with
+     * <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#40">WKT 2 specification §7.5.4(iv)</a>.
+     *
+     * @param  baseDirection The base direction, which must be {@link AxisDirection#NORTH} or {@link AxisDirection#SOUTH}.
+     * @param  meridian The meridian in degrees, relative to a unspecified (usually Greenwich) prime meridian.
+     *         Meridians in the East hemisphere are positive and meridians in the West hemisphere are negative.
+     * @return The axis direction along the given meridian.
+     *
+     * @since 0.6
+     */
+    public static AxisDirection directionAlongMeridian(final AxisDirection baseDirection, final double meridian) {
+        return new DirectionAlongMeridian(baseDirection, meridian).getDirection();
+    }
+
+    /**
      * Returns the arithmetic (counterclockwise) angle from the first axis direction to the second direction.
      * This method returns a value between -180° and +180°, or {@code null} if no angle can be computed.
      *
@@ -114,6 +142,11 @@ public final class CoordinateSystems ext
      *   <li>The angle from <cite>"North along 90° East"</cite> to <cite>"North along 0°"</cite> is 90°.</li>
      * </ul>
      *
+     * <div class="note"><b>Note:</b>
+     * in the case of directions like <cite>“South along 90°W”</cite>, the caller is responsible to make sure
+     * that the meridians are relative to the same prime meridian. This is the case if the axes are part of
+     * the same {@code CoordinateSystem} instance.</div>
+     *
      * <div class="section">Horizontal and vertical directions</div>
      * By convention this method defines the angle from any compass direction to the {@link AxisDirection#UP UP}
      * vertical direction as 90°, and the angle of any compass direction to the {@link AxisDirection#DOWN DOWN}

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultAffineCS.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -24,7 +24,7 @@ import org.opengis.referencing.cs.Affine
 import org.opengis.referencing.cs.CartesianCS;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.referencing.AxisDirections;
+import org.apache.sis.internal.metadata.AxisDirections;
 import org.apache.sis.measure.Units;
 
 

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCompoundCS.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -20,7 +20,7 @@ import java.util.Map;
 import java.util.List;
 import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.referencing.AxisDirections;
+import org.apache.sis.internal.metadata.AxisDirections;
 import org.apache.sis.internal.util.UnmodifiableArrayList;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.Workaround;

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=1687826&r1=1687825&r2=1687826&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 Jun 26 18:03:38 2015
@@ -30,7 +30,6 @@ import javax.xml.bind.annotation.XmlRoot
 import org.opengis.util.GenericName;
 import org.opengis.util.InternationalString;
 import org.opengis.metadata.Identifier;
-import org.opengis.referencing.crs.GeodeticCRS;
 import org.opengis.referencing.cs.RangeMeaning;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.PolarCS;
@@ -40,7 +39,7 @@ import org.opengis.referencing.cs.Coordi
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.apache.sis.internal.metadata.AxisNames;
 import org.apache.sis.internal.metadata.WKTKeywords;
-import org.apache.sis.internal.referencing.AxisDirections;
+import org.apache.sis.internal.metadata.AxisDirections;
 import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.referencing.AbstractIdentifiedObject;
 import org.apache.sis.referencing.IdentifiedObjects;
@@ -55,7 +54,7 @@ import org.apache.sis.internal.jaxb.Cont
 import org.apache.sis.io.wkt.Formatter;
 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.Transliterator;
 import org.apache.sis.io.wkt.FormattableObject;
 
 import static java.lang.Double.doubleToLongBits;
@@ -736,16 +735,6 @@ public class DefaultCoordinateSystemAxis
     }
 
     /**
-     * Returns {@code true} if writing an axis in the given formatter should omit the axis name.
-     * From ISO 19162: For geodetic CRSs having a geocentric Cartesian coordinate system,
-     * the axis name should be omitted as it is given through the mandatory axis direction,
-     * but the axis abbreviation, respectively ‘X’, 'Y' and ‘Z’, shall be given.
-     */
-    private boolean omitName(final Formatter formatter) {
-        return AxisDirections.isGeocentric(direction) && formatter.getEnclosingElement(1) instanceof GeodeticCRS;
-    }
-
-    /**
      * Returns the enclosing coordinate system, or {@code null} if none. In ISO 19162 compliant WKT the coordinate
      * <strong>reference</strong> system should be the first parent ({@code formatter.getEnclosingElement(1)}) and
      * the coordinate system shall be obtained from that CRS (yes, this is convolved. This is because of historical
@@ -770,7 +759,7 @@ public class DefaultCoordinateSystemAxis
      * Most of those constraints are inherited from ISO 19111 — see {@link CoordinateSystemAxis} javadoc for some of
      * those. The current Apache SIS implementation does not verify whether this axis name and abbreviation are
      * compliant; we assume that the user created a valid axis.
-     * The only actions (derived from ISO 19162 rules) taken by this method are:
+     * The only actions (derived from ISO 19162 rules) taken by this method (by default) are:
      *
      * <ul>
      *   <li>Replace <cite>“Geodetic latitude”</cite> and <cite>“Geodetic longitude”</cite> names (case insensitive)
@@ -782,32 +771,29 @@ public class DefaultCoordinateSystemAxis
      *   <li>In {@link PolarCS}, replace “θ” abbreviation by <var>“U”</var>.</li>
      * </ul>
      *
-     * The above-cited replacements of Greek letters can be modified by calls to
-     * {@link org.apache.sis.io.wkt.WKTFormat#setCharEncoding(CharEncoding)}.
+     * The above-cited replacements of name and Greek letters can be controlled by a call to
+     * {@link org.apache.sis.io.wkt.WKTFormat#setTransliterator(Transliterator)}.
      *
      * @return {@code "Axis"}.
      *
-     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#39">WKT 2 specification</a>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#39">WKT 2 specification §7.5.3</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {
         final Convention convention = formatter.getConvention();
         final boolean    isWKT1     = (convention.majorVersion() == 1);
         final boolean    isInternal = (convention == Convention.INTERNAL);
-        String name = null;
-        if (isWKT1 || isInternal || !omitName(formatter)) {
-            name = IdentifiedObjects.getName(this, formatter.getNameAuthority());
-            if (name == null) {
-                name = IdentifiedObjects.getName(this, null);
-            }
-            if (name != null && !isInternal) {
-                if (name.equalsIgnoreCase(AxisNames.GEODETIC_LATITUDE)) {
-                    name = AxisNames.LATITUDE;    // ISO 19162:2015 §7.5.3(ii)
-                } else if (name.equalsIgnoreCase(AxisNames.GEODETIC_LONGITUDE)) {
-                    name = AxisNames.LONGITUDE;
-                }
-                // Note: the converse of this operation is done in
-                // org.apache.sis.io.wkt.GeodeticObjectParser.parseAxis(…).
+        final CoordinateSystem cs   = getEnclosingCS(formatter);
+        AxisDirection dir = getDirection();
+        String name = IdentifiedObjects.getName(this, formatter.getNameAuthority());
+        if (name == null) {
+            name = IdentifiedObjects.getName(this, null);
+        }
+        if (name != null && !isInternal) {
+            final String old = name;
+            name = formatter.getTransliterator().toShortAxisName(cs, dir, name);
+            if (name == null && isWKT1) {
+                name = old; // WKT 1 does not allow omission of name.
             }
         }
         /*
@@ -815,12 +801,8 @@ public class DefaultCoordinateSystemAxis
          * The specification also suggests to write only the abbreviation (e.g. "(X)") in the
          * special case of Geocentric axis, and disallows Greek letters.
          */
-        final CoordinateSystem cs;
-        if (isWKT1) {
-            cs = null;
-        } else {
-            cs = getEnclosingCS(formatter);
-            final String a = formatter.getCharEncoding().getAbbreviation(cs, this);
+        if (!isWKT1) {
+            final String a = formatter.getTransliterator().toLatinAbbreviation(cs, dir, getAbbreviation());
             if (a != null && !a.equals(name)) {
                 final StringBuilder buffer = new StringBuilder();
                 if (name != null) {
@@ -829,14 +811,11 @@ public class DefaultCoordinateSystemAxis
                 name = buffer.append('(').append(a).append(')').toString();
             }
         }
-        if (name != null) {
-            formatter.append(name, ElementKind.AXIS);
-        }
+        formatter.append(name, ElementKind.AXIS);
         /*
          * Format the axis direction, optionally followed by a MERIDIAN[…] element
          * if the direction is of the kind "South along 90°N" for instance.
          */
-        AxisDirection dir = getDirection();
         DirectionAlongMeridian meridian = null;
         if (!isWKT1 && AxisDirections.isUserDefined(dir)) {
             meridian = DirectionAlongMeridian.parse(dir);

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCylindricalCS.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -23,7 +23,7 @@ import javax.xml.bind.annotation.XmlRoot
 import org.opengis.referencing.cs.CylindricalCS;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.referencing.AxisDirections;
+import org.apache.sis.internal.metadata.AxisDirections;
 import org.apache.sis.measure.Units;
 
 

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=1687826&r1=1687825&r2=1687826&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 Jun 26 18:03:38 2015
@@ -23,7 +23,7 @@ import javax.xml.bind.annotation.XmlRoot
 import org.opengis.referencing.cs.EllipsoidalCS;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.referencing.AxisDirections;
+import org.apache.sis.internal.metadata.AxisDirections;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.measure.Units;
 

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultLinearCS.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -23,7 +23,7 @@ import javax.xml.bind.annotation.XmlRoot
 import org.opengis.referencing.cs.LinearCS;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.referencing.AxisDirections;
+import org.apache.sis.internal.metadata.AxisDirections;
 import org.apache.sis.measure.Units;
 
 

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultPolarCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultPolarCS.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultPolarCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultPolarCS.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -23,7 +23,7 @@ import javax.xml.bind.annotation.XmlRoot
 import org.opengis.referencing.cs.PolarCS;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.referencing.AxisDirections;
+import org.apache.sis.internal.metadata.AxisDirections;
 import org.apache.sis.measure.Units;
 
 

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=1687826&r1=1687825&r2=1687826&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 Jun 26 18:03:38 2015
@@ -23,7 +23,7 @@ import javax.xml.bind.annotation.XmlRoot
 import org.opengis.referencing.cs.SphericalCS;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.referencing.AxisDirections;
+import org.apache.sis.internal.metadata.AxisDirections;
 import org.apache.sis.measure.Units;
 
 

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultTimeCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultTimeCS.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultTimeCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultTimeCS.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -24,7 +24,7 @@ import javax.xml.bind.annotation.XmlRoot
 import org.opengis.referencing.cs.TimeCS;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.referencing.AxisDirections;
+import org.apache.sis.internal.metadata.AxisDirections;
 import org.apache.sis.measure.Units;
 
 

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=1687826&r1=1687825&r2=1687826&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 Jun 26 18:03:38 2015
@@ -24,7 +24,7 @@ import javax.xml.bind.annotation.XmlRoot
 import org.opengis.referencing.cs.VerticalCS;
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.referencing.AxisDirections;
+import org.apache.sis.internal.metadata.AxisDirections;
 
 
 /**

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=1687826&r1=1687825&r2=1687826&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 Jun 26 18:03:38 2015
@@ -23,10 +23,13 @@ import org.opengis.referencing.cs.AxisDi
 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.AxisDirections;
 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.ArgumentChecks;
+import org.apache.sis.util.logging.Logging;
+import org.apache.sis.util.resources.Errors;
 
 
 /**
@@ -44,7 +47,7 @@ import org.apache.sis.io.wkt.Formatter;
  *
  * @author  Martin Desruisseaux (IRD)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  */
 final class DirectionAlongMeridian extends FormattableObject implements Comparable<DirectionAlongMeridian> {
@@ -64,12 +67,8 @@ final class DirectionAlongMeridian exten
      * The base directions we are interested in.
      * Any direction not in this group will be rejected by our parser.
      */
-    private static final AxisDirection[] BASE_DIRECTIONS = {
-        AxisDirection.NORTH,
-        AxisDirection.SOUTH,
-        AxisDirection.EAST,
-        AxisDirection.WEST
-    };
+    private static final AxisDirection[] NORTH_SOUTH = {AxisDirection.NORTH, AxisDirection.SOUTH},
+                                         EAST_WEST   = {AxisDirection.EAST,  AxisDirection.WEST};
 
     /**
      * The direction. Will be created only when first needed.
@@ -84,14 +83,25 @@ final class DirectionAlongMeridian exten
     public final AxisDirection baseDirection;
 
     /**
-     * The meridian, in degrees.
+     * The meridian in degrees, relative to a unspecified (usually Greenwich) prime meridian.
+     * Meridians in the East hemisphere are positive and meridians in the West hemisphere are negative.
      */
     public final double meridian;
 
     /**
      * Creates a direction.
-     */
-    private DirectionAlongMeridian(final AxisDirection baseDirection, final double meridian) {
+     *
+     * @param baseDirection The base direction, which must be {@link AxisDirection#NORTH} or {@link AxisDirection#SOUTH}.
+     * @param  meridian The meridian in degrees, relative to a unspecified (usually Greenwich) prime meridian.
+     *         Meridians in the East hemisphere are positive and meridians in the West hemisphere are negative.
+     */
+    DirectionAlongMeridian(final AxisDirection baseDirection, final double meridian) {
+        ArgumentChecks.ensureNonNull("baseDirection", baseDirection);
+        if (!AxisDirection.NORTH.equals(baseDirection) && !AxisDirection.SOUTH.equals(baseDirection)) {
+            throw new IllegalArgumentException(Errors.format(
+                    Errors.Keys.IllegalArgumentValue_2, "baseDirection", baseDirection));
+        }
+        ArgumentChecks.ensureBetween("meridian", Longitude.MIN_VALUE, Longitude.MAX_VALUE, meridian);
         this.baseDirection = baseDirection;
         this.meridian      = meridian;
     }
@@ -103,7 +113,13 @@ final class DirectionAlongMeridian exten
      * for avoiding {@code DirectionAlongMeridian} initialization in the common case where it is not needed.</p>
      */
     public static DirectionAlongMeridian parse(final AxisDirection direction) {
-        final DirectionAlongMeridian candidate = parse(direction.name());
+        final DirectionAlongMeridian candidate;
+        try {
+            candidate = parse(direction.name());
+        } catch (IllegalArgumentException e) {
+            Logging.recoverableException(DirectionAlongMeridian.class, "parse", e);
+            return null;
+        }
         if (candidate != null) {
             candidate.direction = direction;
         }
@@ -113,44 +129,30 @@ final class DirectionAlongMeridian exten
     /**
      * If the specified name is a direction along some specific meridian,
      * returns information about that. Otherwise returns {@code null}.
+     *
+     * @param  name The name to parse.
+     * @return The parsed name, or {@code null} if it is not a direction along a meridian.
+     * @throws IllegalArgumentException if the given name looks like a direction along a meridian,
+     *         but an error occurred during parsing.
      */
-    public static DirectionAlongMeridian parse(final String name) {
+    public static DirectionAlongMeridian parse(final String name) throws IllegalArgumentException {
         final Matcher m = EPSG.matcher(name);
         if (!m.matches()) {
             // Not the expected pattern.
             return null;
         }
-        String group = m.group(1);
-        final AxisDirection baseDirection = AxisDirections.find(group, BASE_DIRECTIONS);
-        if (baseDirection == null || !AxisDirection.NORTH.equals(AxisDirections.absolute(baseDirection))) {
-            // We expected "North" or "South" direction.
+        final AxisDirection baseDirection = AxisDirections.find(m.group(1), NORTH_SOUTH);
+        if (baseDirection == null) { // We require "North" or "South" direction.
             return null;
         }
-        group = m.group(2);
-        double meridian;
-        try {
-            meridian = Double.parseDouble(group);
-        } catch (NumberFormatException exception) {
-            // Not a legal axis direction. Just ignore the exception,
-            // since we are supposed to return 'null' in this situation.
-            return null;
-        }
-        if (!(meridian >= Longitude.MIN_VALUE && meridian <= Longitude.MAX_VALUE)) {
-            // Meridian is NaN or is not in the valid range.
-            return null;
-        }
-        group = m.group(3);
+        double meridian = Double.parseDouble(m.group(2));
+        final String group = m.group(3);
         if (group != null) {
-            final AxisDirection sgn = AxisDirections.find(group, BASE_DIRECTIONS);
-            if (sgn == null) {
-                return null;
-            }
-            final AxisDirection abs = AxisDirections.absolute(sgn);
-            if (!AxisDirection.EAST.equals(abs)) {
-                // We expected "East" or "West" direction.
+            final AxisDirection sgn = AxisDirections.find(group, EAST_WEST);
+            if (sgn == null) {  // We require "East" or "West" direction.
                 return null;
             }
-            if (sgn != abs) {
+            if (sgn != AxisDirections.absolute(sgn)) {
                 meridian = -meridian;
             }
         }
@@ -294,7 +296,7 @@ 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>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#40">WKT 2 specification §7.5.4</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -26,7 +26,7 @@ import org.opengis.referencing.cs.RangeM
 import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.internal.referencing.AxisDirections;
+import org.apache.sis.internal.metadata.AxisDirections;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.CharSequences;

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/AbstractDatum.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -280,8 +280,7 @@ public class AbstractDatum extends Abstr
      *       {@linkplain DefaultTemporalDatum#getOrigin() origin} instead.</li>
      * </ul>
      *
-     * @return Description, possibly including coordinates, of the point or points used to anchor the datum
-     *         to the Earth.
+     * @return Description, possibly including coordinates, of the point or points used to anchor the datum to the Earth.
      */
     @Override
     public InternationalString getAnchorPoint() {

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=1687826&r1=1687825&r2=1687826&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 Jun 26 18:03:38 2015
@@ -759,7 +759,7 @@ public class DefaultEllipsoid extends Ab
      *
      * @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>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#52">WKT 2 specification §8.2.1</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {

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=1687826&r1=1687825&r2=1687826&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 Jun 26 18:03:38 2015
@@ -170,7 +170,7 @@ public class DefaultEngineeringDatum ext
      *
      * @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>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#76">WKT 2 specification §11.2</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {

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=1687826&r1=1687825&r2=1687826&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 Jun 26 18:03:38 2015
@@ -26,6 +26,7 @@ import org.opengis.util.GenericName;
 import org.opengis.util.InternationalString;
 import org.opengis.metadata.extent.Extent;
 import org.opengis.referencing.ReferenceIdentifier;
+import org.opengis.referencing.crs.GeodeticCRS;
 import org.opengis.referencing.datum.Ellipsoid;
 import org.opengis.referencing.datum.PrimeMeridian;
 import org.opengis.referencing.datum.GeodeticDatum;
@@ -535,16 +536,17 @@ public class DefaultGeodeticDatum extend
      * Note that the {@linkplain #getPrimeMeridian() prime meridian} shall be formatted by the caller
      * as a separated element after the geodetic datum (for compatibility with WKT 1).
      *
-     * @return {@code "Datum"}.
+     * @return {@code "Datum"} or {@code "GeodeticDatum"}.
      *
-     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#51">WKT 2 specification</a>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#51">WKT 2 specification §8.2</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {
         super.formatTo(formatter);
         formatter.newLine();
         formatter.append(toFormattable(getEllipsoid()));
-        if (formatter.getConvention().majorVersion() == 1) {
+        final boolean isWKT1 = formatter.getConvention().majorVersion() == 1;
+        if (isWKT1) {
             /*
              * Note that at the different of other datum (in particular vertical datum),
              * WKT of geodetic datum do not have a numerical code for the datum type.
@@ -560,7 +562,19 @@ 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.
+        if (!isWKT1) {
+            /*
+             * In WKT 2, both "Datum" and "GeodeticDatum" keywords are permitted. The standard recommends
+             * to use "Datum" for simplicity. We will follow this advice when the Datum element is inside
+             * a GeodeticCRS element since the "Geodetic" aspect is more obvious in such case. But if the
+             * Datum appears in another context, then we will use "GeodeticDatum" for clarity.
+             */
+            if (!(formatter.getEnclosingElement(1) instanceof GeodeticCRS)) {
+                return WKTKeywords.GeodeticDatum;
+            }
+        }
         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=1687826&r1=1687825&r2=1687826&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 Jun 26 18:03:38 2015
@@ -241,7 +241,7 @@ public class DefaultImageDatum extends A
      *
      * @return {@code "ImageDatum"}.
      *
-     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#81">WKT 2 specification</a>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#81">WKT 2 specification §12.2</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {

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=1687826&r1=1687825&r2=1687826&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 Jun 26 18:03:38 2015
@@ -393,7 +393,7 @@ public class DefaultPrimeMeridian extend
      *
      * @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>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#53">WKT 2 specification §8.2.2</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {

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=1687826&r1=1687825&r2=1687826&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 Jun 26 18:03:38 2015
@@ -287,7 +287,7 @@ public class DefaultTemporalDatum extend
      *
      * @return {@code "TimeDatum"}.
      *
-     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#90">WKT 2 specification</a>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#90">WKT 2 specification §14.2</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {

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=1687826&r1=1687825&r2=1687826&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 Jun 26 18:03:38 2015
@@ -319,7 +319,7 @@ public class DefaultVerticalDatum extend
      *
      * @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>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#71">WKT 2 specification §10.2</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -740,7 +740,7 @@ check:      for (int isTarget=0; ; isTar
      * @param  formatter The formatter to use.
      * @return {@code "CoordinateOperation"}.
      *
-     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#113">WKT 2 specification</a>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#113">WKT 2 specification §17</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultOperationMethod.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -643,7 +643,7 @@ public class DefaultOperationMethod exte
      *
      * @return {@code "Method"} (WKT 2) or {@code "Projection"} (WKT 1).
      *
-     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#118">WKT 2 specification</a>
+     * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#118">WKT 2 specification §17.2.3</a>
      */
     @Override
     protected String formatTo(final Formatter formatter) {

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/Matrices.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -29,7 +29,7 @@ import org.apache.sis.util.ComparisonMod
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.internal.util.Numerics;
-import org.apache.sis.internal.referencing.AxisDirections;
+import org.apache.sis.internal.metadata.AxisDirections;
 import org.apache.sis.internal.referencing.ExtendedPrecisionMatrix;
 
 // Branch-dependent imports

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ReferencingUtilitiesTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ReferencingUtilitiesTest.java?rev=1687826&r1=1687825&r2=1687826&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ReferencingUtilitiesTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/ReferencingUtilitiesTest.java [UTF-8] Fri Jun 26 18:03:38 2015
@@ -25,6 +25,7 @@ import org.opengis.referencing.datum.Pri
 import org.apache.sis.referencing.datum.DefaultPrimeMeridian;
 import org.apache.sis.referencing.datum.HardCodedDatum;
 import org.apache.sis.referencing.crs.HardCodedCRS;
+import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.util.Utilities;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
@@ -110,16 +111,16 @@ public final strictfp class ReferencingU
      */
     @Test
     public void testType() {
-        assertNull  (               toWKTType(CoordinateSystem.class, CoordinateSystem.class));
-        assertEquals("affine",      toWKTType(CoordinateSystem.class, AffineCS        .class));
-        assertEquals("Cartesian",   toWKTType(CoordinateSystem.class, CartesianCS     .class));
-        assertEquals("cylindrical", toWKTType(CoordinateSystem.class, CylindricalCS   .class));
-        assertEquals("ellipsoidal", toWKTType(CoordinateSystem.class, EllipsoidalCS   .class));
-        assertEquals("linear",      toWKTType(CoordinateSystem.class, LinearCS        .class));
-//      assertEquals("parametric",  toWKTType(CoordinateSystem.class, ParametricCS    .class));
-        assertEquals("polar",       toWKTType(CoordinateSystem.class, PolarCS         .class));
-        assertEquals("spherical",   toWKTType(CoordinateSystem.class, SphericalCS     .class));
-        assertEquals("temporal",    toWKTType(CoordinateSystem.class, TimeCS          .class));
-        assertEquals("vertical",    toWKTType(CoordinateSystem.class, VerticalCS      .class));
+        assertNull  (                         toWKTType(CoordinateSystem.class, CoordinateSystem.class));
+        assertEquals(WKTKeywords.affine,      toWKTType(CoordinateSystem.class, AffineCS        .class));
+        assertEquals(WKTKeywords.Cartesian,   toWKTType(CoordinateSystem.class, CartesianCS     .class));
+        assertEquals(WKTKeywords.cylindrical, toWKTType(CoordinateSystem.class, CylindricalCS   .class));
+        assertEquals(WKTKeywords.ellipsoidal, toWKTType(CoordinateSystem.class, EllipsoidalCS   .class));
+        assertEquals(WKTKeywords.linear,      toWKTType(CoordinateSystem.class, LinearCS        .class));
+//      assertEquals(WKTKeywords.parametric,  toWKTType(CoordinateSystem.class, ParametricCS    .class));
+        assertEquals(WKTKeywords.polar,       toWKTType(CoordinateSystem.class, PolarCS         .class));
+        assertEquals(WKTKeywords.spherical,   toWKTType(CoordinateSystem.class, SphericalCS     .class));
+        assertEquals(WKTKeywords.temporal,    toWKTType(CoordinateSystem.class, TimeCS          .class));
+        assertEquals(WKTKeywords.vertical,    toWKTType(CoordinateSystem.class, VerticalCS      .class));
     }
 }