sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1677850 [3/4] - in /sis/trunk: ./ core/sis-feature/src/main/java/org/apache/sis/feature/ core/sis-feature/src/test/java/org/apache/sis/feature/ core/sis-feature/src/test/java/org/apache/sis/test/suite/ core/sis-metadata/src/main/java/org/a...
Date Tue, 05 May 2015 16:09:07 GMT
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=1677850&r1=1677849&r2=1677850&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] Tue May  5 16:09:05 2015
@@ -47,7 +47,7 @@ import static org.apache.sis.util.Argume
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  *
  * @see org.apache.sis.referencing.datum.DefaultVerticalDatum
@@ -67,7 +67,7 @@ public class DefaultVerticalCRS extends
     /**
      * The datum.
      */
-    @XmlElement(name = "verticalDatum")
+    @XmlElement(name = "verticalDatum", required = true)
     private final VerticalDatum datum;
 
     /**
@@ -200,7 +200,7 @@ public class DefaultVerticalCRS extends
      * @return The coordinate system.
      */
     @Override
-    @XmlElement(name = "verticalCS")
+    @XmlElement(name = "verticalCS", required = true)
     public VerticalCS getCoordinateSystem() {
         return (VerticalCS) super.getCoordinateSystem();
     }
@@ -209,7 +209,7 @@ public class DefaultVerticalCRS extends
      * Used by JAXB only (invoked by reflection).
      */
     private void setCoordinateSystem(final VerticalCS cs) {
-        super.setCoordinateSystem("verticalCS", cs);
+        setCoordinateSystem("verticalCS", cs);
     }
 
     /**
@@ -238,6 +238,7 @@ public class DefaultVerticalCRS extends
     @Override
     protected String formatTo(final Formatter formatter) {
         super.formatTo(formatter);
-        return (formatter.getConvention().majorVersion() == 1) ? "Vert_CS" : "VerticalCRS";
+        return (formatter.getConvention().majorVersion() == 1) ? "Vert_CS"
+               : isBaseCRS(formatter) ? "BaseVertCRS" : "VerticalCRS";
     }
 }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/SubTypes.java [UTF-8] Tue May  5 16:09:05 2015
@@ -20,6 +20,7 @@ import java.util.Map;
 import java.util.Comparator;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.opengis.referencing.crs.CompoundCRS;
+import org.opengis.referencing.crs.DerivedCRS;
 import org.opengis.referencing.crs.EngineeringCRS;
 import org.opengis.referencing.crs.GeocentricCRS;
 import org.opengis.referencing.crs.GeodeticCRS;
@@ -50,7 +51,7 @@ import org.apache.sis.referencing.cs.Axe
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  */
 final class SubTypes implements Comparator<Object> {
@@ -105,6 +106,12 @@ final class SubTypes implements Comparat
      * @see AbstractCRS#castOrCopy(CoordinateReferenceSystem)
      */
     static AbstractCRS castOrCopy(final CoordinateReferenceSystem object) {
+        if (object instanceof DerivedCRS) {
+            return DefaultDerivedCRS.castOrCopy((DerivedCRS) object);
+        }
+        if (object instanceof ProjectedCRS) {
+            return DefaultProjectedCRS.castOrCopy((ProjectedCRS) object);
+        }
         if (object instanceof GeodeticCRS) {
             if (object instanceof GeographicCRS) {
                 return DefaultGeographicCRS.castOrCopy((GeographicCRS) object);

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/package-info.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/package-info.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/package-info.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/package-info.java [UTF-8] Tue May  5 16:09:05 2015
@@ -74,7 +74,7 @@
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Cédric Briançon (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  */
 @XmlSchema(elementFormDefault= XmlNsForm.QUALIFIED, namespace = Namespaces.GML, xmlns = {
@@ -88,8 +88,8 @@
     @XmlJavaTypeAdapter(CD_ImageDatum.class),
     @XmlJavaTypeAdapter(CD_TemporalDatum.class),
     @XmlJavaTypeAdapter(CD_VerticalDatum.class),
+    @XmlJavaTypeAdapter(CS_CartesianCS.class),      // Must be before CS_AffineCS.
     @XmlJavaTypeAdapter(CS_AffineCS.class),
-    @XmlJavaTypeAdapter(CS_CartesianCS.class),
     @XmlJavaTypeAdapter(CS_CylindricalCS.class),
     @XmlJavaTypeAdapter(CS_EllipsoidalCS.class),
     @XmlJavaTypeAdapter(CS_LinearCS.class),
@@ -98,6 +98,8 @@
     @XmlJavaTypeAdapter(CS_TimeCS.class),
     @XmlJavaTypeAdapter(CS_UserDefinedCS.class),
     @XmlJavaTypeAdapter(CS_VerticalCS.class),
+    @XmlJavaTypeAdapter(CC_Conversion.class),
+    @XmlJavaTypeAdapter(SC_GeographicCRS.class),
     @XmlJavaTypeAdapter(StringAdapter.class),
     @XmlJavaTypeAdapter(InternationalStringConverter.class)
 })

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=1677850&r1=1677849&r2=1677850&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] Tue May  5 16:09:05 2015
@@ -446,7 +446,7 @@ public class AbstractCS extends Abstract
             formatter.setInvalidWKT(this, null);
         }
         formatter.append(type, null);
-        formatter.append(axes.length);
+        formatter.append(getDimension());
         return "CS";
     }
 }

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=1677850&r1=1677849&r2=1677850&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] Tue May  5 16:09:05 2015
@@ -33,7 +33,11 @@ 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;
+import org.opengis.referencing.cs.SphericalCS;
+import org.opengis.referencing.cs.CoordinateSystem;
 import org.opengis.referencing.cs.CoordinateSystemAxis;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.apache.sis.internal.referencing.AxisDirections;
 import org.apache.sis.referencing.AbstractIdentifiedObject;
 import org.apache.sis.referencing.IdentifiedObjects;
@@ -48,6 +52,8 @@ 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.FormattableObject;
 import org.apache.sis.internal.referencing.ReferencingUtilities;
 
 import static java.lang.Double.doubleToLongBits;
@@ -79,7 +85,7 @@ import org.apache.sis.internal.jdk7.Obje
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  *
  * @see AbstractCS
@@ -733,6 +739,23 @@ public class DefaultCoordinateSystemAxis
     }
 
     /**
+     * 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
+     * reasons, since compatibility with WKT 1 was a requirement of WKT 2).
+     */
+    private static CoordinateSystem getEnclosingCS(final Formatter formatter) {
+        final FormattableObject e = formatter.getEnclosingElement(1);
+        if (e instanceof CoordinateReferenceSystem) {   // This is what we expect in standard WKT.
+            return ((CoordinateReferenceSystem) e).getCoordinateSystem();
+        }
+        if (e instanceof CoordinateSystem) {    // Not standard WKT, but conceptually the right thing.
+            return (CoordinateSystem) e;
+        }
+        return null;
+    }
+
+    /**
      * Formats this axis as a <cite>Well Known Text</cite> {@code Axis[…]} element.
      *
      * <div class="section">Constraints for WKT validity</div>
@@ -743,26 +766,34 @@ public class DefaultCoordinateSystemAxis
      * The only actions (derived from ISO 19162 rules) taken by this method are:
      *
      * <ul>
-     *   <li>Replace “<cite>Geodetic latitude</cite>” and “<cite>Geodetic longitude</cite>” names (case insensitive)
-     *       by “<cite>Latitude</cite>” and “<cite>Longitude</cite>” respectively.</li>
+     *   <li>Replace <cite>“Geodetic latitude”</cite> and <cite>“Geodetic longitude”</cite> names (case insensitive)
+     *       by <cite>“latitude”</cite> and <cite>“longitude”</cite> respectively.</li>
+     *   <li>For latitude and longitude axes, replace “φ” and “λ” abbreviations by <var>“B”</var> and <var>“L”</var>
+     *       respectively (from German “Breite” and “Länge”, used in academic texts worldwide).
+     *       Note that <var>“L”</var> is also the transliteration of Greek letter “lambda” (λ).</li>
+     *   <li>In {@link SphericalCS}, replace “φ” and “θ” abbreviations by <var>“U”</var> and <var>“V”</var> respectively.</li>
+     *   <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)}.
+     *
      * @return {@code "Axis"}.
      */
     @Override
     protected String formatTo(final Formatter formatter) {
         final Convention convention = formatter.getConvention();
-        final boolean isWKT1 = convention.majorVersion() == 1;
-        final boolean isInternal = (convention == Convention.INTERNAL);
+        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 (!isInternal && name != null) {
+            if (name != null && !isInternal) {
                 if (name.equalsIgnoreCase("Geodetic latitude")) {
-                    name = "Latitude"; // ISO 19162 §7.5.3(ii)
+                    name = "Latitude";    // ISO 19162 §7.5.3(ii)
                 } else if (name.equalsIgnoreCase("Geodetic longitude")) {
                     name = "Longitude";
                 }
@@ -770,20 +801,31 @@ public class DefaultCoordinateSystemAxis
         }
         /*
          * ISO 19162 §7.5.3 suggests to put abbreviation in parentheses, e.g. "Easting (x)".
+         * The specification also suggests to write only the abbreviation (e.g. "(X)") in the
+         * special case of Geocentric axis, and disallows Greek letters.
          */
-        if (!isWKT1 && (name == null || !name.equals(abbreviation))) {
-            final StringBuilder buffer = new StringBuilder();
-            if (name != null) {
-                buffer.append(name).append(' ');
+        final CoordinateSystem cs;
+        if (isWKT1) {
+            cs = null;
+        } else {
+            cs = getEnclosingCS(formatter);
+            final String a = formatter.getCharEncoding().getAbbreviation(cs, this);
+            if (a != null && !a.equals(name)) {
+                final StringBuilder buffer = new StringBuilder();
+                if (name != null) {
+                    buffer.append(name).append(' ');
+                }
+                name = buffer.append('(').append(a).append(')').toString();
             }
-            name = buffer.append('(').append(abbreviation).append(')').toString();
         }
-        formatter.append(name, ElementKind.AXIS);
+        if (name != null) {
+            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 = direction;
+        AxisDirection dir = getDirection();
         DirectionAlongMeridian meridian = null;
         if (!isWKT1 && AxisDirections.isUserDefined(dir)) {
             meridian = DirectionAlongMeridian.parse(dir);
@@ -798,9 +840,73 @@ public class DefaultCoordinateSystemAxis
          * If the enclosing CRS provided a contextual unit, then it is assumed to apply
          * to all axes (we do not verify).
          */
-        if (!isWKT1 && !formatter.hasContextualUnit(1)) {
-            formatter.append(unit);
+        if (!isWKT1) {
+            if (convention == Convention.WKT2 && cs != null) {
+                final Order order = Order.create(cs, this);
+                if (order != null) {
+                    formatter.append(order);
+                } else {
+                    formatter.setInvalidWKT(cs, null);
+                }
+            }
+            if (!formatter.hasContextualUnit(1)) {
+                formatter.append(getUnit());
+            }
         }
         return "Axis";
     }
+
+    /**
+     * The {@code ORDER[…]} element to be formatted inside {@code AXIS[…]} element.
+     * This is an element of WKT 2 only.
+     */
+    private static final class Order extends FormattableObject {
+        /**
+         * The sequence number to format inside the {@code ORDER[…]} element.
+         */
+        private final int index;
+
+        /**
+         * Creates a new {@code ORDER[…]} element for the given axis in the given coordinate system.
+         * If this method does not found exactly one instance of the given axis in the given coordinate system,
+         * then returns {@code null}. In the later case, it is caller's responsibility to declare the WKT as invalid.
+         *
+         * <p>This method is a little bit inefficient since the enclosing {@link AbstractCS#formatTo(Formatter)}
+         * method already know this axis index. But there is currently no API in {@link Formatter} for carrying
+         * this information, and we are a little bit reluctant to introduce such API since it would force us to
+         * introduce lists in a model which is, for everything else, purely based on trees.</p>
+         *
+         * @se <a href="https://issues.apache.org/jira/browse/SIS-163">SIS-163</a>
+         */
+        static Order create(final CoordinateSystem cs, final DefaultCoordinateSystemAxis axis) {
+            Order order = null;
+            final int dimension = cs.getDimension();
+            for (int i=0; i<dimension;) {
+                if (cs.getAxis(i++) == axis) {
+                    if (order == null) {
+                        order = new Order(i);
+                    } else {
+                        return null;
+                    }
+                }
+            }
+            return order;
+        }
+
+        /**
+         * Creates new {@code ORDER[…]} element for the given sequential number.
+         */
+        private Order(final int index) {
+            this.index = index;
+        }
+
+        /**
+         * Formats the {@code ORDER[…]} element.
+         */
+        @Override
+        protected String formatTo(final Formatter formatter) {
+            formatter.append(index);
+            return "Order";
+        }
+    }
 }

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=1677850&r1=1677849&r2=1677850&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] Tue May  5 16:09:05 2015
@@ -31,8 +31,8 @@ import org.apache.sis.referencing.Abstra
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.util.iso.Types;
 import org.apache.sis.util.ComparisonMode;
+import org.apache.sis.internal.util.Citations;
 import org.apache.sis.internal.metadata.MetadataUtilities;
-import org.apache.sis.internal.referencing.OperationMethods;
 
 import static org.apache.sis.util.Utilities.deepEquals;
 import static org.apache.sis.util.collection.Containers.property;
@@ -414,7 +414,7 @@ public class AbstractDatum extends Abstr
                  * and parameters. We extend this rule to datum as well.
                  */
                 final Datum that = (Datum) object;
-                final Boolean match = OperationMethods.hasCommonIdentifier(getIdentifiers(), that.getIdentifiers());
+                final Boolean match = Citations.hasCommonIdentifier(getIdentifiers(), that.getIdentifiers());
                 if (match != null) {
                     return match;
                 }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java [UTF-8] Tue May  5 16:09:05 2015
@@ -609,7 +609,7 @@ public class BursaWolfParameters extends
             return "ToWGS84";
         }
         formatter.setInvalidWKT(BursaWolfParameters.class, null);
-        String name = IdentifiedObjects.getUnicodeIdentifier(targetDatum);
+        String name = IdentifiedObjects.getUnicodeIdentifier(getTargetDatum());
         if (name == null) {
             name = "Unknown";
         }

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=1677850&r1=1677849&r2=1677850&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] Tue May  5 16:09:05 2015
@@ -761,13 +761,15 @@ public class DefaultEllipsoid extends Ab
     @Override
     protected String formatTo(final Formatter formatter) {
         super.formatTo(formatter);
-        final Convention convention = formatter.getConvention();
-        final boolean isWKT1 = convention.majorVersion() == 1;
-        double length = semiMajorAxis;
+        final Convention   convention = formatter.getConvention();
+        final boolean      isWKT1     = convention.majorVersion() == 1;
+        final Unit<Length> unit       = getAxisUnit();  // Gives to users a chance to override properties.
+        double length = getSemiMajorAxis();
         if (isWKT1) {
             length = unit.getConverterTo(SI.METRE).convert(length);
         }
         formatter.append(length);
+        final double inverseFlattening = getInverseFlattening();  // Gives to users a chance to override properties.
         formatter.append(isInfinite(inverseFlattening) ? 0 : inverseFlattening);
         if (isWKT1) {
             return "Spheroid";

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=1677850&r1=1677849&r2=1677850&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] Tue May  5 16:09:05 2015
@@ -530,13 +530,16 @@ public class DefaultGeodeticDatum extend
      * }
      * </div>
      *
+     * 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"}.
      */
     @Override
     protected String formatTo(final Formatter formatter) {
         super.formatTo(formatter);
         formatter.newLine();
-        formatter.append(toFormattable(ellipsoid));
+        formatter.append(toFormattable(getEllipsoid()));
         if (formatter.getConvention().majorVersion() == 1) {
             /*
              * Note that at the different of other datum (in particular vertical datum),
@@ -552,6 +555,7 @@ public class DefaultGeodeticDatum extend
                 }
             }
         }
+        // For the WKT 2 case, the ANCHOR[…] element is added by Formatter itself.
         formatter.newLine(); // For writing the ID[…] element on its own line.
         return "Datum";
     }

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=1677850&r1=1677849&r2=1677850&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] Tue May  5 16:09:05 2015
@@ -245,7 +245,7 @@ public class DefaultImageDatum extends A
         super.formatTo(formatter);
         final Convention convention = formatter.getConvention();
         if (convention == Convention.INTERNAL) {
-            formatter.append(pixelInCell); // This is an extension compared to ISO 19162.
+            formatter.append(getPixelInCell());         // This is an extension compared to ISO 19162.
         } else if (convention.majorVersion() == 1) {
             formatter.setInvalidWKT(this, null);
         }

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=1677850&r1=1677849&r2=1677850&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] Tue May  5 16:09:05 2015
@@ -349,10 +349,11 @@ public class DefaultPrimeMeridian extend
         if (targetUnit == null) {
             targetUnit = NonSI.DEGREE_ANGLE;
         }
-        formatter.append(isWKT1 ? getGreenwichLongitude(targetUnit) : greenwichLongitude);
+        formatter.append(isWKT1 ? getGreenwichLongitude(targetUnit) : getGreenwichLongitude());
         if (isWKT1) {
             return "PrimeM";
         }
+        final Unit<Angle> angularUnit = getAngularUnit();   // Gives to users a chance to override properties.
         if (!convention.isSimplified() || !targetUnit.equals(angularUnit)) {
             formatter.append(angularUnit);
         }

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=1677850&r1=1677849&r2=1677850&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] Tue May  5 16:09:05 2015
@@ -289,7 +289,7 @@ public class DefaultTemporalDatum extend
     @Override
     protected String formatTo(final Formatter formatter) {
         super.formatTo(formatter);
-        formatter.append(new Origin(MetadataUtilities.toDate(origin)));
+        formatter.append(new Origin(getOrigin()));
         if (formatter.getConvention().majorVersion() == 1) {
             formatter.setInvalidWKT(this, null);
         }

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultFormula.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultFormula.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultFormula.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultFormula.java [UTF-8] Tue May  5 16:09:05 2015
@@ -180,11 +180,12 @@ public class DefaultFormula extends Form
     @Override
     protected String formatTo(final Formatter formatter) {
         InternationalString text = null;
+        final Citation citation = getCitation();    // Gives to users a chance to override properties.
         if (citation != null) {
             text = citation.getTitle();
         }
         if (text == null) {
-            text = formula;
+            text = getFormula();
         }
         if (text != null) {
             formatter.append(text.toString(formatter.getLocale()), ElementKind.REMARKS);

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=1677850&r1=1677849&r2=1677850&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] Tue May  5 16:09:05 2015
@@ -32,11 +32,11 @@ import org.apache.sis.util.Workaround;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.resources.Vocabulary;
+import org.apache.sis.internal.util.Citations;
 import org.apache.sis.parameter.Parameterized;
 import org.apache.sis.referencing.NamedIdentifier;
 import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.AbstractIdentifiedObject;
-import org.apache.sis.internal.referencing.OperationMethods;
 import org.apache.sis.io.wkt.Formatter;
 
 import static org.apache.sis.util.ArgumentChecks.*;
@@ -276,7 +276,7 @@ public class DefaultOperationMethod exte
      *         or {@code null} if it is not going to have any declared authority.
      * @return The identified object properties in a mutable map.
      */
-    static Map<String,Object> getProperties(final IdentifiedObject info, final Citation authority) {
+    private static Map<String,Object> getProperties(final IdentifiedObject info, final Citation authority) {
         final Map<String,Object> properties = new HashMap<String,Object>(IdentifiedObjects.getProperties(info));
         properties.put(NAME_KEY, new NamedIdentifier(authority, info.getName().getCode()));
         properties.remove(IDENTIFIERS_KEY);
@@ -600,7 +600,7 @@ public class DefaultOperationMethod exte
                      * and parameters.
                      */
                     final OperationMethod that = (OperationMethod) object;
-                    final Boolean match = OperationMethods.hasCommonIdentifier(getIdentifiers(), that.getIdentifiers());
+                    final Boolean match = Citations.hasCommonIdentifier(getIdentifiers(), that.getIdentifiers());
                     if (match != null) {
                         if (!match) {
                             return false;

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=1677850&r1=1677849&r2=1677850&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] Tue May  5 16:09:05 2015
@@ -481,32 +481,12 @@ public final class Matrices extends Stat
     {
         ArgumentChecks.ensureNonNull("srcEnvelope", srcEnvelope);
         ArgumentChecks.ensureNonNull("dstEnvelope", dstEnvelope);
-        ensureDimensionMatch("srcEnvelope", srcEnvelope, srcAxes.length);
-        ensureDimensionMatch("dstEnvelope", dstEnvelope, dstAxes.length);
+        ArgumentChecks.ensureDimensionMatches("srcEnvelope", srcAxes.length, srcEnvelope);
+        ArgumentChecks.ensureDimensionMatches("dstEnvelope", dstAxes.length, dstEnvelope);
         return createTransform(srcEnvelope, srcAxes, dstEnvelope, dstAxes, true);
     }
 
     /**
-     * Convenience method for checking object dimension validity.
-     * This method is invoked for argument checking.
-     *
-     * @param  name      The name of the argument to check.
-     * @param  envelope  The envelope to check.
-     * @param  dimension The expected dimension for the object.
-     * @throws MismatchedDimensionException if the envelope doesn't have the expected dimension.
-     */
-    private static void ensureDimensionMatch(final String name, final Envelope envelope,
-            final int dimension) throws MismatchedDimensionException
-    {
-        ArgumentChecks.ensureNonNull(name, envelope);
-        final int dim = envelope.getDimension();
-        if (dimension != dim) {
-            throw new MismatchedDimensionException(Errors.format(
-                    Errors.Keys.MismatchedDimension_3, name, dimension, dim));
-        }
-    }
-
-    /**
      * Creates a matrix for a transform that keep only a subset of source ordinate values.
      * The matrix size will be ({@code selectedDimensions.length}+1) × ({@code sourceDimensions}+1).
      * The matrix will contain only zero elements, except for the following cells which will contain 1:

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/package-info.java [UTF-8] Tue May  5 16:09:05 2015
@@ -16,7 +16,7 @@
  */
 
 /**
- * Relationship between any two {@linkplain org.apache.sis.referencing.crs.AbstractCRS Coordinate Reference Systems}.
+ * Relationship between any two {@linkplain org.apache.sis.referencing.crs.AbstractCRS Coordinate Reference Systems} (CRS).
  * An explanation for this package is provided in the {@linkplain org.opengis.referencing.operation OpenGIS® javadoc}.
  * The remaining discussion on this page is specific to the Apache SIS implementation.
  *
@@ -48,4 +48,28 @@
  * @since   0.6
  * @module
  */
+@XmlSchema(elementFormDefault= XmlNsForm.QUALIFIED, namespace = Namespaces.GML, xmlns = {
+    @XmlNs(prefix = "gml", namespaceURI = Namespaces.GML),
+    @XmlNs(prefix = "xsi", namespaceURI = Namespaces.XSI)
+})
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlJavaTypeAdapters({
+    @XmlJavaTypeAdapter(EX_Extent.class),
+    @XmlJavaTypeAdapter(DQ_PositionalAccuracy.class),
+    @XmlJavaTypeAdapter(StringAdapter.class),
+    @XmlJavaTypeAdapter(InternationalStringConverter.class)
+})
 package org.apache.sis.referencing.operation;
+
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlSchema;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters;
+import org.apache.sis.xml.Namespaces;
+import org.apache.sis.internal.jaxb.gco.*;
+import org.apache.sis.internal.jaxb.referencing.*;
+import org.apache.sis.internal.jaxb.metadata.EX_Extent;
+import org.apache.sis.internal.jaxb.metadata.DQ_PositionalAccuracy;

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java [UTF-8] Tue May  5 16:09:05 2015
@@ -83,6 +83,7 @@ import static org.apache.sis.util.Argume
  * @module
  *
  * @see DefaultMathTransformFactory
+ * @see org.apache.sis.referencing.operation.AbstractCoordinateOperation
  */
 public abstract class AbstractMathTransform extends FormattableObject
         implements MathTransform, Parameterized, LenientComparable

Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PassThroughTransform.java [UTF-8] Tue May  5 16:09:05 2015
@@ -265,6 +265,8 @@ public class PassThroughTransform extend
      * array in a future SIS version.</div>
      *
      * @return Indices of the modified source coordinates.
+     *
+     * @see org.apache.sis.referencing.operation.DefaultPassThroughOperation#getModifiedCoordinates()
      */
     public final int[] getModifiedCoordinates() {
         final int[] index = new int[subTransform.getSourceDimensions()];
@@ -279,6 +281,8 @@ public class PassThroughTransform extend
      * This is often the sub-transform specified at construction time, but not necessarily.
      *
      * @return The sub-transform.
+     *
+     * @see org.apache.sis.referencing.operation.DefaultPassThroughOperation#getOperation()
      */
     public final MathTransform getSubTransform() {
         return subTransform;

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=1677850&r1=1677849&r2=1677850&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] Tue May  5 16:09:05 2015
@@ -19,7 +19,6 @@ package org.apache.sis.referencing;
 import java.util.Map;
 import java.util.HashMap;
 import java.util.Locale;
-import org.opengis.referencing.IdentifiedObject;
 import org.opengis.test.Validators;
 import org.apache.sis.io.wkt.Convention;
 import org.apache.sis.metadata.iso.ImmutableIdentifier;
@@ -42,9 +41,9 @@ import static org.apache.sis.test.Metada
 /**
  * Tests the {@link AbstractReferenceSystem} class.
  *
- * @author  Martin Desruisseaux (IRD)
+ * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  */
 @DependsOn(AbstractIdentifiedObjectTest.class)
@@ -107,15 +106,18 @@ public final strictfp class AbstractRefe
                 new DefaultGeographicBoundingBox(2.54, 6.40, 51.43, 55.77),
                 new DefaultVerticalExtent(10, 1000, VerticalCRSMock.DEPTH),
                 new DefaultTemporalExtent()))); // TODO: needs sis-temporal module for testing that one.
-        final IdentifiedObject object = new AbstractReferenceSystem(properties);
+        final AbstractReferenceSystem object = new AbstractReferenceSystem(properties);
+
+        assertEquals( // Quotes (at least the closing one) conservatively omitted for WKT 1.
+                "ReferenceSystem[\"My object.\", AUTHORITY[\"EPSG\", \"4326\"]]",
+                object.toString(Convention.WKT1));
 
         assertWktEquals(Convention.WKT1,
-                // Closing quote conservatively omitted for WKT 1.
-                "ReferenceSystem[“My “object.”, AUTHORITY[“EPSG”, “4326”]]",
+                "ReferenceSystem[“My \"object\".”, AUTHORITY[“EPSG”, “4326”]]",
                 object);
 
         assertWktEquals(Convention.WKT2,
-                "ReferenceSystem[“My “object””.”,\n" +
+                "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" +
@@ -125,7 +127,7 @@ public final strictfp class AbstractRefe
                 object);
 
         assertWktEquals(Convention.WKT2_SIMPLIFIED,
-                "ReferenceSystem[“My “object””.”,\n" +
+                "ReferenceSystem[“My \"object\".”,\n" +
                 "  Scope[“Large scale topographic mapping and cadastre.”],\n" +
                 "  Area[“Netherlands offshore.”],\n" +
                 "  BBox[51.43, 2.54, 55.77, 6.40],\n" +
@@ -133,5 +135,15 @@ public final strictfp class AbstractRefe
                 "  Id[“EPSG”, 4326, “8.2”, Citation[“IOGP”], URI[“urn:ogc:def:referenceSystem:EPSG:8.2:4326”]],\n" +
                 "  Remarks[“注です。”]]",
                 object);
+
+        assertWktEquals(Convention.INTERNAL,
+                "ReferenceSystem[“My “object””.”,\n" +  // Quote doubled
+                "  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],\n" +
+                "  Id[“EPSG”, 4326, “8.2”, Citation[“IOGP”]],\n" +
+                "  Remarks[“注です。”]]",
+                object);
     }
 }

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=1677850&r1=1677849&r2=1677850&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] Tue May  5 16:09:05 2015
@@ -153,7 +153,7 @@ public final strictfp class DefaultCompo
                 "  GEOGCS[“WGS 84”,\n" +
                 "    DATUM[“World Geodetic System 1984”,\n" +
                 "      SPHEROID[“WGS84”, 6378137.0, 298.257223563]],\n" +
-                "    PRIMEM[“Greenwich”, 0.0],\n" +
+                "      PRIMEM[“Greenwich”, 0.0],\n" +
                 "    UNIT[“degree”, 0.017453292519943295],\n" +
                 "    AXIS[“Longitude”, EAST],\n" +
                 "    AXIS[“Latitude”, NORTH]],\n" +
@@ -181,18 +181,18 @@ public final strictfp class DefaultCompo
                 "      Ellipsoid[“WGS84”, 6378137.0, 298.257223563, LengthUnit[“metre”, 1]]],\n" +
                 "      PrimeMeridian[“Greenwich”, 0.0, AngleUnit[“degree”, 0.017453292519943295]],\n" +
                 "    CS[“ellipsoidal”, 2],\n" +
-                "      Axis[“Longitude (λ)”, east],\n" +
-                "      Axis[“Latitude (φ)”, north],\n" +
+                "      Axis[“Longitude (L)”, east, Order[1]],\n" +
+                "      Axis[“Latitude (B)”, north, Order[2]],\n" +
                 "      AngleUnit[“degree”, 0.017453292519943295]],\n" +
                 "  VerticalCRS[“Gravity-related height”,\n" +
                 "    VerticalDatum[“Mean Sea Level”],\n" +
                 "    CS[“vertical”, 1],\n" +
-                "      Axis[“Gravity-related height (H)”, up],\n" +
+                "      Axis[“Gravity-related height (H)”, up, Order[1]],\n" +
                 "      LengthUnit[“metre”, 1]],\n" +
                 "  TimeCRS[“Time”,\n" +
                 "    TimeDatum[“Modified Julian”, TimeOrigin[1858-11-17T00:00:00.0Z]],\n" +
                 "    CS[“temporal”, 1],\n" +
-                "      Axis[“Time (t)”, future],\n" +
+                "      Axis[“Time (t)”, future, Order[1]],\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/DefaultGeocentricCRSTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java [UTF-8] Tue May  5 16:09:05 2015
@@ -39,6 +39,8 @@ import static org.apache.sis.test.Metada
 public final strictfp class DefaultGeocentricCRSTest extends TestCase {
     /**
      * Tests WKT 1 formatting.
+     * Axis directions Geocentric X, Y and Z shall be replaced be Other, East and North respectively,
+     * for conformance with legacy WKT 1 practice.
      */
     @Test
     public void testWKT1() {
@@ -46,7 +48,7 @@ public final strictfp class DefaultGeoce
                 "GEOCCS[“Geocentric”,\n" +
                 "  DATUM[“World Geodetic System 1984”,\n" +
                 "    SPHEROID[“WGS84”, 6378137.0, 298.257223563]],\n" +
-                "  PRIMEM[“Greenwich”, 0.0],\n" +
+                "    PRIMEM[“Greenwich”, 0.0],\n" +
                 "  UNIT[“metre”, 1],\n" +
                 "  AXIS[“X”, OTHER],\n" +
                 "  AXIS[“Y”, EAST],\n" +
@@ -71,10 +73,49 @@ public final strictfp class DefaultGeoce
                 "    Ellipsoid[“WGS84”, 6378137.0, 298.257223563, LengthUnit[“metre”, 1]]],\n" +
                 "    PrimeMeridian[“Greenwich”, 0.0, AngleUnit[“degree”, 0.017453292519943295]],\n" +
                 "  CS[“Cartesian”, 3],\n" +
+                "    Axis[“(X)”, geocentricX, Order[1]],\n" +
+                "    Axis[“(Y)”, geocentricY, Order[2]],\n" +
+                "    Axis[“(Z)”, geocentricZ, Order[3]],\n" +
+                "    LengthUnit[“metre”, 1]]",
+                HardCodedCRS.GEOCENTRIC);
+    }
+
+    /**
+     * Tests WKT 2 simplified formatting.
+     */
+    @Test
+    @DependsOnMethod("testWKT2")
+    public void testWKT2_Simplified() {
+        assertWktEquals(Convention.WKT2_SIMPLIFIED,
+                "GeodeticCRS[“Geocentric”,\n" +
+                "  Datum[“World Geodetic System 1984”,\n" +
+                "    Ellipsoid[“WGS84”, 6378137.0, 298.257223563]],\n" +
+                "  CS[“Cartesian”, 3],\n" +
                 "    Axis[“(X)”, geocentricX],\n" +
                 "    Axis[“(Y)”, geocentricY],\n" +
                 "    Axis[“(Z)”, geocentricZ],\n" +
-                "    LengthUnit[“metre”, 1]]",
+                "    Unit[“metre”, 1]]",
+                HardCodedCRS.GEOCENTRIC);
+    }
+
+    /**
+     * Tests WKT 2 internal formatting.
+     */
+    @Test
+    @DependsOnMethod("testWKT2")
+    public void testWKT2_Internal() {
+        assertWktEquals(Convention.INTERNAL,
+                "GeodeticCRS[“Geocentric”,\n" +
+                "  Datum[“World Geodetic System 1984”,\n" +
+                "    Ellipsoid[“WGS84”, 6378137.0, 298.257223563],\n" +
+                "    Scope[“Satellite navigation.”],\n" +
+                "    Id[“EPSG”, 6326]],\n" +
+                "    PrimeMeridian[“Greenwich”, 0.0, Id[“EPSG”, 8901]],\n" +
+                "  CS[“Cartesian”, 3],\n" +
+                "    Axis[“Geocentric X (X)”, geocentricX],\n" +
+                "    Axis[“Geocentric Y (Y)”, geocentricY],\n" +
+                "    Axis[“Geocentric Z (Z)”, geocentricZ],\n" +
+                "    Unit[“metre”, 1]]",
                 HardCodedCRS.GEOCENTRIC);
     }
 }

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeodeticCRSTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeodeticCRSTest.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeodeticCRSTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeodeticCRSTest.java [UTF-8] Tue May  5 16:09:05 2015
@@ -43,7 +43,7 @@ import static org.apache.sis.test.Assert
 })
 public final strictfp class DefaultGeodeticCRSTest extends XMLTestCase {
     /**
-     * An XML file in this package containing a Cartesian coordinate system definition.
+     * An XML file in this package containing a geodetic CRS definition.
      */
     private static final String XML_FILE = "WGS 84.xml";
 

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java [UTF-8] Tue May  5 16:09:05 2015
@@ -143,7 +143,7 @@ public final strictfp class DefaultGeogr
                 "GEOGCS[“WGS 84”,\n" +
                 "  DATUM[“World Geodetic System 1984”,\n" +
                 "    SPHEROID[“WGS84”, 6378137.0, 298.257223563]],\n" +
-                "  PRIMEM[“Greenwich”, 0.0],\n" +
+                "    PRIMEM[“Greenwich”, 0.0],\n" +
                 "  UNIT[“degree”, 0.017453292519943295],\n" +
                 "  AXIS[“Longitude”, EAST],\n" +
                 "  AXIS[“Latitude”, NORTH]]",
@@ -162,30 +162,44 @@ public final strictfp class DefaultGeogr
                 "    Ellipsoid[“WGS84”, 6378137.0, 298.257223563, LengthUnit[“metre”, 1]]],\n" +
                 "    PrimeMeridian[“Greenwich”, 0.0, AngleUnit[“degree”, 0.017453292519943295]],\n" +
                 "  CS[“ellipsoidal”, 2],\n" +
-                "    Axis[“Longitude (λ)”, east],\n" +
-                "    Axis[“Latitude (φ)”, north],\n" +
+                "    Axis[“Longitude (L)”, east, Order[1]],\n" +
+                "    Axis[“Latitude (B)”, north, Order[2]],\n" +
                 "    AngleUnit[“degree”, 0.017453292519943295],\n" +
                 "  Area[“World”],\n" +
                 "  BBox[-90.00, -180.00, 90.00, 180.00]]",
                 HardCodedCRS.WGS84);
+    }
 
+    /**
+     * Tests WKT 2 simplified formatting.
+     */
+    @Test
+    @DependsOnMethod("testWKT2")
+    public void testWKT2_Simplified() {
         assertWktEquals(Convention.WKT2_SIMPLIFIED,
                 "GeodeticCRS[“WGS 84”,\n" +
                 "  Datum[“World Geodetic System 1984”,\n" +
                 "    Ellipsoid[“WGS84”, 6378137.0, 298.257223563]],\n" +
-                "    PrimeMeridian[“Greenwich”, 0.0],\n" +
                 "  CS[“ellipsoidal”, 2],\n" +
-                "    Axis[“Longitude (λ)”, east],\n" +
-                "    Axis[“Latitude (φ)”, north],\n" +
+                "    Axis[“Longitude (L)”, east],\n" +
+                "    Axis[“Latitude (B)”, north],\n" +
                 "    Unit[“degree”, 0.017453292519943295],\n" +
                 "  Area[“World”],\n" +
                 "  BBox[-90.00, -180.00, 90.00, 180.00]]",
                 HardCodedCRS.WGS84);
+    }
 
+    /**
+     * Tests WKT 2 internal formatting.
+     */
+    @Test
+    @DependsOnMethod("testWKT2")
+    public void testWKT2_Internal() {
         assertWktEquals(Convention.INTERNAL,
                 "GeodeticCRS[“WGS 84”,\n" +
                 "  Datum[“World Geodetic System 1984”,\n" +
                 "    Ellipsoid[“WGS84”, 6378137.0, 298.257223563],\n" +
+                "    Scope[“Satellite navigation.”],\n" +
                 "    Id[“EPSG”, 6326]],\n" +
                 "    PrimeMeridian[“Greenwich”, 0.0, Id[“EPSG”, 8901]],\n" +
                 "  CS[“ellipsoidal”, 2],\n" +

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultTemporalCRSTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultTemporalCRSTest.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultTemporalCRSTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultTemporalCRSTest.java [UTF-8] Tue May  5 16:09:05 2015
@@ -55,7 +55,7 @@ public final strictfp class DefaultTempo
                 "TimeCRS[“Time”,\n" +
                 "  TimeDatum[“Modified Julian”, TimeOrigin[1858-11-17T00:00:00.0Z]],\n" +
                 "  CS[“temporal”, 1],\n" +
-                "    Axis[“Time (t)”, future],\n" +
+                "    Axis[“Time (t)”, future, Order[1]],\n" +
                 "    TimeUnit[“day”, 86400]]",
                 HardCodedCRS.TIME);
     }

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultVerticalCRSTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultVerticalCRSTest.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultVerticalCRSTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultVerticalCRSTest.java [UTF-8] Tue May  5 16:09:05 2015
@@ -56,7 +56,7 @@ public final strictfp class DefaultVerti
                 "VerticalCRS[“Depth”,\n" +
                 "  VerticalDatum[“Mean Sea Level”],\n" +
                 "  CS[“vertical”, 1],\n" +
-                "    Axis[“Depth (D)”, down],\n" +
+                "    Axis[“Depth (D)”, down, Order[1]],\n" +
                 "    LengthUnit[“metre”, 1]]",
                 HardCodedCRS.DEPTH);
     }

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/HardCodedCRS.java [UTF-8] Tue May  5 16:09:05 2015
@@ -84,6 +84,8 @@ public final strictfp class HardCodedCRS
      * this CRS is to test operations between CRS having different prime meridian.</p>
      *
      * @since 0.5
+     *
+     * @see DefaultProjectedCRSTest#NTF_ZONE_II
      */
     public static final DefaultGeographicCRS NTF = new DefaultGeographicCRS(
             properties("NTF (Paris)"), HardCodedDatum.NTF, HardCodedCS.GEODETIC_2D);

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxisTest.java [UTF-8] Tue May  5 16:09:05 2015
@@ -38,9 +38,9 @@ import static org.apache.sis.referencing
 /**
  * Tests the {@link DefaultCoordinateSystemAxis} class.
  *
- * @author  Martin Desruisseaux (IRD)
+ * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.6
  * @module
  */
 @DependsOn({
@@ -83,28 +83,32 @@ public final strictfp class DefaultCoord
 
     /**
      * Tests WKT formatting of predefined constants.
+     *
+     * Note that this method can not test the replacement of Greek letters by Latin letters in abbreviations,
+     * because those replacements depend on the {@code CoordinateSystem} context, which is not provided by
+     * this test method.
      */
     @Test
     public void testWKT() {
         assertWktEquals("Axis[“x”, east, LengthUnit[“metre”, 1]]",  X);
         assertWktEquals("Axis[“y”, north, LengthUnit[“metre”, 1]]", Y);
         assertWktEquals("Axis[“z”, up, LengthUnit[“metre”, 1]]",    Z);
-        assertWktEquals("Axis[“Longitude (λ)”, east, AngleUnit[“grade”, 0.015707963267948967]]",            LONGITUDE_gon);
-        assertWktEquals("Axis[“Latitude (φ)”, north, AngleUnit[“grade”, 0.015707963267948967]]",            LATITUDE_gon);
-        assertWktEquals("Axis[“Altitude (h)”, up, LengthUnit[“metre”, 1]]",                                 ALTITUDE);
-        assertWktEquals("Axis[“Time (t)”, future, TimeUnit[“day”, 86400]]",                                 TIME);
-        assertWktEquals("Axis[“Longitude (λ)”, east, AngleUnit[“degree”, 0.017453292519943295]]",           GEODETIC_LONGITUDE);
-        assertWktEquals("Axis[“Spherical longitude (Ω)”, east, AngleUnit[“degree”, 0.017453292519943295]]", SPHERICAL_LONGITUDE);
-        assertWktEquals("Axis[“Latitude (φ)”, north, AngleUnit[“degree”, 0.017453292519943295]]",           GEODETIC_LATITUDE);
-        assertWktEquals("Axis[“Spherical latitude (Θ)”, north, AngleUnit[“degree”, 0.017453292519943295]]", SPHERICAL_LATITUDE);
+        assertWktEquals("Axis[“Longitude (λ)”, east, AngleUnit[“grade”, 0.015707963267948967]]",             LONGITUDE_gon);
+        assertWktEquals("Axis[“Latitude (φ)”, north, AngleUnit[“grade”, 0.015707963267948967]]",             LATITUDE_gon);
+        assertWktEquals("Axis[“Altitude (h)”, up, LengthUnit[“metre”, 1]]",                                  ALTITUDE);
+        assertWktEquals("Axis[“Time (t)”, future, TimeUnit[“day”, 86400]]",                                  TIME);
+        assertWktEquals("Axis[“Longitude (λ)”, east, AngleUnit[“degree”, 0.017453292519943295]]",            GEODETIC_LONGITUDE);
+        assertWktEquals("Axis[“Spherical longitude (θ)”, east, AngleUnit[“degree”, 0.017453292519943295]]",  SPHERICAL_LONGITUDE);
+        assertWktEquals("Axis[“Latitude (φ)”, north, AngleUnit[“degree”, 0.017453292519943295]]",            GEODETIC_LATITUDE);
+        assertWktEquals("Axis[“Spherical latitude (φ')”, north, AngleUnit[“degree”, 0.017453292519943295]]", SPHERICAL_LATITUDE);
 
         assertWktEquals(Convention.WKT1,     "AXIS[“x”, EAST]",  X);
         assertWktEquals(Convention.WKT1,     "AXIS[“y”, NORTH]", Y);
         assertWktEquals(Convention.WKT1,     "AXIS[“z”, UP]",    Z);
-        assertWktEquals(Convention.INTERNAL, "Axis[“Geodetic longitude (λ)”, east, Unit[“degree”, 0.017453292519943295]]",  GEODETIC_LONGITUDE);
-        assertWktEquals(Convention.INTERNAL, "Axis[“Spherical longitude (Ω)”, east, Unit[“degree”, 0.017453292519943295]]", SPHERICAL_LONGITUDE);
-        assertWktEquals(Convention.INTERNAL, "Axis[“Geodetic latitude (φ)”, north, Unit[“degree”, 0.017453292519943295]]",  GEODETIC_LATITUDE);
-        assertWktEquals(Convention.INTERNAL, "Axis[“Spherical latitude (Θ)”, north, Unit[“degree”, 0.017453292519943295]]", SPHERICAL_LATITUDE);
+        assertWktEquals(Convention.INTERNAL, "Axis[“Geodetic longitude (λ)”, east, Unit[“degree”, 0.017453292519943295]]",   GEODETIC_LONGITUDE);
+        assertWktEquals(Convention.INTERNAL, "Axis[“Spherical longitude (θ)”, east, Unit[“degree”, 0.017453292519943295]]",  SPHERICAL_LONGITUDE);
+        assertWktEquals(Convention.INTERNAL, "Axis[“Geodetic latitude (φ)”, north, Unit[“degree”, 0.017453292519943295]]",   GEODETIC_LATITUDE);
+        assertWktEquals(Convention.INTERNAL, "Axis[“Spherical latitude (φ′)”, north, Unit[“degree”, 0.017453292519943295]]", SPHERICAL_LATITUDE);
     }
 
     /**

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/cs/HardCodedAxes.java [UTF-8] Tue May  5 16:09:05 2015
@@ -181,7 +181,7 @@ public final strictfp class HardCodedAxe
      * using {@linkplain org.apache.sis.referencing.cs.DefaultSphericalCS spherical CS}.
      * Increasing ordinates values go {@linkplain AxisDirection#EAST East}
      * and units are {@linkplain NonSI#DEGREE_ANGLE degrees}.
-     * The ISO 19111 name is <cite>"spherical longitude"</cite> and the abbreviation is "Ω" (omega).
+     * The ISO 19111 name is <cite>"spherical longitude"</cite> and the abbreviation is "θ" (theta).
      *
      * <p>This axis is usually part of a {@link #SPHERICAL_LONGITUDE}, {@link #SPHERICAL_LATITUDE},
      * {@link #GEOCENTRIC_RADIUS} set.</p>
@@ -189,7 +189,7 @@ public final strictfp class HardCodedAxe
      * @see #GEODETIC_LONGITUDE
      * @see #SPHERICAL_LATITUDE
      */
-    public static final DefaultCoordinateSystemAxis SPHERICAL_LONGITUDE = create("Spherical longitude", "Ω",
+    public static final DefaultCoordinateSystemAxis SPHERICAL_LONGITUDE = create("Spherical longitude", "θ",
             AxisDirection.EAST, NonSI.DEGREE_ANGLE, -180, 180, RangeMeaning.WRAPAROUND);
 
     /**
@@ -197,7 +197,7 @@ public final strictfp class HardCodedAxe
      * using {@linkplain org.apache.sis.referencing.cs.DefaultSphericalCS spherical CS}.
      * Increasing ordinates values go {@linkplain AxisDirection#NORTH North}
      * and units are {@linkplain NonSI#DEGREE_ANGLE degrees}.
-     * The ISO 19111 name is <cite>"spherical latitude"</cite> and the abbreviation is "Θ" (theta).
+     * The ISO 19111 name is <cite>"spherical latitude"</cite> and the abbreviation is "φ′" (phi).
      *
      * <p>This axis is usually part of a {@link #SPHERICAL_LONGITUDE}, {@link #SPHERICAL_LATITUDE},
      * {@link #GEOCENTRIC_RADIUS} set.</p>
@@ -205,7 +205,7 @@ public final strictfp class HardCodedAxe
      * @see #GEODETIC_LATITUDE
      * @see #SPHERICAL_LONGITUDE
      */
-    public static final DefaultCoordinateSystemAxis SPHERICAL_LATITUDE = create("Spherical latitude", "Θ",
+    public static final DefaultCoordinateSystemAxis SPHERICAL_LATITUDE = create("Spherical latitude", "φ′",
             AxisDirection.NORTH, NonSI.DEGREE_ANGLE, -90, 90, RangeMeaning.EXACT);
 
     /**

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/HardCodedDatum.java [UTF-8] Tue May  5 16:09:05 2015
@@ -27,7 +27,7 @@ import org.apache.sis.referencing.NamedI
 import org.apache.sis.internal.referencing.VerticalDatumTypes;
 import org.apache.sis.metadata.iso.citation.HardCodedCitations;
 
-import static org.opengis.referencing.IdentifiedObject.*;
+import static org.opengis.referencing.datum.Datum.*;
 
 
 /**
@@ -43,7 +43,8 @@ public final strictfp class HardCodedDat
      * Greenwich meridian (EPSG:8901), with angular measurements in decimal degrees.
      */
     public static final DefaultPrimeMeridian GREENWICH = new DefaultPrimeMeridian(
-            properties("Greenwich", "8901"), 0, NonSI.DEGREE_ANGLE);
+            properties("Greenwich", "8901", null),
+            0, NonSI.DEGREE_ANGLE);
 
     /**
      * Paris meridian (EPSG:8903), with angular measurements in grad.
@@ -51,7 +52,8 @@ public final strictfp class HardCodedDat
      * @since 0.5
      */
     public static final DefaultPrimeMeridian PARIS = new DefaultPrimeMeridian(
-            properties("Paris", "8903"), 2.5969213, NonSI.GRADE);
+            properties("Paris", "8903", null),
+            2.5969213, NonSI.GRADE);
 
     /**
      * Old Paris meridian (EPSG:8914) defined as 2°20'13.95"E.
@@ -63,14 +65,15 @@ public final strictfp class HardCodedDat
      * @since 0.5
      */
     public static final DefaultPrimeMeridian PARIS_RGS = new DefaultPrimeMeridian(
-            properties("Paris RGS", "8914"), 2 + (20 + 13.95/60)/60, NonSI.DEGREE_ANGLE);
+            properties("Paris RGS", "8914", null),
+            2 + (20 + 13.95/60)/60, NonSI.DEGREE_ANGLE);
 
     /**
      * WGS 1984 datum (EPSG:6326). Prime meridian is Greenwich.
      * This datum is used in GPS systems.
      */
     public static final DefaultGeodeticDatum WGS84 = new DefaultGeodeticDatum(
-            properties("World Geodetic System 1984", "6326"),
+            properties("World Geodetic System 1984", "6326", "Satellite navigation."),
             new DefaultEllipsoid(GeodeticDatumMock.WGS84.getEllipsoid()), GREENWICH);
 
     /**
@@ -80,7 +83,7 @@ public final strictfp class HardCodedDat
      * Earth Gravitational Model}.
      */
     public static final DefaultGeodeticDatum WGS72 = new DefaultGeodeticDatum(
-            properties("World Geodetic System 1972", "6322"),
+            properties("World Geodetic System 1972", "6322", "Satellite navigation."),
             new DefaultEllipsoid(GeodeticDatumMock.WGS84.getEllipsoid()), GREENWICH);
 
     /**
@@ -89,62 +92,70 @@ public final strictfp class HardCodedDat
      * @since 0.5
      */
     public static final DefaultGeodeticDatum NTF = new DefaultGeodeticDatum(
-            properties("Nouvelle Triangulation Française", "6807"),
+            properties("Nouvelle Triangulation Française", "6807", "Topographic mapping."),
             new DefaultEllipsoid(GeodeticDatumMock.NTF.getEllipsoid()), PARIS);
 
     /**
      * Spherical datum based on GRS 1980 Authalic Sphere (EPSG:6047). Prime meridian is Greenwich.
      */
     public static final DefaultGeodeticDatum SPHERE = new DefaultGeodeticDatum(
-            properties("Not specified (based on GRS 1980 Authalic Sphere)", "6047"),
+            properties("Not specified (based on GRS 1980 Authalic Sphere)", "6047", "Not a valid datum."),
             new DefaultEllipsoid(GeodeticDatumMock.SPHERE.getEllipsoid()), GREENWICH);
 
     /**
      * Mean sea level, which can be used as an approximation of geoid.
      */
     public static final DefaultVerticalDatum MEAN_SEA_LEVEL = new DefaultVerticalDatum(
-            properties("Mean Sea Level", "5100"), VerticalDatumType.GEOIDAL);
+            properties("Mean Sea Level", "5100", "Hydrography."),
+            VerticalDatumType.GEOIDAL);
 
     /**
      * Ellipsoid for measurements of height above the ellipsoid.
      * This is not a valid datum according ISO 19111, but is used by Apache SIS for internal calculation.
      */
     public static final DefaultVerticalDatum ELLIPSOID = new DefaultVerticalDatum(
-            properties("Ellipsoid", null), VerticalDatumTypes.ELLIPSOIDAL);
+            properties("Ellipsoid", null, "Not a valid datum."),
+            VerticalDatumTypes.ELLIPSOIDAL);
 
     /**
      * Default datum for time measured since January 1st, 1970 at 00:00 UTC.
      */
     public static final DefaultTemporalDatum UNIX = new DefaultTemporalDatum(
-            properties("UNIX", null), new Date(0));
+            properties("UNIX", null, null),
+            new Date(0));
 
     /**
      * Default datum for time measured since November 17, 1858 at 00:00 UTC.
      */
     public static final DefaultTemporalDatum MODIFIED_JULIAN = new DefaultTemporalDatum(
-            properties("Modified Julian", null), new Date(-40587 * (24*60*60*1000L)));
+            properties("Modified Julian", null, null),
+            new Date(-40587 * (24*60*60*1000L)));
 
     /**
      * Image with {@link PixelInCell#CELL_CENTER}.
      */
     public static final DefaultImageDatum IMAGE = new DefaultImageDatum(
-            properties("Image", null), PixelInCell.CELL_CENTER);
+            properties("Image", null, null),
+            PixelInCell.CELL_CENTER);
 
     /**
      * An engineering datum for unknown coordinate reference system. Such CRS are usually
      * assumed Cartesian, but will not have any transformation path to other CRS.
      */
-    public static final DefaultEngineeringDatum UNKNOWN = new DefaultEngineeringDatum(properties("Unknown", null));
+    public static final DefaultEngineeringDatum UNKNOWN = new DefaultEngineeringDatum(properties("Unknown", null, null));
 
     /**
      * Creates a map of properties for the given name and EPSG code.
      */
-    private static Map<String,?> properties(final String name, final String code) {
+    private static Map<String,?> properties(final String name, final String code, final String scope) {
         final Map<String,Object> properties = new HashMap<String,Object>(4);
         properties.put(NAME_KEY, name);
         if (code != null) {
             properties.put(IDENTIFIERS_KEY, new NamedIdentifier(HardCodedCitations.EPSG, code));
         }
+        if (scope != null) {
+            properties.put(SCOPE_KEY, scope);
+        }
         return properties;
     }
 

Modified: sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Tue May  5 16:09:05 2015
@@ -90,8 +90,8 @@ import org.junit.BeforeClass;
     // Registration of map projections and other math transforms.
     org.apache.sis.referencing.operation.DefaultFormulaTest.class,
     org.apache.sis.referencing.operation.DefaultOperationMethodTest.class,
+    org.apache.sis.referencing.operation.AbstractSingleOperationTest.class,
     org.apache.sis.referencing.operation.transform.OperationMethodSetTest.class,
-    org.apache.sis.internal.referencing.OperationMethodsTest.class,
     org.apache.sis.internal.referencing.provider.AffineTest.class,
     org.apache.sis.internal.referencing.provider.LongitudeRotationTest.class,
     org.apache.sis.internal.referencing.provider.MapProjectionTest.class,
@@ -126,6 +126,7 @@ import org.junit.BeforeClass;
     org.apache.sis.referencing.crs.DefaultGeodeticCRSTest.class,
     org.apache.sis.referencing.crs.DefaultGeocentricCRSTest.class,
     org.apache.sis.referencing.crs.DefaultGeographicCRSTest.class,
+    org.apache.sis.referencing.crs.DefaultProjectedCRSTest.class,
     org.apache.sis.referencing.crs.DefaultVerticalCRSTest.class,
     org.apache.sis.referencing.crs.DefaultTemporalCRSTest.class,
     org.apache.sis.referencing.crs.SubTypesTest.class,

Modified: sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/WGS 84.xml
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/WGS%2084.xml?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/WGS 84.xml (original)
+++ sis/trunk/core/sis-referencing/src/test/resources/org/apache/sis/referencing/crs/WGS 84.xml Tue May  5 16:09:05 2015
@@ -18,11 +18,11 @@
   under the License.
 -->
 <gml:GeodeticCRS xsi:schemaLocation = "http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/coordinateReferenceSystems.xsd"
-                   xmlns:gml          = "http://www.opengis.net/gml/3.2"
-                   xmlns:gmd          = "http://www.isotc211.org/2005/gmd"
-                   xmlns:gco          = "http://www.isotc211.org/2005/gco"
-                   xmlns:xsi          = "http://www.w3.org/2001/XMLSchema-instance"
-                   gml:id             = "epsg-crs-4326">
+                 xmlns:gml          = "http://www.opengis.net/gml/3.2"
+                 xmlns:gmd          = "http://www.isotc211.org/2005/gmd"
+                 xmlns:gco          = "http://www.isotc211.org/2005/gco"
+                 xmlns:xsi          = "http://www.w3.org/2001/XMLSchema-instance"
+                 gml:id             = "epsg-crs-4326">
 
   <gml:identifier codeSpace="IOGP">urn:ogc:def:crs:EPSG::4326</gml:identifier>
   <gml:name>WGS 84</gml:name>

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/TM_Primitive.java [UTF-8] Tue May  5 16:09:05 2015
@@ -166,6 +166,8 @@ public final class TM_Primitive extends
      * @param e the exception.
      */
     private static void warningOccured(final String method, final Exception e) {
-        Context.warningOccured(Context.current(), TM_Primitive.class, method, e, true);
+        if (TemporalUtilities.REPORT_MISSING_MODULE || !e.getMessage().contains("sis-temporal")) {
+            Context.warningOccured(Context.current(), TM_Primitive.class, method, e, true);
+        }
     }
 }

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java [UTF-8] Tue May  5 16:09:05 2015
@@ -23,6 +23,8 @@ import org.opengis.metadata.Identifier;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.util.InternationalString;
 import org.apache.sis.xml.IdentifierSpace;
+import org.apache.sis.util.CharSequences;
+import org.apache.sis.util.Characters;
 import org.apache.sis.util.Static;
 
 import static org.apache.sis.util.CharSequences.equalsFiltered;
@@ -231,6 +233,71 @@ public final class Citations extends Sta
     }
 
     /**
+     * Returns {@code true} if the given identifier authority matches the given {@code authority}.
+     * If one of the authority is null, then the comparison fallback on the given {@code codeSpace}.
+     * If the code spaces are also null, then this method conservatively returns {@code false}.
+     *
+     * @param  identifier The identifier to compare.
+     * @param  authority  The desired authority, or {@code null}.
+     * @param  codeSpace  The desired code space or {@code null}, used as a fallback if an authority is null.
+     * @return {@code true} if the authority or code space (as a fallback only) matches.
+     */
+    private static boolean authorityMatches(final Identifier identifier, final Citation authority, final String codeSpace) {
+        if (authority != null) {
+            final Citation other = identifier.getAuthority();
+            if (other != null) {
+                return identifierMatches(authority, other);
+            }
+        }
+        if (codeSpace != null && identifier instanceof ReferenceIdentifier) {
+            final String other = ((ReferenceIdentifier) identifier).getCodeSpace();
+            if (other != null) {
+                return CharSequences.equalsFiltered(codeSpace, other, Characters.Filter.UNICODE_IDENTIFIER, true);
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Determines whether a match or mismatch is found between the two given collections of identifiers.
+     * If any of the given collections is {@code null} or empty, then this method returns {@code null}.
+     *
+     * <p>According ISO 19162 (<cite>Well known text representation of coordinate reference systems</cite>),
+     * {@linkplain org.apache.sis.referencing.AbstractIdentifiedObject#getIdentifiers() identifiers} should have precedence over
+     * {@linkplain org.apache.sis.referencing.AbstractIdentifiedObject#getName() name} for identifying {@code IdentifiedObject}s,
+     * at least in the case of {@linkplain org.apache.sis.referencing.operation.DefaultOperationMethod operation methods} and
+     * {@linkplain org.apache.sis.parameter.AbstractParameterDescriptor parameters}.</p>
+     *
+     * @param  id1 The first collection of identifiers, or {@code null}.
+     * @param  id2 The second collection of identifiers, or {@code null}.
+     * @return {@code TRUE} or {@code FALSE} on match or mismatch respectively, or {@code null} if this method
+     *         can not determine if there is a match or mismatch.
+     */
+    public static Boolean hasCommonIdentifier(final Iterable<? extends Identifier> id1,
+                                              final Iterable<? extends Identifier> id2)
+    {
+        if (id1 != null && id2 != null) {
+            boolean hasFound = false;
+            for (final Identifier identifier : id1) {
+                final Citation authority = identifier.getAuthority();
+                final String codeSpace = (identifier instanceof ReferenceIdentifier) ? ((ReferenceIdentifier) identifier).getCodeSpace() : null;
+                for (final Identifier other : id2) {
+                    if (authorityMatches(identifier, authority, codeSpace)) {
+                        if (CharSequences.equalsFiltered(identifier.getCode(), other.getCode(), Characters.Filter.UNICODE_IDENTIFIER, true)) {
+                            return Boolean.TRUE;
+                        }
+                        hasFound = true;
+                    }
+                }
+            }
+            if (hasFound) {
+                return Boolean.FALSE;
+            }
+        }
+        return null;
+    }
+
+    /**
      * Infers an identifier from the given citation, or returns {@code null} if no identifier has been found.
      * This method removes leading and trailing {@linkplain Character#isWhitespace(int) whitespaces}.
      * See {@link org.apache.sis.metadata.iso.citation.Citations#getIdentifier(Citation)}

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java [UTF-8] Tue May  5 16:09:05 2015
@@ -123,6 +123,21 @@ public final class CollectionsExt extend
     }
 
     /**
+     * Returns a copy of the given array as a non-empty immutable set.
+     * If the given array is empty, then this method returns {@code null}.
+     *
+     * @param  <T> The type of elements.
+     * @param  elements The elements to copy in a set.
+     * @return An unmodifiable set which contains all the given elements, or {@code null}.
+     *
+     * @since 0.6
+     */
+    public static <T> Set<T> nonEmptySet(final T... elements) {
+        final Set<T> asSet = immutableSet(true, elements);
+        return (asSet != null && asSet.isEmpty()) ? null : asSet;
+    }
+
+    /**
      * Returns the given array if non-empty, or {@code null} if the given array is null or empty.
      * This method is generally not recommended, since public API should prefer empty array instead of null.
      * However this method is occasionally useful for managing private fields.

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/TemporalUtilities.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/TemporalUtilities.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/TemporalUtilities.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/internal/util/TemporalUtilities.java [UTF-8] Tue May  5 16:09:05 2015
@@ -37,6 +37,15 @@ import org.apache.sis.internal.system.De
  */
 public final class TemporalUtilities extends Static {
     /**
+     * {@code true} if the SIS library should log the "This operation requires the sis-temporal module" warning.
+     * This flag can be {@code true} during development phase, but should be set to {@code false} in SIS releases
+     * until we can really provide a sis-temporal module.
+     *
+     * This constant will be removed after SIS release a sis-temporal module.
+     */
+    public static final boolean REPORT_MISSING_MODULE = true;
+
+    /**
      * Do not allow instantiation of this class.
      */
     private TemporalUtilities() {

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/ArgumentChecks.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/ArgumentChecks.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/ArgumentChecks.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/ArgumentChecks.java [UTF-8] Tue May  5 16:09:05 2015
@@ -81,7 +81,7 @@ import org.apache.sis.util.resources.Err
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.4
+ * @version 0.6
  * @module
  */
 public final class ArgumentChecks extends Static {
@@ -593,6 +593,30 @@ public final class ArgumentChecks extend
             }
         }
     }
+
+    /**
+     * Ensures that the given coordinate system, if non-null, has the expected number of dimensions.
+     * This method does nothing if the given coordinate system is null.
+     *
+     * @param  name     The name of the argument to be checked. Used only if an exception is thrown.
+     * @param  expected The expected number of dimensions.
+     * @param  cs       The coordinate system to check for its dimension, or {@code null}.
+     * @throws MismatchedDimensionException if the given coordinate system is non-null
+     *         and does not have the expected number of dimensions.
+     *
+     * @since 0.6
+     */
+    public static void ensureDimensionMatches(final String name, final int expected,
+            final CoordinateSystem cs) throws MismatchedDimensionException
+    {
+        if (cs != null) {
+            final int dimension = cs.getDimension();
+            if (dimension != expected) {
+                throw new MismatchedDimensionException(Errors.format(
+                        Errors.Keys.MismatchedDimension_3, name, expected, dimension));
+            }
+        }
+    }
 
     /**
      * Ensures that the given vector, if non-null, has the expected number of dimensions

Modified: sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java?rev=1677850&r1=1677849&r2=1677850&view=diff
==============================================================================
--- sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java [UTF-8] (original)
+++ sis/trunk/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java [UTF-8] Tue May  5 16:09:05 2015
@@ -925,8 +925,14 @@ search:     for (; fromIndex <= toIndex;
      * Replaces some Unicode characters by ASCII characters on a "best effort basis".
      * For example the {@code 'é'} character is replaced by {@code 'e'} (without accent).
      *
-     * <p>The current implementation replaces only the characters in the range {@code 00C0}
-     * to {@code 00FF}, inclusive. Other characters are left unchanged.</p>
+     * <p>The current implementation replaces the characters in the range {@code 00C0}
+     * to {@code 00FF} (inclusive) and some space and punctuation characters.</p>
+     *
+     * <div class="note"><b>Note:</b>
+     * the replacement of Greek letters is a more complex task than what this method can do,
+     * since it depends on the context. For example if the Greek letters are abbreviations
+     * for coordinate system axes like φ and λ, then the replacements depend on the enclosing
+     * coordinate system. See {@link org.apache.sis.io.wkt.CharEncoding} for more information.</div>
      *
      * @param  text The text to scan for Unicode characters to replace by ASCII characters,
      *         or {@code null}.
@@ -934,6 +940,7 @@ search:     for (; fromIndex <= toIndex;
      *         has been applied, or {@code null} if the given text was null.
      *
      * @see StringBuilders#toASCII(StringBuilder)
+     * @see org.apache.sis.io.wkt.CharEncoding#filter(String)
      */
     public static CharSequence toASCII(final CharSequence text) {
         return StringBuilders.toASCII(text, null);



Mime
View raw message