sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1701645 [1/2] - in /sis/trunk: ./ application/sis-console/src/main/java/org/apache/sis/console/ core/sis-metadata/src/main/java/org/apache/sis/io/wkt/ core/sis-metadata/src/test/java/org/apache/sis/io/wkt/ core/sis-metadata/src/test/java/o...
Date Mon, 07 Sep 2015 15:48:25 GMT
Author: desruisseaux
Date: Mon Sep  7 15:48:24 2015
New Revision: 1701645

URL: http://svn.apache.org/r1701645
Log:
Merge from the JDK6 branch.

Added:
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/KeywordStyle.java
      - copied unchanged from r1701642, sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/KeywordStyle.java
Modified:
    sis/trunk/   (props changed)
    sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/MetadataSC.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Convention.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
    sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/FormatterTest.java
    sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralOperationParameter.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultVerticalCRS.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEngineeringDatum.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultImageDatum.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultPrimeMeridian.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultTemporalDatum.java
    sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultVerticalDatum.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/LongitudeRotationTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorValuesTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultDerivedCRSTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultEngineeringCRSTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultImageCRSTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultTemporalCRSTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultVerticalCRSTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DirectionAlongMeridianTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultEllipsoidTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultGeodeticDatumTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultPrimeMeridianTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultVerticalDatumTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultFormulaTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultOperationMethodTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultTransformationTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/EquirectangularTest.java
    sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/ContextualParametersTest.java
    sis/trunk/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java

Propchange: sis/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep  7 15:48:24 2015
@@ -1,4 +1,4 @@
 /sis/branches/Android:1430670-1480699
-/sis/branches/JDK6:1394364-1701523
-/sis/branches/JDK7:1394913-1701522
-/sis/branches/JDK8:1584960-1701521
+/sis/branches/JDK6:1394364-1701642
+/sis/branches/JDK7:1394913-1701639
+/sis/branches/JDK8:1584960-1701637

Modified: sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/MetadataSC.java
URL: http://svn.apache.org/viewvc/sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/MetadataSC.java?rev=1701645&r1=1701644&r2=1701645&view=diff
==============================================================================
--- sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/MetadataSC.java [UTF-8] (original)
+++ sis/trunk/application/sis-console/src/main/java/org/apache/sis/console/MetadataSC.java [UTF-8] Mon Sep  7 15:48:24 2015
@@ -51,6 +51,13 @@ import org.apache.sis.xml.XML;
  */
 final class MetadataSC extends SubCommand {
     /**
+     * The output format.
+     */
+    private static enum Format {
+        TEXT, WKT, XML
+    }
+
+    /**
      * {@code true} for the {@code "crs"} sub-command,
      * or {@code false} for the {@code "metadata"} sub-command.
      */
@@ -81,24 +88,27 @@ final class MetadataSC extends SubComman
          * Output format can be either "text" (the default) or "xml".
          * In the case of "crs" sub-command, we accept also WKT variants.
          */
-        boolean toXML = false;
-        Convention wkt = null;
+        Convention convention = null;
+        final Format outputFormat;
         final String format = options.get(Option.FORMAT);
-        if (format != null && !format.equalsIgnoreCase("text")) {
-            toXML = format.equalsIgnoreCase("xml");
-            if (!toXML) {
-                if (isCRS) {
-                    if (format.equalsIgnoreCase("wkt") || format.equalsIgnoreCase("wkt2")) {
-                        wkt = Convention.WKT2;
-                    } else if (format.equalsIgnoreCase("wkt1")) {
-                        wkt = Convention.WKT1;
-                    }
-                }
-                if (wkt == null) {
-                    throw new InvalidOptionException(Errors.format(
-                            Errors.Keys.IllegalOptionValue_2, "format", format), format);
-                }
+        if (format == null || format.equalsIgnoreCase("text")) {
+            if (isCRS) {
+                outputFormat = Format.WKT;
+                convention = Convention.WKT2_SIMPLIFIED;
+            } else {
+                outputFormat = Format.TEXT;
             }
+        } else if (isCRS && (format.equalsIgnoreCase("wkt") || format.equalsIgnoreCase("wkt2"))) {
+            outputFormat = Format.WKT;
+            convention = Convention.WKT2;
+        } else if (isCRS && format.equalsIgnoreCase("wkt1")) {
+            outputFormat = Format.WKT;
+            convention = Convention.WKT1;
+        } else if (format.equalsIgnoreCase("xml")) {
+            outputFormat = Format.XML;
+        } else {
+            throw new InvalidOptionException(Errors.format(
+                    Errors.Keys.IllegalOptionValue_2, "format", format), format);
         }
         /*
          * Read metadata from the data storage.
@@ -117,47 +127,60 @@ final class MetadataSC extends SubComman
         if (metadata == null) {
             return 0;
         }
-        CoordinateReferenceSystem crs = null;
+        Object object = metadata;
         if (isCRS) {
+            boolean found = false;
             for (final ReferenceSystem rs : metadata.getReferenceSystemInfo()) {
                 if (rs instanceof CoordinateReferenceSystem) {
-                    crs = (CoordinateReferenceSystem) rs;
+                    object = (CoordinateReferenceSystem) rs;
+                    found = true;
                     break;
                 }
             }
-            if (crs == null) {
+            if (!found) {
                 return 0;
             }
         }
         /*
          * Format metadata to the standard output stream.
          */
-        if (toXML) {
-            final MarshallerPool pool = new MarshallerPool(null);
-            final Marshaller marshaller = pool.acquireMarshaller();
-            marshaller.setProperty(XML.LOCALE,   locale);
-            marshaller.setProperty(XML.TIMEZONE, timezone);
-            if (isConsole()) {
-                marshaller.marshal(crs != null ? crs : metadata, out);
-            } else {
-                out.flush();
-                marshaller.setProperty(Marshaller.JAXB_ENCODING, encoding.name());
-                marshaller.marshal(crs != null ? crs : metadata, System.out); // Use OutputStream instead than Writer.
-                System.out.flush();
-            }
-        } else if (wkt != null) {
-            final WKTFormat f = new WKTFormat(locale, timezone);
-            f.setConvention(wkt);
-            if (colors) {
-                f.setColors(Colors.DEFAULT);
+        switch (outputFormat) {
+            case TEXT: {
+                final TreeTable tree = MetadataStandard.ISO_19115.asTreeTable(metadata, ValueExistencePolicy.NON_EMPTY);
+                final TreeTableFormat tf = new TreeTableFormat(locale, timezone);
+                tf.setColumns(TableColumn.NAME, TableColumn.VALUE);
+                tf.format(tree, out);
+                break;
+            }
+
+            case WKT: {
+                final WKTFormat f = new WKTFormat(locale, timezone);
+                if (convention != null) {
+                    f.setConvention(convention);
+                }
+                if (colors) {
+                    f.setColors(Colors.DEFAULT);
+                }
+                f.format(object, out);
+                out.println();
+                break;
+            }
+
+            case XML: {
+                final MarshallerPool pool = new MarshallerPool(null);
+                final Marshaller marshaller = pool.acquireMarshaller();
+                marshaller.setProperty(XML.LOCALE,   locale);
+                marshaller.setProperty(XML.TIMEZONE, timezone);
+                if (isConsole()) {
+                    marshaller.marshal(object, out);
+                } else {
+                    out.flush();
+                    marshaller.setProperty(Marshaller.JAXB_ENCODING, encoding.name());
+                    marshaller.marshal(object, System.out); // Use OutputStream instead than Writer.
+                    System.out.flush();
+                }
+                break;
             }
-            f.format(crs, out);
-            out.println();
-        } else {
-            final TreeTable tree = MetadataStandard.ISO_19115.asTreeTable(metadata, ValueExistencePolicy.NON_EMPTY);
-            final TreeTableFormat tf = new TreeTableFormat(locale, timezone);
-            tf.setColumns(TableColumn.NAME, TableColumn.VALUE);
-            tf.format(tree, out);
         }
         out.flush();
         return 0;

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Convention.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Convention.java?rev=1701645&r1=1701644&r2=1701645&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Convention.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Convention.java [UTF-8] Mon Sep  7 15:48:24 2015
@@ -70,13 +70,16 @@ public enum Convention {
      *
      * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html">WKT 2 specification</a>
      */
-    WKT2(false, false),
+    WKT2(false, true, false),
 
     /**
      * The ISO 19162 format with omission of some optional elements. This convention is identical
      * to the {@link #WKT2} convention except for the following aspects:
      *
      * <ul>
+     *   <li>By {@linkplain KeywordStyle#DEFAULT default} long keywords are used instead of short ones
+     *       (e.g. {@code "GeodeticCRS"} instead of {@code "GeodCRS"}) except for the {@code "Unit"} keyword,
+     *       because they match the class or interface names.</li>
      *   <li>{@code PrimeMeridian} element omitted if the meridian is Greenwich.</li>
      *   <li>{@code Axis} element omits the {@code Order} sub-element.</li>
      *   <li>{@code Unit} elements are less verbose:<ul>
@@ -99,7 +102,7 @@ public enum Convention {
      *
      * <p>This is the default convention used by {@link FormattableObject#toString()}.</p>
      */
-    WKT2_SIMPLIFIED(false, false),
+    WKT2_SIMPLIFIED(false, false, false),
 
     /**
      * The OGC 01-009 format, also known as “WKT 1”.
@@ -139,7 +142,7 @@ public enum Convention {
      *
      * @see <a href="http://www.geoapi.org/3.0/javadoc/org/opengis/referencing/doc-files/WKT.html">Legacy WKT 1</a>
      */
-    WKT1(true, false),
+    WKT1(true, true, false),
 
     /**
      * The <cite>Simple Feature</cite> format, also known as “WKT 1”.
@@ -156,7 +159,7 @@ public enum Convention {
      *       (e.g. <cite>"meter"</cite> instead than <cite>"metre"</cite>).</li>
      * </ul>
      */
-    WKT1_COMMON_UNITS(true, true),
+    WKT1_COMMON_UNITS(true, true, true),
 
     /**
      * The <cite>Simple Feature</cite> format without parsing of axis elements.
@@ -173,7 +176,7 @@ public enum Convention {
      *
      * @since 0.6
      */
-    WKT1_IGNORE_AXES(true, true),
+    WKT1_IGNORE_AXES(true, true, true),
 
     /**
      * A special convention for formatting objects as stored internally by Apache SIS.
@@ -204,7 +207,7 @@ public enum Convention {
      * @see org.apache.sis.referencing.operation.projection.NormalizedProjection#getParameterValues()
      */
     @Debug
-    INTERNAL(false, false);
+    INTERNAL(false, false, false);
 
     /**
      * The default conventions.
@@ -217,6 +220,11 @@ public enum Convention {
     private final boolean isWKT1;
 
     /**
+     * {@code true} for using short upper-case keywords by {@linkplain KeywordStyle#DEFAULT default}.
+     */
+    final boolean toUpperCase;
+
+    /**
      * {@code true} for a frequently-used convention about units instead than the standard one.
      * <ul>
      *   <li>If {@code true}, forces {@code PRIMEM} and {@code PARAMETER} angular units to degrees
@@ -232,8 +240,9 @@ public enum Convention {
     /**
      * Creates a new enumeration value.
      */
-    private Convention(final boolean isWKT1, final boolean usesCommonUnits) {
-        this.isWKT1 = isWKT1;
+    private Convention(final boolean isWKT1, final boolean toUpperCase, final boolean usesCommonUnits) {
+        this.isWKT1          = isWKT1;
+        this.toUpperCase     = toUpperCase;
         this.usesCommonUnits = usesCommonUnits;
     }
 

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java?rev=1701645&r1=1701644&r2=1701645&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/FormattableObject.java [UTF-8] Mon Sep  7 15:48:24 2015
@@ -172,8 +172,14 @@ public abstract class FormattableObject
         if (formatter == null) {
             formatter = new Formatter();
         }
+        /*
+         * Apply the same setting than in 'WKTFormat.updateFormatter(…)'
+         * when KeywordCase and KeywordStyle have their default values.
+         */
         formatter.configure(convention, null, colorize ? Colors.DEFAULT : null,
-                (convention.majorVersion() == 1) ? (byte) 1 : 0, WKTFormat.DEFAULT_INDENTATION);
+                convention.toUpperCase           ? (byte) +1 : 0,
+                (convention.majorVersion() == 1) ? (byte) -1 : 0,
+                WKTFormat.DEFAULT_INDENTATION);
         if (!strict) {
             formatter.transliterator = Transliterator.IDENTITY;
         }

Modified: sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java?rev=1701645&r1=1701644&r2=1701645&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] Mon Sep  7 15:48:24 2015
@@ -255,6 +255,11 @@ public class Formatter implements Locali
     private byte toUpperCase;
 
     /**
+     * {@code -1} for short keywords, {@code +1} for long keywords or 0 for the default.
+     */
+    private byte longKeywords;
+
+    /**
      * Incremented when {@link #setColor(ElementKind)} is invoked, and decremented when {@link #resetColor()}
      * is invoked. Used in order to prevent child elements to overwrite the colors decided by enclosing elements.
      */
@@ -369,20 +374,22 @@ public class Formatter implements Locali
      * Sets the convention, authority, colors and indentation to use for formatting WKT elements.
      * This method does not validate the argument — validation must be done by the caller.
      *
-     * @param convention  The convention, or {@code null} for the default value.
-     * @param authority   The authority, or {@code null} for inferring it from the convention.
-     * @param colors      The syntax coloring, or {@code null} if none.
-     * @param toUpperCase Whether keywords shall be converted to upper cases.
-     * @param indentation The amount of spaces to use in indentation for WKT formatting,
-     *                    or {@link WKTFormat#SINGLE_LINE}.
+     * @param convention    The convention, or {@code null} for the default value.
+     * @param authority     The authority, or {@code null} for inferring it from the convention.
+     * @param colors        The syntax coloring, or {@code null} if none.
+     * @param toUpperCase   Whether keywords shall be converted to upper cases.
+     * @param longKeywords  {@code -1} for short keywords, {@code +1} for long keywords or 0 for the default.
+     * @param indentation   The amount of spaces to use in indentation for WKT formatting,
+     *                      or {@link WKTFormat#SINGLE_LINE}.
      */
     final void configure(Convention convention, final Citation authority, final Colors colors,
-            final byte toUpperCase, final byte indentation)
+            final byte toUpperCase, final byte longKeywords, final byte indentation)
     {
         this.convention     = convention;
         this.authority      = (authority != null) ? authority : convention.getNameAuthority();
         this.colors         = colors;
         this.toUpperCase    = toUpperCase;
+        this.longKeywords   = longKeywords;
         this.indentation    = indentation;
         this.transliterator = (convention == Convention.INTERNAL) ? Transliterator.IDENTITY : Transliterator.DEFAULT;
         unitFormat.isLocaleUS = convention.usesCommonUnits;
@@ -510,6 +517,26 @@ public class Formatter implements Locali
     }
 
     /**
+     * Selects a short or long keyword depending on the {@link KeywordStyle} value.
+     * This method can be used by {@link FormattableObject#formatTo(Formatter)}
+     * implementations for choosing the return value.
+     *
+     * @param  shortKeyword The keyword to return if the style is {@link KeywordStyle#SHORT}.
+     * @param  longKeyword  The keyword to return if the style is {@link KeywordStyle#LONG}.
+     * @return The short or long keyword depending on the keyword style setting.
+     *
+     * @see WKTFormat#setKeywordStyle(KeywordStyle)
+     *
+     * @since 0.6
+     */
+    public String shortOrLong(final String shortKeyword, final String longKeyword) {
+        return (longKeywords != 0
+                ? longKeywords < 0              // If keyword style was explicitely specified, use the setting.
+                : convention.toUpperCase)       // Otherwise use the default value determined by the convention.
+               ? shortKeyword : longKeyword;
+    }
+
+    /**
      * Conditionally appends a separator to the {@linkplain #buffer}, if needed.
      * This method does nothing if there is currently no element at the buffer end.
      */
@@ -1171,9 +1198,10 @@ public class Formatter implements Locali
     }
 
     /**
-     * Appends a unit in a {@code UNIT[…]} element or one of the specialized elements. Specialized elements are
-     * {@code ANGLEUNIT}, {@code LENGTHUNIT}, {@code SCALEUNIT}, {@code PARAMETRICUNIT} and {@code TIMEUNIT}.
-     * Specialization is used in WKT 2 format except the <cite>simplified WKT 2</cite> one.
+     * Appends a unit in a {@code Unit[…]} element or one of the specialized elements. Specialized elements are
+     * {@code AngleUnit}, {@code LengthUnit}, {@code ScaleUnit}, {@code ParametricUnit} and {@code TimeUnit}.
+     * By {@linkplain KeywordStyle#DEFAULT default}, specialized unit keywords are used with the
+     * {@linkplain Convention#WKT2 WKT 2 convention}.
      *
      * <div class="note"><b>Example:</b>
      * {@code append(SI.KILOMETRE)} will append "{@code LengthUnit["km", 1000]}" to the WKT.</div>
@@ -1184,7 +1212,7 @@ public class Formatter implements Locali
      */
     public void append(final Unit<?> unit) {
         if (unit != null) {
-            final boolean isSimplified = convention.isSimplified();
+            final boolean isSimplified = (longKeywords == 0) ? convention.isSimplified() : (longKeywords < 0);
             final boolean isWKT1 = convention.majorVersion() == 1;
             final Unit<?> base = unit.toSI();
             final String keyword;

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=1701645&r1=1701644&r2=1701645&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] Mon Sep  7 15:48:24 2015
@@ -165,6 +165,11 @@ public class WKTFormat extends CompoundF
     private KeywordCase keywordCase;
 
     /**
+     * Whether to use short or long WKT keywords.
+     */
+    private KeywordStyle keywordStyle;
+
+    /**
      * {@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.
@@ -235,15 +240,17 @@ public class WKTFormat extends CompoundF
      */
     public WKTFormat(final Locale locale, final TimeZone timezone) {
         super(locale, timezone);
-        convention  = Convention.DEFAULT;
-        symbols     = Symbols.getDefault();
-        keywordCase = KeywordCase.DEFAULT;
-        indentation = DEFAULT_INDENTATION;
+        convention   = Convention.DEFAULT;
+        symbols      = Symbols.getDefault();
+        keywordCase  = KeywordCase.DEFAULT;
+        keywordStyle = KeywordStyle.DEFAULT;
+        indentation  = DEFAULT_INDENTATION;
     }
 
     /**
      * Returns the {@link #fragments} map, creating it when first needed.
      */
+    @SuppressWarnings("ReturnOfCollectionOrArrayField")
     private Map<String,Element> fragments() {
         if (fragments == null) {
             fragments = new TreeMap<String,Element>();
@@ -254,6 +261,7 @@ public class WKTFormat extends CompoundF
     /**
      * Returns the {@link #factories} map, creating it when first needed.
      */
+    @SuppressWarnings("ReturnOfCollectionOrArrayField")
     private Map<Class<?>,Factory> factories() {
         if (factories == null) {
             factories = new HashMap<Class<?>,Factory>(8);
@@ -382,6 +390,30 @@ public class WKTFormat extends CompoundF
     }
 
     /**
+     * Returns whether to use short or long WKT keywords.
+     *
+     * @return The style used for formatting keywords.
+     *
+     * @since 0.6
+     */
+    public KeywordStyle getKeywordStyle() {
+        return keywordStyle;
+    }
+
+    /**
+     * Sets whether to use short or long WKT keywords.
+     *
+     * @param keywordStyle The style to use for formatting keywords.
+     *
+     * @since 0.6
+     */
+    public void setKeywordStyle(final KeywordStyle keywordStyle) {
+        ArgumentChecks.ensureNonNull("keywordStyle", keywordStyle);
+        this.keywordStyle = keywordStyle;
+        updateFormatter(formatter);
+    }
+
+    /**
      * Returns the colors to use for syntax coloring, or {@code null} if none.
      * By default there is no syntax coloring.
      *
@@ -492,9 +524,15 @@ public class WKTFormat extends CompoundF
                 case LOWER_CASE: toUpperCase = -1; break;
                 case UPPER_CASE: toUpperCase = +1; break;
                 case CAMEL_CASE: toUpperCase =  0; break;
-                default: toUpperCase = (convention.majorVersion() == 1) ? (byte) 1 : 0; break;
+                default: toUpperCase = convention.toUpperCase ? (byte) +1 : 0; break;
+            }
+            final byte longKeywords;
+            switch (keywordStyle) {
+                case SHORT: longKeywords = -1; break;
+                case LONG:  longKeywords = +1; break;
+                default:    longKeywords = (convention.majorVersion() == 1) ? (byte) -1 : 0; break;
             }
-            formatter.configure(convention, authority, colors, toUpperCase, indentation);
+            formatter.configure(convention, authority, colors, toUpperCase, longKeywords, indentation);
             if (transliterator != null) {
                 formatter.transliterator = transliterator;
             }

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/FormatterTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/FormatterTest.java?rev=1701645&r1=1701644&r2=1701645&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/FormatterTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/io/wkt/FormatterTest.java [UTF-8] Mon Sep  7 15:48:24 2015
@@ -76,7 +76,7 @@ public final strictfp class FormatterTes
      */
     @Test
     public void testAppendGeographicBoundingBox() {
-        assertWktEquals(Convention.WKT2, "BBox[51.43, 2.54, 55.77, 6.40]",
+        assertWktEquals(Convention.WKT2_SIMPLIFIED, "BBox[51.43, 2.54, 55.77, 6.40]",
                 new DefaultGeographicBoundingBox(2.54, 6.40, 51.43, 55.77));
         assertWktEquals(Convention.WKT1, "BBOX[51.43, 2.54, 55.77, 6.40]",
                 new DefaultGeographicBoundingBox(2.54, 6.40, 51.43, 55.77));
@@ -88,11 +88,12 @@ public final strictfp class FormatterTes
     @Test
     public void testAppendVerticalExtent() {
         final DefaultVerticalExtent extent = new DefaultVerticalExtent(102, 108, VerticalCRSMock.HEIGHT_ft);
-        assertWktEquals(Convention.WKT2, "VerticalExtent[102, 108, LengthUnit[“ft”, 0.3048]]", extent);
+        assertWktEquals(Convention.WKT2_SIMPLIFIED, "VerticalExtent[102, 108, Unit[“ft”, 0.3048]]", extent);
+        assertWktEquals(Convention.WKT2, "VERTICALEXTENT[102, 108, LENGTHUNIT[“ft”, 0.3048]]", extent);
 
         extent.setMinimumValue(100.2);
         extent.setMaximumValue(100.8);
-        assertWktEquals(Convention.WKT2, "VerticalExtent[100.2, 100.8, LengthUnit[“ft”, 0.3048]]", extent);
+        assertWktEquals(Convention.WKT2, "VERTICALEXTENT[100.2, 100.8, LENGTHUNIT[“ft”, 0.3048]]", extent);
     }
 
     /**
@@ -100,9 +101,9 @@ public final strictfp class FormatterTes
      */
     @Test
     public void testAppendUnit() {
-        assertWktEquals("LengthUnit[“metre”, 1]", SI.METRE);
-        assertWktEquals("AngleUnit[“degree”, 0.017453292519943295]", NonSI.DEGREE_ANGLE);
-        assertWktEquals("ScaleUnit[“parts per million”, 1.0E-6]", Units.PPM);
+        assertWktEquals(Convention.WKT2, "LENGTHUNIT[“metre”, 1]", SI.METRE);
+        assertWktEquals(Convention.WKT2, "ANGLEUNIT[“degree”, 0.017453292519943295]", NonSI.DEGREE_ANGLE);
+        assertWktEquals(Convention.WKT2, "SCALEUNIT[“parts per million”, 1.0E-6]", Units.PPM);
 
         assertWktEquals(Convention.WKT1, "UNIT[“metre”, 1]", SI.METRE);
         assertWktEquals(Convention.WKT1, "UNIT[“degree”, 0.017453292519943295]", NonSI.DEGREE_ANGLE);

Modified: sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java?rev=1701645&r1=1701644&r2=1701645&view=diff
==============================================================================
--- sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/ImmutableIdentifierTest.java [UTF-8] Mon Sep  7 15:48:24 2015
@@ -180,14 +180,16 @@ public final strictfp class ImmutableIde
     @Test
     public void testWKT() {
         ImmutableIdentifier id = new ImmutableIdentifier(Citations.EPSG, "EPSG", "4326", "8.2", null);
-        assertWktEquals(Convention.WKT2, "Id[“EPSG”, 4326, “8.2”]", id);
+        assertWktEquals(Convention.WKT2_SIMPLIFIED, "Id[“EPSG”, 4326, “8.2”]", id);
+        assertWktEquals(Convention.WKT2, "ID[“EPSG”, 4326, “8.2”]", id);
         assertWktEquals(Convention.WKT1, "AUTHORITY[“EPSG”, “4326”]", id);
         /*
          * Same identifier, but with an authority different than the EPSG one.
          * The Citation element should then be visible in WKT 2.
          */
         id = new ImmutableIdentifier(new SimpleCitation("IOGP"), "EPSG", "4326", "8.2", null);
-        assertWktEquals(Convention.WKT2, "Id[“EPSG”, 4326, “8.2”, Citation[“IOGP”]]", id);
+        assertWktEquals(Convention.WKT2_SIMPLIFIED, "Id[“EPSG”, 4326, “8.2”, Citation[“IOGP”]]", id);
+        assertWktEquals(Convention.WKT2, "ID[“EPSG”, 4326, “8.2”, CITATION[“IOGP”]]", id);
         assertWktEquals(Convention.WKT1, "AUTHORITY[“EPSG”, “4326”]", id);
     }
 }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralOperationParameter.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralOperationParameter.java?rev=1701645&r1=1701644&r2=1701645&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralOperationParameter.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralOperationParameter.java [UTF-8] Mon Sep  7 15:48:24 2015
@@ -21,7 +21,13 @@ import java.util.Map;
 import java.util.Set;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.lang.reflect.Array;
 import javax.xml.bind.annotation.XmlElementRef;
+import org.opengis.util.GenericName;
+import org.opengis.metadata.Identifier;
+import org.opengis.referencing.ReferenceIdentifier;
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
 import org.opengis.parameter.GeneralParameterDescriptor;
@@ -31,6 +37,7 @@ import org.apache.sis.parameter.DefaultP
 import org.apache.sis.parameter.DefaultParameterDescriptorGroup;
 import org.apache.sis.parameter.DefaultParameterValueGroup;
 import org.apache.sis.parameter.Parameters;
+import org.apache.sis.referencing.NamedIdentifier;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.util.collection.Containers;
 import org.apache.sis.util.CorruptedObjectException;
@@ -72,11 +79,8 @@ public final class CC_GeneralOperationPa
      * <ul>
      *   <li>We ignore the name because the comparisons shall be performed by the caller with
      *       {@link IdentifiedObjects#isHeuristicMatchForName} or something equivalent.</li>
-     *   <li>We ignore aliases and identifiers for now for avoiding the additional complexity
-     *       of dealing with collections, and because the Apache SIS pre-defined descriptors
-     *       will be more complete in a majority of case.
-     *
-     *       <b>TODO - </b> this may be revised in any future SIS version.</li>
+     *   <li>We ignore aliases and identifiers because they are collections, which require
+     *       handling in a special way.</li>
      * </ul>
      */
     private static final String[] IGNORE_DURING_MERGE = {
@@ -164,6 +168,33 @@ public final class CC_GeneralOperationPa
     }
 
     /**
+     * Returns {@code true} if the given descriptor is restricted to a constant value.
+     * This constraint exists in some pre-defined map projections.
+     *
+     * <div class="note"><b>Example:</b>
+     * the <cite>"Latitude of natural origin"</cite> parameter of <cite>"Mercator (1SP)"</cite> projection
+     * is provided for completeness, but should never be different than zero in this particular projection
+     * (otherwise it would be a <cite>"Mercator (variant C)"</cite> projection).  But if this parameter is
+     * nevertheless provided, the SIS implementation will use it. From this point of view, SIS is tolerant
+     * to non-zero value.
+     *
+     * <p>If the GML document declares explicitely a restricted parameter, maybe it intends to use it with
+     * a non-zero value. Consequently the {@code merge(…)} method will not propagate this restriction.</p>
+     * </div>
+     */
+    private static boolean isRestricted(final ParameterDescriptor<?> descriptor) {
+        final Comparable<?> min = descriptor.getMinimumValue();
+        if (min instanceof Number) {
+            final Comparable<?> max = descriptor.getMaximumValue();
+            if (max instanceof Number) {
+                // Compare as 'double' because we want (-0 == +0) to be true.
+                return ((Number) min).doubleValue() == ((Number) max).doubleValue();
+            }
+        }
+        return false;
+    }
+
+    /**
      * Returns a descriptor with the same properties than the {@code provided} one, but completed with information
      * not found in GML. Those missing information are given by the {@code complete} descriptor, which may come from
      * two sources:
@@ -207,15 +238,21 @@ public final class CC_GeneralOperationPa
         final Map<String,?> actual   = IdentifiedObjects.getProperties(provided, IGNORE_DURING_MERGE);
         final boolean canSubstitute  = complete.getMinimumOccurs() == minimumOccurs
                                     && complete.getMaximumOccurs() == maximumOccurs
-                                    && expected.entrySet().containsAll(actual.entrySet());
+                                    && expected.entrySet().containsAll(actual.entrySet())
+                                    && containsAll(complete.getAlias(), provided.getAlias())
+                                    && containsAll(complete.getIdentifiers(), provided.getIdentifiers());
         if (canSubstitute && !isGroup) {
             /*
              * The pre-defined or ParameterValue descriptor contains at least all the information found
-             * in the descriptor parsed from the GML document, ignoring IGNORE_DURING_MERGE properties.
-             * So we can use the existing instance directly, assuming that the additional properties and
-             * the difference in ignored properties are acceptable.
+             * in the descriptor parsed from the GML document. We can use the existing instance directly,
+             * assuming that the additional properties are acceptable.
+             *
+             * We make an exception to the above rule if the existing instance put a possibly too strong
+             * restriction on the parameter values. See 'isRestricted(…)' for more information.
              */
-            return complete;
+            if (!isRestricted((ParameterDescriptor<?>) complete)) {
+                return complete;
+            }
         }
         /*
          * Collect the properties specified in the GML document and complete with the properties provided
@@ -224,13 +261,15 @@ public final class CC_GeneralOperationPa
          */
         final Map<String,Object> merged = new HashMap<String,Object>(expected);
         merged.putAll(actual);  // May overwrite pre-defined properties.
+        mergeArrays(GeneralParameterDescriptor.ALIAS_KEY,       GenericName.class, provided.getAlias(), merged, complete.getName());
+        mergeArrays(GeneralParameterDescriptor.IDENTIFIERS_KEY, ReferenceIdentifier.class, provided.getIdentifiers(), merged, null);
         if (isGroup) {
             final List<GeneralParameterDescriptor> descriptors = ((ParameterDescriptorGroup) provided).descriptors();
             return merge(DefaultParameterValueGroup.class, merged, merged, minimumOccurs, maximumOccurs,
                     descriptors.toArray(new GeneralParameterDescriptor[descriptors.size()]),
                     (ParameterDescriptorGroup) complete, canSubstitute);
         } else {
-            return merge(merged, (ParameterDescriptor<?>) provided, (ParameterDescriptor<?>) complete);
+            return create(merged, (ParameterDescriptor<?>) provided, (ParameterDescriptor<?>) complete);
         }
     }
 
@@ -323,12 +362,13 @@ public final class CC_GeneralOperationPa
      * Creates a new descriptor with the same properties than the {@code provided} one, but completed with
      * information not found in GML. Those extra information are given by the {@code complete} descriptor.
      *
-     * <p>It is the caller's responsibility to construct the {@code properties} map as a merge
-     * of the properties of the two given descriptors.</p>
-     */
-    private static <T> ParameterDescriptor<T> merge(final Map<String,?>          merged,
-                                                    final ParameterDescriptor<?> provided,
-                                                    final ParameterDescriptor<T> complete)
+     * <p>It is the caller's responsibility to construct the {@code merged} properties as a merge of the properties
+     * of the two given descriptors. This can be done with the help of {@link #mergeArrays(String, Class, Collection,
+     * Map, Identifier)} among others.</p>
+     */
+    private static <T> ParameterDescriptor<T> create(final Map<String,?>          merged,
+                                                     final ParameterDescriptor<?> provided,
+                                                     final ParameterDescriptor<T> complete)
     {
         final Class<T> valueClass = complete.getValueClass();
         return new DefaultParameterDescriptor<T>(merged,
@@ -341,4 +381,85 @@ public final class CC_GeneralOperationPa
                 CollectionsExt.toArray(complete.getValidValues(), valueClass),
                 complete.getDefaultValue());
     }
+
+    /**
+     * Returns {@code true} if the {@code complete} collection contains all elements in the {@code provided}
+     * collection, where each element have been converted to the canonical {@link NamedIdentifier} implementation
+     * for comparison purpose.
+     *
+     * @param  <T>      The type of elements in the collection.
+     * @param  complete The collection which is expected to contains all elements.
+     * @param  provided The collection which may be a subset of {@code complete}.
+     * @return {@code true} if {@code complete} contains all {@code provided} elements.
+     */
+    private static <T> boolean containsAll(final Collection<T> complete, final Collection<T> provided) {
+        if (!provided.isEmpty()) {
+            final int size = complete.size();
+            if (size == 0) {
+                return false;
+            }
+            final Set<NamedIdentifier> c = new HashSet<NamedIdentifier>(Containers.hashMapCapacity(size));
+            for (final T e : complete) {
+                c.add(toNamedIdentifier(e));
+            }
+            for (final T e : provided) {
+                if (!c.contains(toNamedIdentifier(e))) {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Merges the property of type {@code Collection} identified by the given key.
+     * This is used when we can not just substitute one collection by the other.
+     *
+     * @param <T>           The type of elements in the array or collection.
+     * @param key           The key where to fetch or store the array in the {@code merged} map.
+     * @param componentType The type of elements in the array or collection.
+     * @param provided      The elements unmarshalled from the XML document.
+     * @param merged        The map used for completing missing information.
+     */
+    @SuppressWarnings("unchecked")
+    private static <T> void mergeArrays(final String key, final Class<T> componentType,
+            Collection<T> provided, final Map<String,Object> merged, final Identifier remove)
+    {
+        if (!provided.isEmpty()) {
+            T[] complete = (T[]) merged.get(key);
+            if (complete != null) {
+                /*
+                 * Add the 'provided' values before 'complete' for two reasons:
+                 *   1) Use the same insertion order than the declaration order in the GML file.
+                 *   2) Replace 'provided' instances by 'complete' instances, since the later
+                 *      are sometime pre-defined instances defined as static final constants.
+                 */
+                final Map<NamedIdentifier,T> c = new LinkedHashMap<NamedIdentifier,T>();
+                for (final T e : provided) c.put(toNamedIdentifier(e), e);
+                for (final T e : complete) c.put(toNamedIdentifier(e), e);
+                c.remove(toNamedIdentifier(remove));
+                provided = c.values();
+            }
+            complete = provided.toArray((T[]) Array.newInstance(componentType, provided.size()));
+            merged.put(key, complete);
+        }
+    }
+
+    /**
+     * Given an {@link Identifier} or {@link GenericName} instance, returns that instance as a {@link NamedIdentifier}
+     * implementation. The intend is to allow {@code Object.equals(Object)} and hash code to correctly recognize two
+     * name or identifier as equal even if they are of different implementations.
+     *
+     * <p>Note that {@link NamedIdentifier} is the type of unmarshalled names, aliases and identifiers.
+     * So this method should not create any new object in a majority of cases.</p>
+     */
+    private static NamedIdentifier toNamedIdentifier(final Object name) {
+        if (name == null || name.getClass() == NamedIdentifier.class) {
+            return (NamedIdentifier) name;
+        } else if (name instanceof ReferenceIdentifier) {
+            return new NamedIdentifier((ReferenceIdentifier) name);
+        } else {
+            return new NamedIdentifier((GenericName) name);
+        }
+    }
 }

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=1701645&r1=1701644&r2=1701645&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] Mon Sep  7 15:48:24 2015
@@ -534,7 +534,7 @@ public class DefaultDerivedCRS extends A
                 final CoordinateSystem cs = getCoordinateSystem();
                 formatCS(formatter, cs, ReferencingUtilities.getUnit(cs), isWKT1);
             }
-            return keyword();
+            return keyword(formatter);
         }
     }
 
@@ -543,8 +543,14 @@ public class DefaultDerivedCRS extends A
      * 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());
+    String keyword(final Formatter formatter) {
+        final String longKeyword = getType(getBaseCRS(), getCoordinateSystem());
+        final String shortKeyword;
+             if (longKeyword.equals(WKTKeywords.GeodeticCRS))    shortKeyword = WKTKeywords.GeodCRS;
+        else if (longKeyword.equals(WKTKeywords.VerticalCRS))    shortKeyword = WKTKeywords.VertCRS;
+        else if (longKeyword.equals(WKTKeywords.EngineeringCRS)) shortKeyword = WKTKeywords.EngCRS;
+        else return longKeyword;
+        return formatter.shortOrLong(shortKeyword, longKeyword);
     }
 
     /**
@@ -629,8 +635,8 @@ public class DefaultDerivedCRS extends A
         }
 
         /** Returns the WKT keyword for this derived CRS type.*/
-        @Override String keyword() {
-            return WKTKeywords.GeodeticCRS;
+        @Override String keyword(final Formatter formatter) {
+            return formatter.shortOrLong(WKTKeywords.GeodCRS, WKTKeywords.GeodeticCRS);
         }
     }
 
@@ -677,8 +683,8 @@ public class DefaultDerivedCRS extends A
         }
 
         /** Returns the WKT keyword for this derived CRS type.*/
-        @Override String keyword() {
-            return WKTKeywords.VerticalCRS;
+        @Override String keyword(final Formatter formatter) {
+            return formatter.shortOrLong(WKTKeywords.VertCRS, WKTKeywords.VerticalCRS);
         }
     }
 
@@ -725,7 +731,7 @@ public class DefaultDerivedCRS extends A
         }
 
         /** Returns the WKT keyword for this derived CRS type.*/
-        @Override String keyword() {
+        @Override String keyword(final Formatter formatter) {
             return WKTKeywords.TimeCRS;
         }
     }
@@ -770,8 +776,8 @@ public class DefaultDerivedCRS extends A
         }
 
         /** Returns the WKT keyword for this derived CRS type.*/
-        @Override String keyword() {
-            return WKTKeywords.EngineeringCRS;
+        @Override String keyword(final Formatter formatter) {
+            return formatter.shortOrLong(WKTKeywords.EngCRS, 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=1701645&r1=1701644&r2=1701645&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] Mon Sep  7 15:48:24 2015
@@ -241,7 +241,8 @@ public class DefaultEngineeringCRS exten
     protected String formatTo(final Formatter formatter) {
         super.formatTo(formatter);
         return (formatter.getConvention().majorVersion() == 1) ? WKTKeywords.Local_CS
-               : isBaseCRS(formatter) ? WKTKeywords.BaseEngCRS : WKTKeywords.EngineeringCRS;
+               : isBaseCRS(formatter) ? WKTKeywords.BaseEngCRS
+                 : formatter.shortOrLong(WKTKeywords.EngCRS, WKTKeywords.EngineeringCRS);
     }
 
 

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=1701645&r1=1701644&r2=1701645&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] Mon Sep  7 15:48:24 2015
@@ -226,7 +226,8 @@ class DefaultGeodeticCRS extends Abstrac
         if (isWKT1) {
             return (cs instanceof EllipsoidalCS) ? WKTKeywords.GeogCS : WKTKeywords.GeocCS;
         } else {
-            return isBaseCRS ? WKTKeywords.BaseGeodCRS : WKTKeywords.GeodeticCRS;
+            return isBaseCRS ? WKTKeywords.BaseGeodCRS
+                   : formatter.shortOrLong(WKTKeywords.GeodCRS, WKTKeywords.GeodeticCRS);
         }
     }
 

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=1701645&r1=1701644&r2=1701645&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] Mon Sep  7 15:48:24 2015
@@ -405,7 +405,8 @@ public class DefaultProjectedCRS extends
         }
         formatter.restoreContextualUnit(lengthUnit, oldLength);
         formatter.restoreContextualUnit(angularUnit, oldAngle);
-        return isWKT1 ? WKTKeywords.ProjCS : isBaseCRS ? WKTKeywords.BaseProjCRS : WKTKeywords.ProjectedCRS;
+        return isWKT1 ? WKTKeywords.ProjCS : isBaseCRS ? WKTKeywords.BaseProjCRS
+                : formatter.shortOrLong(WKTKeywords.ProjCRS, WKTKeywords.ProjectedCRS);
     }
 
     /**

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=1701645&r1=1701644&r2=1701645&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] Mon Sep  7 15:48:24 2015
@@ -226,7 +226,8 @@ public class DefaultVerticalCRS extends
     protected String formatTo(final Formatter formatter) {
         super.formatTo(formatter);
         return (formatter.getConvention().majorVersion() == 1) ? WKTKeywords.Vert_CS
-               : isBaseCRS(formatter) ? WKTKeywords.BaseVertCRS : WKTKeywords.VerticalCRS;
+               : isBaseCRS(formatter) ? WKTKeywords.BaseVertCRS
+                 : formatter.shortOrLong(WKTKeywords.VertCRS, WKTKeywords.VerticalCRS);
     }
 
 

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=1701645&r1=1701644&r2=1701645&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] Mon Sep  7 15:48:24 2015
@@ -177,7 +177,7 @@ public class DefaultEngineeringDatum ext
             formatter.append(0);
             return WKTKeywords.Local_Datum;
         }
-        return WKTKeywords.EngineeringDatum;
+        return formatter.shortOrLong(WKTKeywords.EDatum, 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=1701645&r1=1701644&r2=1701645&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] Mon Sep  7 15:48:24 2015
@@ -564,7 +564,7 @@ public class DefaultGeodeticDatum extend
              * Datum appears in another context, then we will use "GeodeticDatum" for clarity.
              */
             if (!(formatter.getEnclosingElement(1) instanceof GeodeticCRS)) {
-                return WKTKeywords.GeodeticDatum;
+                return formatter.shortOrLong(WKTKeywords.Datum, 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=1701645&r1=1701644&r2=1701645&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] Mon Sep  7 15:48:24 2015
@@ -243,7 +243,7 @@ public class DefaultImageDatum extends A
         } else if (convention.majorVersion() == 1) {
             formatter.setInvalidWKT(this, null);
         }
-        return WKTKeywords.ImageDatum;
+        return formatter.shortOrLong(WKTKeywords.IDatum, 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=1701645&r1=1701644&r2=1701645&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] Mon Sep  7 15:48:24 2015
@@ -382,7 +382,7 @@ public class DefaultPrimeMeridian extend
         if (!convention.isSimplified() || !contextualUnit.equals(unit) || beConservative(formatter, contextualUnit)) {
             formatter.append(unit);
         }
-        return WKTKeywords.PrimeMeridian;
+        return formatter.shortOrLong(WKTKeywords.PrimeM, 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=1701645&r1=1701644&r2=1701645&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] Mon Sep  7 15:48:24 2015
@@ -276,7 +276,7 @@ public class DefaultTemporalDatum extend
         if (formatter.getConvention().majorVersion() == 1) {
             formatter.setInvalidWKT(this, null);
         }
-        return WKTKeywords.TimeDatum;
+        return formatter.shortOrLong(WKTKeywords.TDatum, WKTKeywords.TimeDatum);
     }
 
     /**

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=1701645&r1=1701644&r2=1701645&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] Mon Sep  7 15:48:24 2015
@@ -301,7 +301,7 @@ public class DefaultVerticalDatum extend
             formatter.append(VerticalDatumTypes.toLegacy(type().ordinal()));
             return WKTKeywords.Vert_Datum;
         }
-        return WKTKeywords.VerticalDatum;
+        return formatter.shortOrLong(WKTKeywords.VDatum, WKTKeywords.VerticalDatum);
     }
 
 

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java?rev=1701645&r1=1701644&r2=1701645&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java [UTF-8] Mon Sep  7 15:48:24 2015
@@ -94,8 +94,8 @@ public final strictfp class AffineTest e
     public void testWKT() {
         final Matrix matrix = Matrices.createDiagonal(3, 3);
         assertWktEquals(
-                "ParameterGroup[“Affine parametric transformation”," +
-                " Id[“EPSG”, 9624]]", Affine.parameters(matrix));
+                "PARAMETERGROUP[“Affine parametric transformation”," +
+                " ID[“EPSG”, 9624]]", Affine.parameters(matrix));
         /*
          * Try arbitrary values.
          */
@@ -103,23 +103,23 @@ public final strictfp class AffineTest e
         matrix.setElement(1, 1,  0);  // B1
         matrix.setElement(1, 2, -1);  // B2
         assertWktEquals(
-                "ParameterGroup[“Affine parametric transformation”,\n" +
-                "  Parameter[“A1”, 2.0, Id[“EPSG”, 8624]],\n"  +
-                "  Parameter[“B1”, 0.0, Id[“EPSG”, 8640]],\n" +
-                "  Parameter[“B2”, -1.0, Id[“EPSG”, 8641]],\n" +
-                "  Id[“EPSG”, 9624]]", Affine.parameters(matrix));
+                "PARAMETERGROUP[“Affine parametric transformation”,\n" +
+                "  PARAMETER[“A1”, 2.0, ID[“EPSG”, 8624]],\n"  +
+                "  PARAMETER[“B1”, 0.0, ID[“EPSG”, 8640]],\n" +
+                "  PARAMETER[“B2”, -1.0, ID[“EPSG”, 8641]],\n" +
+                "  ID[“EPSG”, 9624]]", Affine.parameters(matrix));
         /*
          * Setting a value on the last row make the matrix non-affine.
          * So it should not be anymore EPSG:9624.
          */
         matrix.setElement(2, 0, 3);  // C0
         assertWktEquals(
-                "ParameterGroup[“Affine”,\n" +
-                "  Parameter[“num_row”, 3],\n"  +
-                "  Parameter[“num_col”, 3],\n"  +
-                "  Parameter[“elt_0_1”, 2.0],\n"  +
-                "  Parameter[“elt_1_1”, 0.0],\n" +
-                "  Parameter[“elt_1_2”, -1.0],\n" +
-                "  Parameter[“elt_2_0”, 3.0]]", Affine.parameters(matrix));
+                "PARAMETERGROUP[“Affine”,\n" +
+                "  PARAMETER[“num_row”, 3],\n"  +
+                "  PARAMETER[“num_col”, 3],\n"  +
+                "  PARAMETER[“elt_0_1”, 2.0],\n"  +
+                "  PARAMETER[“elt_1_1”, 0.0],\n" +
+                "  PARAMETER[“elt_1_2”, -1.0],\n" +
+                "  PARAMETER[“elt_2_0”, 3.0]]", Affine.parameters(matrix));
     }
 }

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/LongitudeRotationTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/LongitudeRotationTest.java?rev=1701645&r1=1701644&r2=1701645&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/LongitudeRotationTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/LongitudeRotationTest.java [UTF-8] Mon Sep  7 15:48:24 2015
@@ -71,7 +71,7 @@ public final strictfp class LongitudeRot
         final ParameterValueGroup p = provider.getParameters().createValue();
         p.parameter(LongitudeRotation.NAME).setValue(2.5969213, NonSI.GRADE);
         assertWktEquals(
-                "Param_MT[“Affine parametric transformation”,\n" +
-                "  Parameter[“A2”, 2.33722917, Id[“EPSG”, 8625]]]", provider.createMathTransform(null, p));
+                "PARAM_MT[“Affine parametric transformation”,\n" +
+                "  PARAMETER[“A2”, 2.33722917, ID[“EPSG”, 8625]]]", provider.createMathTransform(null, p));
     }
 }

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.java?rev=1701645&r1=1701644&r2=1701645&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.java [UTF-8] Mon Sep  7 15:48:24 2015
@@ -247,7 +247,7 @@ public final strictfp class WKTFormatTes
         final Warnings warnings = format.getWarnings();
         assertNotNull("warnings", warnings);
         assertEquals ("warnings.numMessages", 1, warnings.getNumMessages());
-        assertEquals ("PrimeMeridian[\"Invalid \"\"$name\"\" here\", -10.0, AngleUnit[\"degree\", 0.017453292519943295]]", wkt);
+        assertEquals ("PRIMEM[\"Invalid \"\"$name\"\" here\", -10.0, ANGLEUNIT[\"degree\", 0.017453292519943295]]", wkt);
         assertEquals ("The “$” character in “\"$name\"” is not permitted by the “Well-Known Text” format.", warnings.getMessage(0));
         assertNull   (warnings.getException(0));
         /*
@@ -283,13 +283,13 @@ public final strictfp class WKTFormatTes
         final Object crs = format.parseObject("GEOGCS[“Tokyo”, $Tokyo, $Lat, $Lon]");
         final String wkt = format.format(crs);
         assertMultilinesEquals(
-                "GeodeticCRS[\"Tokyo\",\n" +
-                "  Datum[\"Tokyo\",\n" +
-                "    Ellipsoid[\"Bessel 1841\", 6377397.155, 299.1528128, LengthUnit[\"metre\", 1]]],\n" +
-                "    PrimeMeridian[\"Greenwich\", 0.0, AngleUnit[\"degree\", 0.017453292519943295]],\n" +
+                "GEODCRS[\"Tokyo\",\n" +
+                "  DATUM[\"Tokyo\",\n" +
+                "    ELLIPSOID[\"Bessel 1841\", 6377397.155, 299.1528128, LENGTHUNIT[\"metre\", 1]]],\n" +
+                "    PRIMEM[\"Greenwich\", 0.0, ANGLEUNIT[\"degree\", 0.017453292519943295]],\n" +
                 "  CS[ellipsoidal, 2],\n" +
-                "    Axis[\"Latitude (B)\", north, Order[1]],\n" +
-                "    Axis[\"Longitude (L)\", east, Order[2]],\n" +
-                "    AngleUnit[\"degree\", 0.017453292519943295]]", wkt);
+                "    AXIS[\"Latitude (B)\", north, ORDER[1]],\n" +
+                "    AXIS[\"Longitude (L)\", east, ORDER[2]],\n" +
+                "    ANGLEUNIT[\"degree\", 0.017453292519943295]]", wkt);
     }
 }

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java?rev=1701645&r1=1701644&r2=1701645&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorGroupTest.java [UTF-8] Mon Sep  7 15:48:24 2015
@@ -23,6 +23,7 @@ import java.util.Collections;
 import org.opengis.parameter.GeneralParameterDescriptor;
 import org.opengis.parameter.ParameterNotFoundException;
 import org.apache.sis.internal.util.Constants;
+import org.apache.sis.io.wkt.Convention;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestCase;
@@ -178,7 +179,14 @@ public final strictfp class DefaultParam
      */
     @Test
     public void testWKT() {
-        assertWktEquals(
+        assertWktEquals(Convention.WKT2,
+                "PARAMETERGROUP[“Test group”,\n" +
+                "  PARAMETER[“Mandatory 1”, 10],\n" +
+                "  PARAMETER[“Mandatory 2”, 10],\n" +
+                "  PARAMETER[“Optional 3”, 10],\n" +
+                "  PARAMETER[“Optional 4”, 10]]", M1_M1_O1_O2);
+
+        assertWktEquals(Convention.WKT2_SIMPLIFIED,
                 "ParameterGroup[“Test group”,\n" +
                 "  Parameter[“Mandatory 1”, 10],\n" +
                 "  Parameter[“Mandatory 2”, 10],\n" +
@@ -201,7 +209,7 @@ public final strictfp class DefaultParam
          * but is reproduced here for easier comparison with the test following it.
          */
         final DefaultParameterDescriptor<Double> descriptor = DefaultParameterDescriptorTest.createEPSG("A0", Constants.EPSG_A0);
-        assertWktEquals("Parameter[“A0”, Id[“EPSG”, 8623, URI[“urn:ogc:def:parameter:EPSG::8623”]]]", descriptor);
+        assertWktEquals("PARAMETER[“A0”, ID[“EPSG”, 8623, URI[“urn:ogc:def:parameter:EPSG::8623”]]]", descriptor);
         /*
          * When the parameter is part of a larger element, we expect a simplification.
          * Here, the URI should be omitted because it is a long value which does not
@@ -209,8 +217,8 @@ public final strictfp class DefaultParam
          */
         final DefaultParameterDescriptorGroup group = new DefaultParameterDescriptorGroup(
                 Collections.singletonMap(NAME_KEY, "Affine"), 1, 1, descriptor);
-        assertWktEquals("ParameterGroup[“Affine”,\n" +
-                        "  Parameter[“A0”, Id[“EPSG”, 8623]]]", group);
+        assertWktEquals("PARAMETERGROUP[“Affine”,\n" +
+                        "  PARAMETER[“A0”, ID[“EPSG”, 8623]]]", group);
     }
 
     /**

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java?rev=1701645&r1=1701644&r2=1701645&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java [UTF-8] Mon Sep  7 15:48:24 2015
@@ -312,8 +312,8 @@ public final strictfp class DefaultParam
     @Test
     public void testWKT() {
         final DefaultParameterDescriptor<Double> descriptor = create("Real number", 4, 8, 5, SI.METRE);
-        assertWktEquals("Parameter[“Integer param”, 5]", create("Integer param", 4, 8, 5));
-        assertWktEquals("Parameter[“Real number”, 5.0, LengthUnit[“metre”, 1]]", descriptor);
+        assertWktEquals("PARAMETER[“Integer param”, 5]", create("Integer param", 4, 8, 5));
+        assertWktEquals("PARAMETER[“Real number”, 5.0, LENGTHUNIT[“metre”, 1]]", descriptor);
         assertEquals("Parameter[\"Real number\", 5.0, Unit[\"metre\", 1]]", descriptor.toString());
     }
 
@@ -328,6 +328,6 @@ public final strictfp class DefaultParam
     @DependsOnMethod("testWKT")
     public void testIdentifiedParameterWKT() {
         final DefaultParameterDescriptor<Double> descriptor = createEPSG("A0", Constants.EPSG_A0);
-        assertWktEquals("Parameter[“A0”, Id[“EPSG”, 8623, URI[“urn:ogc:def:parameter:EPSG::8623”]]]", descriptor);
+        assertWktEquals("PARAMETER[“A0”, ID[“EPSG”, 8623, URI[“urn:ogc:def:parameter:EPSG::8623”]]]", descriptor);
     }
 }

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java?rev=1701645&r1=1701644&r2=1701645&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterValueTest.java [UTF-8] Mon Sep  7 15:48:24 2015
@@ -593,8 +593,8 @@ public final strictfp class DefaultParam
         final DefaultParameterValue<Double>  length = create("Length", 30, SI.CENTIMETRE);
         assertWktEquals(Convention.WKT1, "PARAMETER[“Count”, 4]", count);
         assertWktEquals(Convention.WKT1, "PARAMETER[“Length”, 30.0]", length);
-        assertWktEquals(Convention.WKT2, "Parameter[“Count”, 4]", count);
-        assertWktEquals(Convention.WKT2, "Parameter[“Length”, 30.0, LengthUnit[“cm”, 0.01]]", length);
+        assertWktEquals(Convention.WKT2, "PARAMETER[“Count”, 4]", count);
+        assertWktEquals(Convention.WKT2, "PARAMETER[“Length”, 30.0, LENGTHUNIT[“cm”, 0.01]]", length);
     }
 
     /**
@@ -609,7 +609,7 @@ public final strictfp class DefaultParam
     public void testWKT_withUnformattableUnit() {
         final DefaultParameterValue<Double> p = create("Angle", 10.3, Units.valueOfEPSG(9111));
         assertWktEquals(Convention.WKT1,     "PARAMETER[“Angle”, 10.3]", p);  // 10.3 DM  ==  10.5°
-        assertWktEquals(Convention.WKT2,     "Parameter[“Angle”, 10.5, AngleUnit[“degree”, 0.017453292519943295]]", p);
+        assertWktEquals(Convention.WKT2,     "PARAMETER[“Angle”, 10.5, ANGLEUNIT[“degree”, 0.017453292519943295]]", p);
         assertWktEquals(Convention.INTERNAL, "Parameter[“Angle”, 10.3, Unit[“D.M”, 0.017453292519943295, Id[“EPSG”, 9111]]]", p);
     }
 
@@ -622,6 +622,6 @@ public final strictfp class DefaultParam
     @DependsOnMethod("testWKT")
     public void testIdentifiedParameterWKT() {
         final Watcher<Double> parameter = new Watcher<Double>(DefaultParameterDescriptorTest.createEPSG("A0", Constants.EPSG_A0));
-        assertWktEquals("Parameter[“A0”, null, Id[“EPSG”, 8623]]", parameter);
+        assertWktEquals(Convention.WKT2, "PARAMETER[“A0”, null, ID[“EPSG”, 8623]]", parameter);
     }
 }

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorValuesTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorValuesTest.java?rev=1701645&r1=1701644&r2=1701645&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorValuesTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorValuesTest.java [UTF-8] Mon Sep  7 15:48:24 2015
@@ -321,12 +321,12 @@ public final strictfp class TensorValues
                 singletonMap(TensorValues.NAME_KEY, Constants.AFFINE), matrix);
         validate(group);
         assertWktEquals(
-                "ParameterGroup[“Affine”,\n"      +
-                "  Parameter[“num_row”, 3],\n"    +   // Shall be shown even if equals to the default value.
-                "  Parameter[“num_col”, 3],\n"    +
-                "  Parameter[“elt_0_2”, 4.0],\n"  +
-                "  Parameter[“elt_1_0”, -2.0],\n" +
-                "  Parameter[“elt_2_2”, 7.0]]", group);
+                "PARAMETERGROUP[“Affine”,\n"      +
+                "  PARAMETER[“num_row”, 3],\n"    +   // Shall be shown even if equals to the default value.
+                "  PARAMETER[“num_col”, 3],\n"    +
+                "  PARAMETER[“elt_0_2”, 4.0],\n"  +
+                "  PARAMETER[“elt_1_0”, -2.0],\n" +
+                "  PARAMETER[“elt_2_2”, 7.0]]", group);
     }
 
     /**
@@ -348,10 +348,10 @@ public final strictfp class TensorValues
                 singletonMap(TensorValues.NAME_KEY, Affine.NAME), matrix);
         validate(group);
         assertWktEquals(
-                "ParameterGroup[“Affine parametric transformation”,\n" +
-                "  Parameter[“A2”, 4.0, Id[“EPSG”, 8625]],\n"  +
-                "  Parameter[“B0”, -2.0, Id[“EPSG”, 8639]],\n" +
-                "  Parameter[“C2”, 7.0]]", group);
+                "PARAMETERGROUP[“Affine parametric transformation”,\n" +
+                "  PARAMETER[“A2”, 4.0, ID[“EPSG”, 8625]],\n"  +
+                "  PARAMETER[“B0”, -2.0, ID[“EPSG”, 8639]],\n" +
+                "  PARAMETER[“C2”, 7.0]]", group);
     }
 
     /**

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java?rev=1701645&r1=1701644&r2=1701645&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractReferenceSystemTest.java [UTF-8] Mon Sep  7 15:48:24 2015
@@ -118,12 +118,12 @@ public final strictfp class AbstractRefe
 
         assertWktEquals(Convention.WKT2,
                 "ReferenceSystem[“My \"object\".”,\n" +     // Quotes replaced
-                "  Scope[“Large scale topographic mapping and cadastre.”],\n" +
-                "  Area[“Netherlands offshore.”],\n" +
-                "  BBox[51.43, 2.54, 55.77, 6.40],\n" +
-                "  VerticalExtent[-1000, -10, LengthUnit[“metre”, 1]],\n" +
-                "  Id[“EPSG”, 4326, “8.2”, URI[“urn:ogc:def:referenceSystem:EPSG:8.2:4326”]],\n" +
-                "  Remark[“注です。”]]",
+                "  SCOPE[“Large scale topographic mapping and cadastre.”],\n" +
+                "  AREA[“Netherlands offshore.”],\n" +
+                "  BBOX[51.43, 2.54, 55.77, 6.40],\n" +
+                "  VERTICALEXTENT[-1000, -10, LENGTHUNIT[“metre”, 1]],\n" +
+                "  ID[“EPSG”, 4326, “8.2”, URI[“urn:ogc:def:referenceSystem:EPSG:8.2:4326”]],\n" +
+                "  REMARK[“注です。”]]",
                 object);
 
         assertWktEquals(Convention.WKT2_SIMPLIFIED,

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java?rev=1701645&r1=1701644&r2=1701645&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java [UTF-8] Mon Sep  7 15:48:24 2015
@@ -174,7 +174,7 @@ public final strictfp class DefaultCompo
                 "    AXIS[“Gravity-related height”, UP],\n" +
                 "    AUTHORITY[“EPSG”, “5714”]],\n" +   // SIS includes Identifier for component of CompoundCRS.
                 "  TIMECRS[“Time”,\n" +
-                "    TIMEDATUM[“Modified Julian”, TIMEORIGIN[1858-11-17T00:00:00.0Z]],\n" +
+                "    TDATUM[“Modified Julian”, TIMEORIGIN[1858-11-17T00:00:00.0Z]],\n" +
                 "    TIMEUNIT[“day”, 86400],\n" +
                 "    AXIS[“Time”, FUTURE]]]",
                 HardCodedCRS.GEOID_4D);
@@ -187,25 +187,56 @@ public final strictfp class DefaultCompo
     @DependsOnMethod("testWKT1")
     public void testWKT2() {
         assertWktEquals(Convention.WKT2,
+                "COMPOUNDCRS[“WGS 84 + height + time”,\n" +
+                "  GEODCRS[“WGS 84”,\n" +
+                "    DATUM[“World Geodetic System 1984”,\n" +
+                "      ELLIPSOID[“WGS84”, 6378137.0, 298.257223563, LENGTHUNIT[“metre”, 1]]],\n" +
+                "      PRIMEM[“Greenwich”, 0.0, ANGLEUNIT[“degree”, 0.017453292519943295]],\n" +
+                "    CS[ellipsoidal, 2],\n" +
+                "      AXIS[“Longitude (L)”, east, ORDER[1]],\n" +
+                "      AXIS[“Latitude (B)”, north, ORDER[2]],\n" +
+                "      ANGLEUNIT[“degree”, 0.017453292519943295]],\n" +
+                "  VERTCRS[“MSL height”,\n" +
+                "    VDATUM[“Mean Sea Level”],\n" +
+                "    CS[vertical, 1],\n" +
+                "      AXIS[“Gravity-related height (H)”, up, ORDER[1]],\n" +
+                "      LENGTHUNIT[“metre”, 1],\n" +
+                "    ID[“EPSG”, 5714]],\n" +            // SIS includes Identifier for component of CompoundCRS.
+                "  TIMECRS[“Time”,\n" +
+                "    TDATUM[“Modified Julian”, TIMEORIGIN[1858-11-17T00:00:00.0Z]],\n" +
+                "    CS[temporal, 1],\n" +
+                "      AXIS[“Time (t)”, future, ORDER[1]],\n" +
+                "      TIMEUNIT[“day”, 86400]],\n" +
+                "  AREA[“World”],\n" +
+                "  BBOX[-90.00, -180.00, 90.00, 180.00]]",
+                HardCodedCRS.GEOID_4D);
+    }
+
+    /**
+     * Tests WKT 2 "simplified" formatting.
+     */
+    @Test
+    @DependsOnMethod("testWKT2")
+    public void testWKT2_Simplified() {
+        assertWktEquals(Convention.WKT2_SIMPLIFIED,
                 "CompoundCRS[“WGS 84 + height + time”,\n" +
                 "  GeodeticCRS[“WGS 84”,\n" +
                 "    Datum[“World Geodetic System 1984”,\n" +
-                "      Ellipsoid[“WGS84”, 6378137.0, 298.257223563, LengthUnit[“metre”, 1]]],\n" +
-                "      PrimeMeridian[“Greenwich”, 0.0, AngleUnit[“degree”, 0.017453292519943295]],\n" +
+                "      Ellipsoid[“WGS84”, 6378137.0, 298.257223563]],\n" +
                 "    CS[ellipsoidal, 2],\n" +
-                "      Axis[“Longitude (L)”, east, Order[1]],\n" +
-                "      Axis[“Latitude (B)”, north, Order[2]],\n" +
-                "      AngleUnit[“degree”, 0.017453292519943295]],\n" +
+                "      Axis[“Longitude (L)”, east],\n" +
+                "      Axis[“Latitude (B)”, north],\n" +
+                "      Unit[“degree”, 0.017453292519943295]],\n" +
                 "  VerticalCRS[“MSL height”,\n" +
                 "    VerticalDatum[“Mean Sea Level”],\n" +
                 "    CS[vertical, 1],\n" +
-                "      Axis[“Gravity-related height (H)”, up, Order[1]],\n" +
-                "      LengthUnit[“metre”, 1],\n" +
+                "      Axis[“Gravity-related height (H)”, up],\n" +
+                "      Unit[“metre”, 1],\n" +
                 "    Id[“EPSG”, 5714]],\n" +            // SIS includes Identifier for component of CompoundCRS.
                 "  TimeCRS[“Time”,\n" +
                 "    TimeDatum[“Modified Julian”, TimeOrigin[1858-11-17T00:00:00.0Z]],\n" +
                 "    CS[temporal, 1],\n" +
-                "      Axis[“Time (t)”, future, Order[1]],\n" +
+                "      Axis[“Time (t)”, future],\n" +
                 "      TimeUnit[“day”, 86400]],\n" +
                 "  Area[“World”],\n" +
                 "  BBox[-90.00, -180.00, 90.00, 180.00]]",

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultDerivedCRSTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultDerivedCRSTest.java?rev=1701645&r1=1701644&r2=1701645&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultDerivedCRSTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultDerivedCRSTest.java [UTF-8] Mon Sep  7 15:48:24 2015
@@ -166,19 +166,42 @@ public final strictfp class DefaultDeriv
     @Test
     @DependsOnMethod("testWKT1")
     public void testWKT2() {
-        assertWktEquals(
+        assertWktEquals(Convention.WKT2,
+                "GEODCRS[“Back to Greenwich”,\n" +
+                "  BASEGEODCRS[“NTF (Paris)”,\n" +
+                "    DATUM[“Nouvelle Triangulation Francaise”,\n" +
+                "      ELLIPSOID[“NTF”, 6378249.2, 293.4660212936269, LENGTHUNIT[“metre”, 1]]],\n" +
+                "      PRIMEM[“Paris”, 2.5969213, ANGLEUNIT[“grade”, 0.015707963267948967]]],\n" +
+                "  DERIVINGCONVERSION[“Paris to Greenwich”,\n" +
+                "    METHOD[“Longitude rotation”, ID[“EPSG”, 9601]],\n" +
+                "    PARAMETER[“Longitude offset”, 2.33722917, ID[“EPSG”, 8602]]],\n" +
+                "  CS[ellipsoidal, 2],\n" +
+                "    AXIS[“Latitude (B)”, north, ORDER[1]],\n" +
+                "    AXIS[“Longitude (L)”, east, ORDER[2]],\n" +
+                "    ANGLEUNIT[“degree”, 0.017453292519943295]]",
+                createLongitudeRotation());
+    }
+
+    /**
+     * Tests the WKT 2 "simplified" formatting.
+     */
+    @Test
+    @DependsOnMethod("testWKT2")
+    public void testWKT2_Simplified() {
+        assertWktEquals(Convention.WKT2_SIMPLIFIED,
                 "GeodeticCRS[“Back to Greenwich”,\n" +
                 "  BaseGeodCRS[“NTF (Paris)”,\n" +
                 "    Datum[“Nouvelle Triangulation Francaise”,\n" +
-                "      Ellipsoid[“NTF”, 6378249.2, 293.4660212936269, LengthUnit[“metre”, 1]]],\n" +
-                "      PrimeMeridian[“Paris”, 2.5969213, AngleUnit[“grade”, 0.015707963267948967]]],\n" +
+                "      Ellipsoid[“NTF”, 6378249.2, 293.4660212936269]],\n" +
+                "      PrimeMeridian[“Paris”, 2.5969213, Unit[“grade”, 0.015707963267948967]],\n" +
+                "    Unit[“degree”, 0.017453292519943295]],\n" +
                 "  DerivingConversion[“Paris to Greenwich”,\n" +
-                "    Method[“Longitude rotation”, Id[“EPSG”, 9601]],\n" +
-                "    Parameter[“Longitude offset”, 2.33722917, Id[“EPSG”, 8602]]],\n" +
+                "    Method[“Longitude rotation”],\n" +
+                "    Parameter[“Longitude offset”, 2.33722917]],\n" +
                 "  CS[ellipsoidal, 2],\n" +
-                "    Axis[“Latitude (B)”, north, Order[1]],\n" +
-                "    Axis[“Longitude (L)”, east, Order[2]],\n" +
-                "    AngleUnit[“degree”, 0.017453292519943295]]",
+                "    Axis[“Latitude (B)”, north],\n" +
+                "    Axis[“Longitude (L)”, east],\n" +
+                "    Unit[“degree”, 0.017453292519943295]]",
                 createLongitudeRotation());
     }
 }

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultEngineeringCRSTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultEngineeringCRSTest.java?rev=1701645&r1=1701644&r2=1701645&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultEngineeringCRSTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultEngineeringCRSTest.java [UTF-8] Mon Sep  7 15:48:24 2015
@@ -81,12 +81,28 @@ public final strictfp class DefaultEngin
     public void testWKT2() {
         final DefaultEngineeringCRS crs = createSpherical();
         assertWktEquals(Convention.WKT2,
+                "ENGCRS[“A spherical CRS”,\n" +
+                "  EDATUM[“Centre”],\n" +
+                "  CS[spherical, 3],\n" +
+                "    AXIS[“Spherical latitude (U)”, north, ORDER[1], ANGLEUNIT[“degree”, 0.017453292519943295]],\n" +
+                "    AXIS[“Spherical longitude (V)”, east, ORDER[2], ANGLEUNIT[“degree”, 0.017453292519943295]],\n" +
+                "    AXIS[“Geocentric radius (r)”, up, ORDER[3], LENGTHUNIT[“metre”, 1]]]",
+                crs);
+    }
+
+    /**
+     * Tests WKT 2 "simplified" formatting.
+     */
+    @Test
+    public void testWKT2_Simplified() {
+        final DefaultEngineeringCRS crs = createSpherical();
+        assertWktEquals(Convention.WKT2_SIMPLIFIED,
                 "EngineeringCRS[“A spherical CRS”,\n" +
                 "  EngineeringDatum[“Centre”],\n" +
                 "  CS[spherical, 3],\n" +
-                "    Axis[“Spherical latitude (U)”, north, Order[1], AngleUnit[“degree”, 0.017453292519943295]],\n" +
-                "    Axis[“Spherical longitude (V)”, east, Order[2], AngleUnit[“degree”, 0.017453292519943295]],\n" +
-                "    Axis[“Geocentric radius (r)”, up, Order[3], LengthUnit[“metre”, 1]]]",
+                "    Axis[“Spherical latitude (U)”, north, Unit[“degree”, 0.017453292519943295]],\n" +
+                "    Axis[“Spherical longitude (V)”, east, Unit[“degree”, 0.017453292519943295]],\n" +
+                "    Axis[“Geocentric radius (r)”, up, Unit[“metre”, 1]]]",
                 crs);
     }
 



Mime
View raw message