sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1723780 [2/12] - in /sis/branches/JDK7: ./ application/sis-console/src/main/artifact/bin/ application/sis-console/src/main/artifact/log/ application/sis-console/src/main/java/org/apache/sis/console/ core/sis-build-helper/src/main/java/org/...
Date Fri, 08 Jan 2016 18:29:07 GMT
Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffineBetweenGeographic.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffineBetweenGeographic.java?rev=1723780&r1=1723779&r2=1723780&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffineBetweenGeographic.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffineBetweenGeographic.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -109,6 +109,18 @@ public abstract class GeocentricAffineBe
     }
 
     /**
+     * Notifies {@code DefaultMathTransformFactory} that map projections require values for the
+     * {@code "src_semi_major"}, {@code "src_semi_minor"} , {@code "tgt_semi_major"} and
+     * {@code "tgt_semi_minor"} parameters.
+     *
+     * @return 3, meaning that the operation requires source and target ellipsoids.
+     */
+    @Override
+    public final int getEllipsoidsMask() {
+        return 3;
+    }
+
+    /**
      * Creates a math transform from the specified group of parameter values.
      * This method wraps the affine operation into Geographic/Geocentric conversions.
      *
@@ -144,7 +156,7 @@ public abstract class GeocentricAffineBe
         try {
             toGeographic = toGeographic.inverse();
         } catch (NoninvertibleTransformException e) {
-            throw new FactoryException(e);  // Should never happen with SIS implementation.
+            throw new FactoryException(e);                  // Should never happen with SIS implementation.
         }
         /*
          * The  Geocentric → Affine → Geographic  chain.

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricToGeographic.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricToGeographic.java?rev=1723780&r1=1723779&r2=1723780&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricToGeographic.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricToGeographic.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -77,6 +77,17 @@ public final class GeocentricToGeographi
     }
 
     /**
+     * Notifies {@code DefaultMathTransformFactory} that Geographic/geocentric conversions
+     * require values for the {@code "semi_major"} and {@code "semi_minor"} parameters.
+     *
+     * @return 2, meaning that the operation requires a target ellipsoid.
+     */
+    @Override
+    public int getEllipsoidsMask() {
+        return 2;
+    }
+
+    /**
      * Creates a transform from the specified group of parameter values.
      *
      * @param  factory The factory to use for creating the transform.
@@ -92,7 +103,7 @@ public final class GeocentricToGeographi
         try {
             tr = tr.inverse();
         } catch (NoninvertibleTransformException e) {
-            throw new FactoryException(e);
+            throw new FactoryException(e);                  // Should never happen with SIS implementation.
         }
         return tr;
     }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2D.java?rev=1723780&r1=1723779&r2=1723780&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2D.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2D.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -103,11 +103,11 @@ public final class Geographic3Dto2D exte
     {
         if (transform == null) try {
             final MatrixSIS m = Matrices.createDiagonal(4, 3);
-            m.setElement(2, 2, 0);  // Here is the height value that we want.
+            m.setElement(2, 2, 0);                                  // Here is the height value that we want.
             m.setElement(3, 2, 1);
             transform = MathTransforms.linear(m).inverse();
         } catch (NoninvertibleTransformException e) {
-            throw new FactoryException(e);  // Should never happen.
+            throw new FactoryException(e);                          // Should never happen.
         }
         return transform;
     }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets.java?rev=1723780&r1=1723779&r2=1723780&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -16,24 +16,26 @@
  */
 package org.apache.sis.internal.referencing.provider;
 
-import javax.xml.bind.annotation.XmlTransient;
+import javax.measure.unit.SI;
 import javax.measure.unit.NonSI;
+import javax.xml.bind.annotation.XmlTransient;
+import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
 import org.opengis.parameter.ParameterNotFoundException;
-import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.MathTransformFactory;
 import org.opengis.referencing.operation.Transformation;
-import org.apache.sis.internal.referencing.j2d.AffineTransform2D;
 import org.apache.sis.parameter.ParameterBuilder;
 import org.apache.sis.parameter.Parameters;
+import org.apache.sis.referencing.operation.matrix.Matrix4;
+import org.apache.sis.referencing.operation.transform.MathTransforms;
 
 
 /**
- * The provider for <cite>"Geographic2D offsets"</cite> (EPSG:9619).
- * The default implementation handles the 2D case.
- * The {@link GeographicOffsets3D} subclass adds a third dimension.
+ * Base class for all transformations that perform a translation in the geographic domain.
+ * This base class defines a provider for <cite>"Geographic3D offsets"</cite> (EPSG:9660),
+ * but subclasses will provide different operations.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.7
@@ -58,28 +60,34 @@ public class GeographicOffsets extends A
     static final ParameterDescriptor<Double> TY;
 
     /**
+     * The operation parameter descriptor for the <cite>"Vertical Offset"</cite> parameter value.
+     */
+    static final ParameterDescriptor<Double> TZ;
+
+    /**
      * The group of all parameters expected by this coordinate operation.
      */
     private static final ParameterDescriptorGroup PARAMETERS;
     static {
         final ParameterBuilder builder = builder();
-        TY = builder.addIdentifier("8601").addName("Latitude offset").create(0, NonSI.DEGREE_ANGLE);
+        TY = builder.addIdentifier("8601").addName("Latitude offset") .create(0, NonSI.DEGREE_ANGLE);
         TX = builder.addIdentifier("8602").addName("Longitude offset").create(0, NonSI.DEGREE_ANGLE);
-        PARAMETERS = builder.addIdentifier("9619").addName("Geographic2D offsets").createGroup(TY, TX);
+        TZ = builder.addIdentifier("8603").addName("Vertical Offset") .create(0, SI.METRE);
+        PARAMETERS = builder.addIdentifier("9660").addName("Geographic3D offsets").createGroup(TY, TX, TZ);
     }
 
     /**
      * Constructs a provider with default parameters.
      */
     public GeographicOffsets() {
-        super(2, 2, PARAMETERS);
+        super(3, 3, PARAMETERS);
     }
 
     /**
-     * For subclass constructor only.
+     * For subclasses constructor only.
      */
-    GeographicOffsets(ParameterDescriptorGroup parameters) {
-        super(3, 3, parameters);
+    GeographicOffsets(int dim, ParameterDescriptorGroup parameters) {
+        super(dim, dim, parameters);
     }
 
     /**
@@ -94,7 +102,7 @@ public class GeographicOffsets extends A
 
     /**
      * Creates a transform from the specified group of parameter values.
-     * The parameter values are unconditionally converted to degrees.
+     * The parameter values are unconditionally converted to degrees and metres.
      *
      * @param  factory Ignored (can be null).
      * @param  values The group of parameter values.
@@ -106,6 +114,10 @@ public class GeographicOffsets extends A
             throws ParameterNotFoundException
     {
         final Parameters pv = Parameters.castOrWrap(values);
-        return new AffineTransform2D(1, 0, 0, 1, pv.doubleValue(TX), pv.doubleValue(TY));
+        final Matrix4 t = new Matrix4();
+        t.m03 = pv.doubleValue(TX);
+        t.m13 = pv.doubleValue(TY);
+        t.m23 = pv.doubleValue(TZ);
+        return MathTransforms.linear(t);
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicToGeocentric.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicToGeocentric.java?rev=1723780&r1=1723779&r2=1723780&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicToGeocentric.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicToGeocentric.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -84,6 +84,17 @@ public final class GeographicToGeocentri
     }
 
     /**
+     * Notifies {@code DefaultMathTransformFactory} that Geographic/geocentric conversions
+     * require values for the {@code "semi_major"} and {@code "semi_minor"} parameters.
+     *
+     * @return 1, meaning that the operation requires a source ellipsoid.
+     */
+    @Override
+    public int getEllipsoidsMask() {
+        return 1;
+    }
+
+    /**
      * Creates a transform from the specified group of parameter values.
      *
      * @param  factory The factory to use for creating the transform.

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LongitudeRotation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LongitudeRotation.java?rev=1723780&r1=1723779&r2=1723780&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LongitudeRotation.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LongitudeRotation.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -20,7 +20,6 @@ import javax.xml.bind.annotation.XmlTran
 import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.parameter.ParameterDescriptorGroup;
 import org.opengis.parameter.ParameterNotFoundException;
-import org.opengis.referencing.operation.Transformation;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.MathTransformFactory;
 import org.apache.sis.internal.referencing.j2d.AffineTransform2D;
@@ -45,11 +44,11 @@ import org.apache.sis.parameter.Paramete
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.6
- * @version 0.6
+ * @version 0.7
  * @module
  */
 @XmlTransient
-public final class LongitudeRotation extends AbstractProvider {
+public final class LongitudeRotation extends GeographicOffsets {
     /**
      * Serial number for inter-operability with different versions.
      */
@@ -60,24 +59,14 @@ public final class LongitudeRotation ext
      */
     private static final ParameterDescriptorGroup PARAMETERS;
     static {
-        PARAMETERS = builder().addIdentifier("9601").addName("Longitude rotation").createGroup(GeographicOffsets.TX);
+        PARAMETERS = builder().addIdentifier("9601").addName("Longitude rotation").createGroup(TX);
     }
 
     /**
      * Constructs a provider with default parameters.
      */
     public LongitudeRotation() {
-        super(2, 2, PARAMETERS);
-    }
-
-    /**
-     * Returns the operation type.
-     *
-     * @return Interface implemented by all coordinate operations that use this method.
-     */
-    @Override
-    public Class<Transformation> getOperationType() {
-        return Transformation.class;
+        super(2, PARAMETERS);
     }
 
     /**
@@ -100,7 +89,7 @@ public final class LongitudeRotation ext
     public MathTransform createMathTransform(final MathTransformFactory factory, final ParameterValueGroup values)
             throws ParameterNotFoundException
     {
-        final double offset = Parameters.castOrWrap(values).doubleValue(GeographicOffsets.TX);
-        return new AffineTransform2D(1, 0, 0, 1, offset, 0);
+        final Parameters pv = Parameters.castOrWrap(values);
+        return new AffineTransform2D(1, 0, 0, 1, pv.doubleValue(TX), 0);
     }
 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java?rev=1723780&r1=1723779&r2=1723780&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -203,6 +203,17 @@ public abstract class MapProjection exte
      */
     protected abstract NormalizedProjection createProjection(final Parameters parameters) throws ParameterNotFoundException;
 
+    /**
+     * Notifies {@code DefaultMathTransformFactory} that map projections require
+     * values for the {@code "semi_major"} and {@code "semi_minor"} parameters.
+     *
+     * @return 1, meaning that the operation requires a source ellipsoid.
+     */
+    @Override
+    public final int getEllipsoidsMask() {
+        return 1;
+    }
+
 
 
 

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Molodensky.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Molodensky.java?rev=1723780&r1=1723779&r2=1723780&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Molodensky.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Molodensky.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -96,27 +96,24 @@ public final class Molodensky extends Ge
         final ParameterBuilder builder = builder();
         AXIS_LENGTH_DIFFERENCE = builder.addName("Semi-major axis length difference").create(Double.NaN, SI.METRE);
         FLATTENING_DIFFERENCE  = builder.addName("Flattening difference").createBounded(-1, +1, Double.NaN, Unit.ONE);
-        builder.setRequired(false);
-        ParameterDescriptor<Double> a = builder.addName(TGT_SEMI_MAJOR.getName()).createStrictlyPositive(Double.NaN, SI.METRE);
-        ParameterDescriptor<Double> b = builder.addName(TGT_SEMI_MINOR.getName()).createStrictlyPositive(Double.NaN, SI.METRE);
         PARAMETERS = builder.setRequired(true)
                 .addIdentifier("9604")
                 .addName("Molodensky")
                 .addName(Citations.OGC, "Molodenski")
                 .createGroup(DIMENSION,                         // OGC only
+                             SRC_SEMI_MAJOR, SRC_SEMI_MINOR,    // OGC only
+                             TGT_SEMI_MAJOR, TGT_SEMI_MINOR,    // OGC only - redundant with differences
                              TX,                                // OGC and EPSG
                              TY,                                // OGC and EPSG
                              TZ,                                // OGC and EPSG
                              AXIS_LENGTH_DIFFERENCE,            // EPSG only
-                             FLATTENING_DIFFERENCE,             // EPSG only
-                             SRC_SEMI_MAJOR, SRC_SEMI_MINOR,    // OGC only
-                             a, b);                             // OGC only
+                             FLATTENING_DIFFERENCE);            // EPSG only
     }
 
     /**
      * Creates a descriptor for the internal parameters of {@link MolodenskyTransform}.
-     * This is identical to the standard parameters except that the last 3 OGC parameters
-     * are replaced by the eccentricity.
+     * This is similar to the standard parameters except that the redundant target axes
+     * lengths are omitted.
      *
      * @return Internal parameter descriptor.
      */
@@ -126,19 +123,19 @@ public final class Molodensky extends Ge
         ParameterDescriptor<Boolean> abridged = builder.addName("abridged").create(Boolean.class, null);
         return builder.addName("Molodensky")
                 .createGroup(DIMENSION,
+                             SRC_SEMI_MAJOR,
+                             SRC_SEMI_MINOR,
+                             AXIS_LENGTH_DIFFERENCE,
+                             FLATTENING_DIFFERENCE,
                              TX,
                              TY,
                              TZ,
-                             AXIS_LENGTH_DIFFERENCE,
-                             FLATTENING_DIFFERENCE,
-                             SRC_SEMI_MAJOR,
-                             MapProjection.ECCENTRICITY,
                              abridged);
     }
 
     /**
      * The providers for all combinations between 2D and 3D cases.
-     * Array length is 4. Index is build with following rule:
+     * Array length is 4. Index is built with following rule:
      * <ul>
      *   <li>Bit 1: dimension of source coordinates (0 for 2D, 1 for 3D).</li>
      *   <li>Bit 0: dimension of target coordinates (0 for 2D, 1 for 3D).</li>

Copied: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NADCON.java (from r1723735, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NADCON.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NADCON.java?p2=sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NADCON.java&p1=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NADCON.java&r1=1723735&r2=1723780&rev=1723780&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NADCON.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NADCON.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -232,6 +232,11 @@ public final class NADCON extends Abstra
         private static final String NADCON = "NADCON";
 
         /**
+         * The size of data in the binary file, in bytes.
+         */
+        private static final int DATA_SIZE = Float.SIZE / Byte.SIZE;
+
+        /**
          * Longitude and latitude of of the first value in the first record, in degrees.
          */
         private final float x0, y0;
@@ -303,7 +308,7 @@ public final class NADCON extends Abstra
                 throw unexpectedFormat();
             }
             if (ascii == null) {
-                skip((nx + 1) * Float.BYTES - buffer.position());
+                skip((nx + 1) * DATA_SIZE - buffer.position());
             }
         }
 
@@ -449,8 +454,8 @@ public final class NADCON extends Abstra
          * from the channel, but the channel will usually give us as many data as the buffer can contain.
          */
         private void fillBuffer(final FloatBuffer fb) throws IOException {
-            buffer.position(fb.position() * Float.BYTES).limit(fb.limit() * Float.BYTES);
-            ensureBufferContains(Float.BYTES);  // Require at least one float, but usually get many.
+            buffer.position(fb.position() * DATA_SIZE).limit(fb.limit() * DATA_SIZE);
+            ensureBufferContains(DATA_SIZE);    // Require at least one float, but usually get many.
             syncView(fb);
         }
 
@@ -459,10 +464,10 @@ public final class NADCON extends Abstra
          * than the underlying {@code ByteBuffer}, converted to units of {@code float} data type.
          */
         private void syncView(final FloatBuffer fb) {
-            if ((buffer.position() % Float.BYTES) != 0) {
+            if ((buffer.position() % DATA_SIZE) != 0) {
                 buffer.compact();   // For bytes alignment with FloatBuffer.
             }
-            fb.limit(buffer.limit() / Float.BYTES).position(buffer.position() / Float.BYTES);
+            fb.limit(buffer.limit() / DATA_SIZE).position(buffer.position() / DATA_SIZE);
         }
     }
 }

Copied: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NTv2.java (from r1723735, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NTv2.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NTv2.java?p2=sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NTv2.java&p1=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NTv2.java&r1=1723735&r2=1723780&rev=1723780&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NTv2.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/NTv2.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -54,6 +54,7 @@ import org.apache.sis.util.resources.Mes
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.charset.StandardCharsets;
+import org.apache.sis.internal.jdk8.JDK8;
 
 
 /**
@@ -316,9 +317,9 @@ public final class NTv2 extends Abstract
             final double  dy       = (Double)  get("LAT_INC");
             final double  dx       = (Double)  get("LONG_INC");  // Positive toward west.
             final Integer declared = (Integer) header.get("GS_COUNT");
-            final int     width    = Math.toIntExact(Math.round((xmax - xmin) / dx + 1));
-            final int     height   = Math.toIntExact(Math.round((ymax - ymin) / dy + 1));
-            final int     count    = Math.multiplyExact(width, height);
+            final int     width    = JDK8.toIntExact(Math.round((xmax - xmin) / dx + 1));
+            final int     height   = JDK8.toIntExact(Math.round((ymax - ymin) / dy + 1));
+            final int     count    = JDK8.multiplyExact(width, height);
             if (declared != null && count != declared) {
                 throw new FactoryException(Errors.format(Errors.Keys.UnexpectedValueInElement_2, "GS_COUNT", declared));
             }
@@ -335,7 +336,7 @@ public final class NTv2 extends Abstract
             @SuppressWarnings("MismatchedReadAndWriteOfArray") final float[] tx = grid.offsets[0];
             @SuppressWarnings("MismatchedReadAndWriteOfArray") final float[] ty = grid.offsets[1];
             for (int i=0; i<count; i++) {
-                ensureBufferContains(4 * Float.BYTES);
+                ensureBufferContains(4 * (Float.SIZE / Byte.SIZE));
                 ty[i] = (float) (buffer.getFloat() / dy);   // Division by dx and dy because isCellValueRatio = true.
                 tx[i] = (float) (buffer.getFloat() / dx);
                 final double accuracy = Math.min(buffer.getFloat() / dy, buffer.getFloat() / dx);
@@ -351,7 +352,7 @@ public final class NTv2 extends Abstract
          * Returns {@code true} if the given value seems to be stored in little endian order.
          */
         private static boolean isLittleEndian(final int n) {
-            return Integer.compareUnsigned(n, Integer.reverseBytes(n)) > 0;
+            return JDK8.compareUnsigned(n, Integer.reverseBytes(n)) > 0;
         }
 
         /**

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java?rev=1723780&r1=1723779&r2=1723780&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -44,11 +44,14 @@ import org.apache.sis.internal.referenci
 import org.apache.sis.internal.metadata.WKTKeywords;
 import org.apache.sis.internal.util.PatchedUnitFormat;
 import org.apache.sis.internal.util.Numerics;
+import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.util.Numbers;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.LenientComparable;
 import org.apache.sis.util.ObjectConverters;
 import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.logging.Logging;
+import org.apache.sis.util.UnconvertibleObjectException;
 
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
 import static org.apache.sis.util.Utilities.deepEquals;
@@ -508,6 +511,20 @@ public class DefaultParameterValue<T> ex
     }
 
     /**
+     * Same as {@link #isFile(Object)}, but accepts also a {@link String} if the type specified
+     * in the parameter descriptor is one of the types documented in {@link #valueFile()}.
+     */
+    private boolean isOrNeedFile(final Object value) {
+        if (value instanceof String) {
+            final Class<?> type = descriptor.getValueClass();
+            return (type == URI.class) || (type == URL.class)
+                   || Path.class.isAssignableFrom(type)
+                   || File.class.isAssignableFrom(type);
+        }
+        return isFile(value);
+    }
+
+    /**
      * Returns the exception to throw when an incompatible method is invoked for the value type.
      */
     private IllegalStateException missingOrIncompatibleValue(final Object value) {
@@ -543,9 +560,25 @@ public class DefaultParameterValue<T> ex
      * @see #getValue()
      */
     @Override
-    public void setValue(final Object value) throws InvalidParameterValueException {
-        // Use 'unit' instead than 'getUnit()' despite class Javadoc claims because units are not expected
-        // to be involved in this method. We just want the current unit setting to be unchanged.
+    public void setValue(Object value) throws InvalidParameterValueException {
+        /*
+         * Try to convert the value only for a limited amount of types. In particular we want to allow conversions
+         * between java.io.File and java.nio.file.Path for easier transition between JDK6 and JDK7. We do not want
+         * to allow too many conversions for reducing the risk of unexpected behavior.  If we fail to convert, try
+         * to set the value anyway since the user may have redefined the setValue(Object, Unit) method.
+         */
+        if (isOrNeedFile(value)) try {
+            value = ObjectConverters.convert(value, descriptor.getValueClass());
+        } catch (UnconvertibleObjectException e) {
+            // Level.FINE (not WARNING) because this log duplicates the exception
+            // that 'setValue(Object, Unit)' may throw (with a better message).
+            Logging.recoverableException(Logging.getLogger(Loggers.COORDINATE_OPERATION),
+                    DefaultParameterValue.class, "setValue", e);
+        }
+        /*
+         * Use 'unit' instead than 'getUnit()' despite class Javadoc claims because units are not expected
+         * to be involved in this method. We just want the current unit setting to be unchanged.
+         */
         setValue(value, unit);
     }
 
@@ -833,6 +866,8 @@ public class DefaultParameterValue<T> ex
      * @return An unmodifiable implementation of the given parameter, or {@code null} if the given parameter was null.
      *
      * @since 0.6
+     *
+     * @see DefaultParameterValueGroup#unmodifiable(ParameterValueGroup)
      */
     public static <T> DefaultParameterValue<T> unmodifiable(final ParameterValue<T> parameter) {
         return UnmodifiableParameterValue.create(parameter);
@@ -899,9 +934,9 @@ public class DefaultParameterValue<T> ex
         WKTUtilities.appendName(descriptor, formatter, ElementKind.PARAMETER);
         final Convention convention = formatter.getConvention();
         final boolean isWKT1 = convention.majorVersion() == 1;
-        Unit<?> unit = getUnit();   // Gives to users a chance to override this property.
+        Unit<?> unit = getUnit();                                   // Gives to users a chance to override this property.
         if (unit == null) {
-            final T value = getValue();   // Gives to users a chance to override this property.
+            final T value = getValue();                             // Gives to users a chance to override this property.
             if (!isWKT1 && isFile(value)) {
                 formatter.append(value.toString(), null);
                 return WKTKeywords.ParameterFile;

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java?rev=1723780&r1=1723779&r2=1723780&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -18,8 +18,10 @@ package org.apache.sis.parameter;
 
 import java.util.List;
 import java.util.ArrayList;
+import java.util.LinkedList;
 import java.util.Map;
 import java.util.IdentityHashMap;
+import java.util.Iterator;
 import java.io.Serializable;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
@@ -38,9 +40,7 @@ import org.apache.sis.util.LenientCompar
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.ArgumentChecks;
-
-import static org.apache.sis.util.Utilities.deepEquals;
-import static org.apache.sis.referencing.IdentifiedObjects.isHeuristicMatchForName;
+import org.apache.sis.util.Utilities;
 
 // Branch-dependent imports
 import java.util.Objects;
@@ -103,7 +103,7 @@ import java.util.Objects;
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
- * @version 0.6
+ * @version 0.7
  * @module
  *
  * @see DefaultParameterDescriptorGroup
@@ -206,7 +206,7 @@ public class DefaultParameterValueGroup
     @Override
     @SuppressWarnings("ReturnOfCollectionOrArrayField")
     public List<GeneralParameterValue> values() {
-        return values;  // Intentionally modifiable.
+        return values;                                          // Intentionally modifiable.
     }
 
     /**
@@ -305,7 +305,7 @@ public class DefaultParameterValueGroup
         for (int i=0; i<size; i++) {
             final GeneralParameterDescriptor descriptor = values.descriptor(i);
             if (descriptor instanceof ParameterDescriptor<?>) {
-                if (isHeuristicMatchForName(descriptor, name)) {
+                if (IdentifiedObjects.isHeuristicMatchForName(descriptor, name)) {
                     if (fallback < 0) {
                         fallback = i;
                     } else {
@@ -334,7 +334,7 @@ public class DefaultParameterValueGroup
      *
      * @param  name The name of the parameter to search for.
      * @return The set of all parameter group for the given name.
-     * @throws ParameterNotFoundException If no descriptor was found for the given name.
+     * @throws ParameterNotFoundException if no descriptor was found for the given name.
      */
     @Override
     public List<ParameterValueGroup> groups(final String name) throws ParameterNotFoundException {
@@ -345,7 +345,7 @@ public class DefaultParameterValueGroup
         for (int i=0; i<size; i++) {
             final GeneralParameterDescriptor descriptor = values.descriptor(i);
             if (descriptor instanceof ParameterDescriptorGroup) {
-                if (isHeuristicMatchForName(descriptor, name)) {
+                if (IdentifiedObjects.isHeuristicMatchForName(descriptor, name)) {
                     groups.add((ParameterValueGroup) values.get(i));
                 }
             }
@@ -358,8 +358,8 @@ public class DefaultParameterValueGroup
         if (groups.isEmpty()) {
             final ParameterDescriptorGroup descriptor = values.descriptor;
             if (!(descriptor.descriptor(name) instanceof ParameterDescriptorGroup)) {
-                throw new ParameterNotFoundException(Errors.format(
-                        Errors.Keys.ParameterNotFound_2, descriptor.getName(), name), name);
+                throw new ParameterNotFoundException(Errors.format(Errors.Keys.ParameterNotFound_2,
+                        Verifier.getDisplayName(descriptor), name), name);
             }
         }
         return groups;
@@ -377,8 +377,8 @@ public class DefaultParameterValueGroup
      *
      * @param  name The name of the parameter group to create.
      * @return A newly created parameter group for the given name.
-     * @throws ParameterNotFoundException If no descriptor was found for the given name.
-     * @throws InvalidParameterCardinalityException If this parameter group already contains the
+     * @throws ParameterNotFoundException if no descriptor was found for the given name.
+     * @throws InvalidParameterCardinalityException if this parameter group already contains the
      *         {@linkplain ParameterDescriptorGroup#getMaximumOccurs() maximum number of occurrences}
      *         of subgroups of the given name.
      */
@@ -400,7 +400,14 @@ public class DefaultParameterValueGroup
 
     /**
      * Compares the specified object with this parameter for equality.
-     * The strictness level is controlled by the second argument.
+     * The strictness level is controlled by the second argument:
+     *
+     * <ul>
+     *   <li>{@link ComparisonMode#STRICT} and {@link ComparisonMode#BY_CONTRACT BY_CONTRACT}
+     *       take in account the parameter order.</li>
+     *   <li>{@link ComparisonMode#IGNORE_METADATA} and {@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE}
+     *       ignore the order of parameter values (but not necessarily the order of parameter descriptors).</li>
+     * </ul>
      *
      * @param  object The object to compare to {@code this}.
      * @param  mode The strictness level of the comparison.
@@ -420,15 +427,37 @@ public class DefaultParameterValueGroup
                            Objects.equals(values, that.values);
                 }
             } else if (object instanceof ParameterValueGroup) {
-                final ParameterValueGroup that = (ParameterValueGroup) object;
-                return deepEquals(getDescriptor(), that.getDescriptor(), mode) &&
-                       deepEquals(values(), that.values(), mode);
+                return equals(this, (ParameterValueGroup) object, mode);
             }
         }
         return false;
     }
 
     /**
+     * Compares the given objects for equality, ignoring parameter order in "ignore metadata" mode.
+     */
+    static boolean equals(final Parameters expected, final ParameterValueGroup actual, final ComparisonMode mode) {
+        if (!Utilities.deepEquals(expected.getDescriptor(), actual.getDescriptor(), mode)) {
+            return false;
+        }
+        if (!mode.isIgnoringMetadata()) {
+            return Utilities.deepEquals(expected.values(), actual.values(), mode);
+        }
+        final List<GeneralParameterValue> values = new LinkedList<>(expected.values());
+scan:   for (final GeneralParameterValue param : actual.values()) {
+            final Iterator<GeneralParameterValue> it = values.iterator();
+            while (it.hasNext()) {
+                if (Utilities.deepEquals(it.next(), param, mode)) {
+                    it.remove();
+                    continue scan;
+                }
+            }
+            return false;   // A parameter from 'actual' has not been found in 'expected'.
+        }
+        return values.isEmpty();
+    }
+
+    /**
      * Compares the specified object with this parameter for equality.
      * This method is implemented as below:
      *
@@ -449,7 +478,7 @@ public class DefaultParameterValueGroup
     /**
      * Returns a hash value for this parameter.
      *
-     * @return The hash code value. This value doesn't need to be the same
+     * @return The hash code value. This value does not need to be the same
      *         in past or future versions of this class.
      */
     @Override

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java?rev=1723780&r1=1723779&r2=1723780&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterBuilder.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -20,9 +20,6 @@ import javax.measure.unit.Unit;
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
 import org.opengis.parameter.GeneralParameterDescriptor;
-import org.opengis.parameter.ParameterValueGroup;
-import org.opengis.referencing.cs.CoordinateSystem;             // For javadoc
-import org.opengis.referencing.crs.CoordinateReferenceSystem;   // For javadoc
 import org.apache.sis.measure.MeasurementRange;
 import org.apache.sis.measure.NumberRange;
 import org.apache.sis.measure.Range;
@@ -428,8 +425,6 @@ public class ParameterBuilder extends Bu
      *         for the group to create.
      * @return The parameter descriptor group for a map projection.
      *
-     * @see org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory#createBaseToDerived(CoordinateReferenceSystem, ParameterValueGroup, CoordinateSystem)
-     *
      * @since 0.6
      */
     public ParameterDescriptorGroup createGroupForMapProjection(final ParameterDescriptor<?>... parameters) {

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java?rev=1723780&r1=1723779&r2=1723780&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -124,6 +124,24 @@ public abstract class Parameters impleme
     }
 
     /**
+     * Returns the given parameter value group as an unmodifiable {@code Parameters} instance.
+     * If the given parameters is already an unmodifiable instance of {@code Parameters},
+     * then it is returned as-is. Otherwise this method copies all parameter values in a new,
+     * unmodifiable, parameter group instance.
+     *
+     * @param  parameters The parameters to make unmodifiable, or {@code null}.
+     * @return An unmodifiable group with the same parameters than the given group,
+     *         or {@code null} if the given argument was null.
+     *
+     * @since 0.7
+     *
+     * @see DefaultParameterValue#unmodifiable(ParameterValue)
+     */
+    public static Parameters unmodifiable(final ParameterValueGroup parameters) {
+        return UnmodifiableParameterValueGroup.create(parameters);
+    }
+
+    /**
      * Returns the given parameter value group as a {@code Parameters} instance.
      * If the given parameters is already an instance of {@code Parameters}, then it is returned as-is.
      * Otherwise this method returns a wrapper which delegate all method invocations to the given instance.
@@ -352,15 +370,32 @@ public abstract class Parameters impleme
      * The {@link DefaultParameterValueGroup} subclass will override this method with a more efficient
      * implementation which avoid creating some deferred parameters.
      */
+    @SuppressWarnings("null")
     ParameterValue<?> parameterIfExist(final String name) throws ParameterNotFoundException {
+        ParameterValue<?> fallback  = null;
+        ParameterValue<?> ambiguity = null;
         for (final GeneralParameterValue value : values()) {
             if (value instanceof ParameterValue<?>) {
-                if (isHeuristicMatchForName(value.getDescriptor(), name)) {
-                    return (ParameterValue<?>) value;
+                final ParameterValue<?> param = (ParameterValue<?>) value;
+                final ParameterDescriptor<?> descriptor = param.getDescriptor();
+                if (name.equals(descriptor.getName().toString())) {
+                    return param;
+                }
+                if (isHeuristicMatchForName(descriptor, name)) {
+                    if (fallback == null) {
+                        fallback = param;
+                    } else {
+                        ambiguity = param;
+                    }
                 }
             }
         }
-        return null;
+        if (ambiguity != null) {
+            throw new ParameterNotFoundException(Errors.format(Errors.Keys.AmbiguousName_3,
+                    IdentifiedObjects.toString(fallback .getDescriptor().getName()),
+                    IdentifiedObjects.toString(ambiguity.getDescriptor().getName()), name), name);
+        }
+        return fallback;
     }
 
     /**
@@ -408,7 +443,7 @@ public abstract class Parameters impleme
     }
 
     /**
-     * Returns the value of the parameter identified by the given descriptor.
+     * Returns the value of the parameter identified by the given descriptor, or {@code null} if none.
      * This method uses the following information from the given {@code parameter} descriptor:
      *
      * <ul>
@@ -465,6 +500,30 @@ public abstract class Parameters impleme
     }
 
     /**
+     * Returns the value of the parameter identified by the given descriptor, or throws an exception if none.
+     * The default implementation invokes {@link #getValue(ParameterDescriptor)} and verifies that the returned
+     * value is non-null.
+     *
+     * @param  <T> The type of the parameter value.
+     * @param  parameter The name or alias of the parameter to look for, together with the desired type and unit of value.
+     * @return The requested parameter value if it exists, or the {@linkplain DefaultParameterDescriptor#getDefaultValue()
+     *         default value} otherwise provided that it is not {@code null}.
+     * @throws ParameterNotFoundException if the given {@code parameter} name or alias is not legal for this group.
+     * @throws IllegalStateException if the value is not defined and there is no default value.
+     *
+     * @since 0.7
+     */
+    public <T> T getMandatoryValue(final ParameterDescriptor<T> parameter) throws ParameterNotFoundException {
+        final T value = getValue(parameter);
+        if (value != null) {
+            return value;
+        } else {
+            throw new IllegalStateException(Errors.format(Errors.Keys.MissingValueForParameter_1,
+                    Verifier.getDisplayName(parameter)));
+        }
+    }
+
+    /**
      * Returns the default value of the given descriptor, or throws an exception if the
      * descriptor does not define a default value. This check should be kept consistent
      * with the {@link DefaultParameterValue#incompatibleValue(Object)} check.
@@ -721,7 +780,7 @@ public abstract class Parameters impleme
                     target.setValue(((Number) v).doubleValue(), unit);
                 } else if (v instanceof double[]) {
                     target.setValue((double[]) v, unit);
-                } else {
+                } else if (v != target.getValue()) {    // Accept null value if the target value is already null.
                     throw new InvalidParameterValueException(Errors.format(
                             Errors.Keys.IllegalArgumentValue_2, name, v), name, v);
                 }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValue.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValue.java?rev=1723780&r1=1723779&r2=1723780&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValue.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValue.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -17,6 +17,7 @@
 package org.apache.sis.parameter;
 
 import javax.measure.unit.Unit;
+import javax.xml.bind.annotation.XmlTransient;
 import org.opengis.parameter.ParameterValue;
 import org.apache.sis.internal.util.Cloner;
 import org.apache.sis.util.collection.WeakHashSet;
@@ -54,6 +55,7 @@ import org.apache.sis.util.resources.Err
  * @version 0.6
  * @module
  */
+@XmlTransient
 final class UnmodifiableParameterValue<T> extends DefaultParameterValue<T> {
     /**
      * For cross-version compatibility.
@@ -117,6 +119,7 @@ final class UnmodifiableParameterValue<T
      * Returns a modifiable copy of this parameter.
      */
     @Override
+    @SuppressWarnings("CloneDoesntCallSuperClone")
     public DefaultParameterValue<T> clone() {
         return new DefaultParameterValue<>(this);
     }

Copied: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java (from r1723735, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java?p2=sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java&p1=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java&r1=1723735&r2=1723780&rev=1723780&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -107,7 +107,7 @@ final class UnmodifiableParameterValueGr
         if (group == null || group instanceof UnmodifiableParameterValueGroup) {
             return (UnmodifiableParameterValueGroup) group;
         }
-        return new UnmodifiableParameterValueGroup(group, new IdentityHashMap<>(4));
+        return new UnmodifiableParameterValueGroup(group, new IdentityHashMap<ParameterValueGroup,Boolean>(4));
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java?rev=1723780&r1=1723779&r2=1723780&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -171,7 +171,7 @@ public class AbstractIdentifiedObject ex
      * The name for this object or code. Shall never be {@code null}.
      *
      * <p><b>Consider this field as final!</b>
-     * This field is modified only at unmarshalling time by {@link #addName(Identifier)}.</p>
+     * This field is modified only at unmarshalling time by {@link Names#add(Identifier)}.</p>
      *
      * @see #getName()
      * @see #getNames()
@@ -184,7 +184,7 @@ public class AbstractIdentifiedObject ex
      * we may get both on unmarshalling.
      *
      * <p><b>Consider this field as final!</b>
-     * This field is modified only at unmarshalling time by {@link #addName(Identifier)}.</p>
+     * This field is modified only at unmarshalling time by {@link Names#add(Identifier)}.</p>
      */
     private Collection<GenericName> alias;
 
@@ -644,6 +644,8 @@ public class AbstractIdentifiedObject ex
      *           <cite>When object name matter</cite> below.</td></tr>
      *   <tr><td>{@link ComparisonMode#APPROXIMATIVE APPROXIMATIVE}:</td>
      *       <td>Same as {@code IGNORE_METADATA}, with some tolerance threshold on numerical values.</td></tr>
+     *   <tr><td>{@link ComparisonMode#ALLOW_VARIANT ALLOW_VARIANT}:</td>
+     *       <td>Same as {@code APPROXIMATIVE}, but ignores coordinate system axes.</td></tr>
      *   <tr><td>{@link ComparisonMode#DEBUG DEBUG}:</td>
      *        <td>Special mode for figuring out why two objects expected to be equal are not.</td></tr>
      * </table>
@@ -718,6 +720,7 @@ public class AbstractIdentifiedObject ex
             }
             case IGNORE_METADATA:
             case APPROXIMATIVE:
+            case ALLOW_VARIANT:
             case DEBUG: {
                 return implementsSameInterface(object);
             }

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java?rev=1723780&r1=1723779&r2=1723780&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -33,6 +33,8 @@ import org.opengis.referencing.Identifie
 import org.apache.sis.metadata.iso.ImmutableIdentifier;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.internal.util.Citations;
+import org.apache.sis.internal.referencing.DeprecatedCode;
+import org.apache.sis.internal.referencing.DeprecatedName;
 import org.apache.sis.util.iso.Types;
 import org.apache.sis.util.Deprecable;
 import org.apache.sis.util.resources.Errors;

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java?rev=1723780&r1=1723779&r2=1723780&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -122,7 +122,7 @@ public final class CRS extends Static {
      *   <tr><td>EPSG:4979</td> <td>{@link CommonCRS#WGS84  WGS84}</td>  <td>Geographic 3D</td> <td>World Geodetic System 1984</td></tr>
      *   <tr><td>EPSG:4984</td> <td>{@link CommonCRS#WGS72  WGS72}</td>  <td>Geocentric</td>    <td>World Geodetic System 1972</td></tr>
      *   <tr><td>EPSG:4985</td> <td>{@link CommonCRS#WGS72  WGS72}</td>  <td>Geographic 3D</td> <td>World Geodetic System 1972</td></tr>
-     *   <tr><td>EPSG:5715</td> <td>{@link CommonCRS.Vertical#DEPTH  DEPTH}</td> <td>Vertical</td> <td>Mean Sea Level depth</td></tr>
+     *   <tr><td>EPSG:5715</td> <td>{@link CommonCRS.Vertical#DEPTH DEPTH}</td> <td>Vertical</td> <td>Mean Sea Level depth</td></tr>
      *   <tr><td>EPSG:5714</td> <td>{@link CommonCRS.Vertical#MEAN_SEA_LEVEL MEAN_SEA_LEVEL}</td> <td>Vertical</td> <td>Mean Sea Level height</td></tr>
      * </table></blockquote>
      *
@@ -138,6 +138,8 @@ public final class CRS extends Static {
      * @throws NoSuchAuthorityCodeException If there is no known CRS associated to the given code.
      * @throws FactoryException if the CRS creation failed for an other reason.
      *
+     * @see org.apache.sis.referencing.factory.GeodeticAuthorityFactory
+     *
      * @category factory
      */
     public static CoordinateReferenceSystem forCode(final String code)
@@ -260,7 +262,7 @@ public final class CRS extends Static {
      * CRS as horizontal if it is two-dimensional and comply with one of the following conditions:
      *
      * <ul>
-     *   <li>is an instance of {@link GeographicCRS}, or</li>
+     *   <li>is an instance of {@link GeographicCRS} (or an equivalent {@link GeodeticCRS}), or</li>
      *   <li>is an instance of {@link ProjectedCRS}, or</li>
      *   <li>is an instance of {@link EngineeringCRS} (following
      *     <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#111">ISO 19162 §16.1</a>
@@ -282,8 +284,17 @@ public final class CRS extends Static {
      * @category information
      */
     public static boolean isHorizontalCRS(final CoordinateReferenceSystem crs) {
-        if (crs instanceof GeographicCRS || crs instanceof ProjectedCRS || crs instanceof EngineeringCRS) {
-            return crs.getCoordinateSystem().getDimension() == 2;
+        /*
+         * In order to determine if the CRS is geographic, checking the CoordinateSystem type is more reliable
+         * then checking if the CRS implements the GeographicCRS interface.  This is because the GeographicCRS
+         * interface is GeoAPI-specific, so a CRS may be OGC-compliant without implementing that interface.
+         */
+        final boolean isGeodetic = (crs instanceof GeodeticCRS);
+        if (isGeodetic || crs instanceof ProjectedCRS || crs instanceof EngineeringCRS) {
+            final CoordinateSystem cs = crs.getCoordinateSystem();
+            if (cs.getDimension() == 2) {
+                return !isGeodetic || (cs instanceof EllipsoidalCS);
+            }
         }
         return false;
     }
@@ -307,21 +318,24 @@ public final class CRS extends Static {
         if (isHorizontalCRS(crs)) {
             return (SingleCRS) crs;
         }
-        if (crs instanceof GeographicCRS) {
-            EllipsoidalCS cs = ((GeographicCRS) crs).getCoordinateSystem();
-            final int i = AxisDirections.indexOfColinear(cs, AxisDirection.UP);
-            if (i >= 0) {
-                final CoordinateSystemAxis xAxis = cs.getAxis(i > 0 ? 0 : 1);
-                final CoordinateSystemAxis yAxis = cs.getAxis(i > 1 ? 1 : 2);
-                cs = CommonCRS.DEFAULT.geographic().getCoordinateSystem();
-                if (!Utilities.equalsIgnoreMetadata(cs.getAxis(0), xAxis) ||
-                    !Utilities.equalsIgnoreMetadata(cs.getAxis(1), yAxis))
-                {
-                    // We can not reuse the name of the existing CS, because it typically
-                    // contains text about axes including the axis that we just dropped.
-                    cs = new DefaultEllipsoidalCS(singletonMap(EllipsoidalCS.NAME_KEY, "Ellipsoidal 2D"), xAxis, yAxis);
+        if (crs instanceof GeodeticCRS) {
+            CoordinateSystem cs = crs.getCoordinateSystem();
+            if (cs instanceof EllipsoidalCS) {  // See comment in isHorizontalCRS(…) method.
+                final int i = AxisDirections.indexOfColinear(cs, AxisDirection.UP);
+                if (i >= 0) {
+                    final CoordinateSystemAxis xAxis = cs.getAxis(i > 0 ? 0 : 1);
+                    final CoordinateSystemAxis yAxis = cs.getAxis(i > 1 ? 1 : 2);
+                    cs = CommonCRS.DEFAULT.geographic().getCoordinateSystem();
+                    if (!Utilities.equalsIgnoreMetadata(cs.getAxis(0), xAxis) ||
+                        !Utilities.equalsIgnoreMetadata(cs.getAxis(1), yAxis))
+                    {
+                        // We can not reuse the name of the existing CS, because it typically
+                        // contains text about axes including the axis that we just dropped.
+                        cs = new DefaultEllipsoidalCS(singletonMap(EllipsoidalCS.NAME_KEY, "Ellipsoidal 2D"), xAxis, yAxis);
+                    }
+                    return new DefaultGeographicCRS(IdentifiedObjects.getProperties(crs),
+                            ((GeodeticCRS) crs).getDatum(), (EllipsoidalCS) cs);
                 }
-                return new DefaultGeographicCRS(IdentifiedObjects.getProperties(crs), ((GeographicCRS) crs).getDatum(), cs);
             }
         }
         if (crs instanceof CompoundCRS) {
@@ -384,17 +398,19 @@ public final class CRS extends Static {
                 }
             } while ((a = !a) == allowCreateEllipsoidal);
         }
-        if (allowCreateEllipsoidal && crs instanceof GeographicCRS) {
+        if (allowCreateEllipsoidal && crs instanceof GeodeticCRS) {
             final CoordinateSystem cs = crs.getCoordinateSystem();
-            final int i = AxisDirections.indexOfColinear(cs, AxisDirection.UP);
-            if (i >= 0) {
-                final CoordinateSystemAxis axis = cs.getAxis(i);
-                VerticalCRS c = CommonCRS.Vertical.ELLIPSOIDAL.crs();
-                if (!c.getCoordinateSystem().getAxis(0).equals(axis)) {
-                    final Map<String,?> properties = IdentifiedObjects.getProperties(c);
-                    c = new DefaultVerticalCRS(properties, c.getDatum(), new DefaultVerticalCS(properties, axis));
+            if (cs instanceof EllipsoidalCS) {  // See comment in isHorizontalCRS(…) method.
+                final int i = AxisDirections.indexOfColinear(cs, AxisDirection.UP);
+                if (i >= 0) {
+                    final CoordinateSystemAxis axis = cs.getAxis(i);
+                    VerticalCRS c = CommonCRS.Vertical.ELLIPSOIDAL.crs();
+                    if (!c.getCoordinateSystem().getAxis(0).equals(axis)) {
+                        final Map<String,?> properties = IdentifiedObjects.getProperties(c);
+                        c = new DefaultVerticalCRS(properties, c.getDatum(), new DefaultVerticalCS(properties, axis));
+                    }
+                    return c;
                 }
-                return c;
             }
         }
         return null;

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java?rev=1723780&r1=1723779&r2=1723780&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -117,7 +117,10 @@ import static org.apache.sis.internal.ut
  * @since   0.4
  * @version 0.5
  * @module
+ *
+ * @see org.apache.sis.referencing.factory.CommonAuthorityFactory
  */
+@SuppressWarnings("DoubleCheckedLocking")
 public enum CommonCRS {
     /**
      * World Geodetic System 1984.
@@ -154,29 +157,6 @@ public enum CommonCRS {
     WGS72((short) 4322, (short) 4985, (short) 4984, (short) 6322, (short) 7043),
 
     /**
-     * European Terrestrial Reference System 1989.
-     * The ellipsoid is <cite>"GRS 1980"</cite>, also known as <cite>"International 1979"</cite>.
-     * This ellipsoid is very close, but not identical, to the {@linkplain #WGS84} one.
-     *
-     * <blockquote><table class="compact" summary="ETRS89 properties.">
-     *   <tr><th>EPSG identifiers:</th>        <td>4258 &nbsp;(<i>datum:</i> 6258, &nbsp;<i>ellipsoid:</i> 7019)</td></tr>
-     *   <tr><th>Primary names:</th>           <td>"ETRS89" &nbsp;(<i>datum:</i> "European Terrestrial Reference System 1989", &nbsp;<i>ellipsoid:</i> "GRS 1980")</td></tr>
-     *   <tr><th>Abbreviations or aliases:</th><td>"ETRF89", "EUREF89", "ETRS89-GRS80" &nbsp;(<i>ellipsoid:</i> "International 1979")</td></tr>
-     *   <tr><th>Prime meridian:</th>          <td>Greenwich</td></tr>
-     *   <tr><th>Semi-major axis length:</th>  <td>6378137</td></tr>
-     *   <tr><th>Semi-minor axis length:</th>  <td>6356752 <i>(approximative)</i></td></tr>
-     *   <tr><th>Inverse flattening:</th>      <td>298.257222101 <i>(definitive)</i></td></tr>
-     *   <tr><th>Ellipsoid axes unit:</th>     <td>{@link SI#METRE}</td></tr>
-     * </table></blockquote>
-     *
-     * <div class="note"><b>Note:</b>
-     * {@link #NAD83} uses the same ellipsoid for a different datum.
-     * The <cite>Web Map Server</cite> {@code "CRS:83"} authority code uses the NAD83 datum,
-     * while the {@code "IGNF:MILLER"} authority code uses the GRS80 datum.</div>
-     */
-    ETRS89((short) 4258, (short) 4937, (short) 4936, (short) 6258, (short) 7019),
-
-    /**
      * North American Datum 1983.
      * The ellipsoid is <cite>"GRS 1980"</cite>, also known as <cite>"International 1979"</cite>.
      * This ellipsoid is very close, but not identical, to the {@linkplain #WGS84} one.
@@ -217,6 +197,29 @@ public enum CommonCRS {
     NAD27((short) 4267, (short) 0, (short) 0, (short) 6267, (short) 7008),
 
     /**
+     * European Terrestrial Reference System 1989.
+     * The ellipsoid is <cite>"GRS 1980"</cite>, also known as <cite>"International 1979"</cite>.
+     * This ellipsoid is very close, but not identical, to the {@linkplain #WGS84} one.
+     *
+     * <blockquote><table class="compact" summary="ETRS89 properties.">
+     *   <tr><th>EPSG identifiers:</th>        <td>4258 &nbsp;(<i>datum:</i> 6258, &nbsp;<i>ellipsoid:</i> 7019)</td></tr>
+     *   <tr><th>Primary names:</th>           <td>"ETRS89" &nbsp;(<i>datum:</i> "European Terrestrial Reference System 1989", &nbsp;<i>ellipsoid:</i> "GRS 1980")</td></tr>
+     *   <tr><th>Abbreviations or aliases:</th><td>"ETRF89", "EUREF89", "ETRS89-GRS80" &nbsp;(<i>ellipsoid:</i> "International 1979")</td></tr>
+     *   <tr><th>Prime meridian:</th>          <td>Greenwich</td></tr>
+     *   <tr><th>Semi-major axis length:</th>  <td>6378137</td></tr>
+     *   <tr><th>Semi-minor axis length:</th>  <td>6356752 <i>(approximative)</i></td></tr>
+     *   <tr><th>Inverse flattening:</th>      <td>298.257222101 <i>(definitive)</i></td></tr>
+     *   <tr><th>Ellipsoid axes unit:</th>     <td>{@link SI#METRE}</td></tr>
+     * </table></blockquote>
+     *
+     * <div class="note"><b>Note:</b>
+     * {@link #NAD83} uses the same ellipsoid for a different datum.
+     * The <cite>Web Map Server</cite> {@code "CRS:83"} authority code uses the NAD83 datum,
+     * while the {@code "IGNF:MILLER"} authority code uses the GRS80 datum.</div>
+     */
+    ETRS89((short) 4258, (short) 4937, (short) 4936, (short) 6258, (short) 7019),
+
+    /**
      * European Datum 1950.
      *
      * <blockquote><table class="compact" summary="ED50 properties.">
@@ -460,7 +463,7 @@ public enum CommonCRS {
                         failure(this, "geographic", e);
                     }
                     /*
-                     * All constants defined in this enumeration use the same coordinate system, EPSG:6422.
+                     * All constants defined in this enumeration use the same coordinate system, EPSG::6422.
                      * We will arbitrarily create this CS only for the most frequently created CRS,
                      * and share that CS instance for all other constants.
                      */
@@ -517,7 +520,7 @@ public enum CommonCRS {
                         }
                     }
                     /*
-                     * All constants defined in this enumeration use the same coordinate system, EPSG:6423.
+                     * All constants defined in this enumeration use the same coordinate system, EPSG::6423.
                      * We will arbitrarily create this CS only for the most frequently created CRS,
                      * and share that CS instance for all other constants.
                      */
@@ -575,7 +578,7 @@ public enum CommonCRS {
                         }
                     }
                     /*
-                     * All constants defined in this enumeration use the same coordinate system, EPSG:6500.
+                     * All constants defined in this enumeration use the same coordinate system, EPSG::6500.
                      * We will arbitrarily create this CS only for the most frequently created CRS,
                      * and share that CS instance for all other constants.
                      */
@@ -788,13 +791,15 @@ public enum CommonCRS {
      *
      * <blockquote><table class="sis">
      *   <caption>Geodetic objects accessible by enumeration constants</caption>
-     *   <tr><th>Name or alias</th>             <th>Object type</th> <th>Enumeration value</th></tr>
-     *   <tr><td>Barometric altitude</td>       <td>CRS, Datum</td>  <td>{@link #BAROMETRIC}</td></tr>
-     *   <!-- <s>Ellipsoidal height</s> intentionally omitted        <td><s>{@link #ELLIPSOIDAL}</s></td> -->
-     *   <tr><td>Mean Sea Level</td>            <td>Datum</td>       <td>{@link #MEAN_SEA_LEVEL}</td></tr>
-     *   <tr><td>Mean Sea Level depth</td>      <td>CRS</td>         <td>{@link #DEPTH}</td></tr>
-     *   <tr><td>Mean Sea Level height</td>     <td>CRS</td>         <td>{@link #MEAN_SEA_LEVEL}</td></tr>
-     *   <tr><td>Other surface</td>             <td>CRS, Datum</td>  <td>{@link #OTHER_SURFACE}</td></tr>
+     *   <tr><th>Name or alias</th>                      <th>Object type</th> <th>Enumeration value</th></tr>
+     *   <tr><td>Barometric altitude</td>                <td>CRS, Datum</td>  <td>{@link #BAROMETRIC}</td></tr>
+     *   <!-- <s>Ellipsoidal height</s> intentionally omitted                 <td><s>{@link #ELLIPSOIDAL}</s></td> -->
+     *   <tr><td>Mean Sea Level</td>                     <td>Datum</td>       <td>{@link #MEAN_SEA_LEVEL}</td></tr>
+     *   <tr><td>Mean Sea Level depth</td>               <td>CRS</td>         <td>{@link #DEPTH}</td></tr>
+     *   <tr><td>Mean Sea Level height</td>              <td>CRS</td>         <td>{@link #MEAN_SEA_LEVEL}</td></tr>
+     *   <tr><td>NAVD88 height</td>                      <td>CRS</td>         <td>{@link #NAVD88}</td></tr>
+     *   <tr><td>North American Vertical Datum 1988</td> <td>Datum</td>       <td>{@link #NAVD88}</td></tr>
+     *   <tr><td>Other surface</td>                      <td>CRS, Datum</td>  <td>{@link #OTHER_SURFACE}</td></tr>
      * </table></blockquote>
      *
      * <div class="note"><b>Note:</b>
@@ -804,8 +809,10 @@ public enum CommonCRS {
      *
      * @author  Martin Desruisseaux (Geomatys)
      * @since   0.4
-     * @version 0.4
+     * @version 0.7
      * @module
+     *
+     * @see org.apache.sis.referencing.factory.CommonAuthorityFactory
      */
     public static enum Vertical {
         /**
@@ -849,6 +856,24 @@ public enum CommonCRS {
         DEPTH(true, (short) 5715, (short) 5100),
 
         /**
+         * North American Vertical Datum 1988 height.
+         *
+         * <blockquote><table class="compact" summary="Mean Sea Level properties.">
+         *   <tr><th>WMS identifier:</th>           <td>CRS:88</td></tr>
+         *   <tr><th>EPSG identifiers:</th>         <td>5703 &nbsp;(<i>datum:</i> 5103)</td></tr>
+         *   <tr><th>Primary names:</th>            <td>"NAVD88 height" &nbsp;(<i>datum:</i> "North American Vertical Datum 1988")</td></tr>
+         *   <tr><th>Abbreviations or aliases:</th> <td>" North American Vertical Datum of 1988 height (m)" &nbsp;(<i>datum:</i> "NAVD88")</td></tr>
+         *   <tr><th>Direction:</th>                <td>{@link AxisDirection#UP}</td></tr>
+         *   <tr><th>Unit:</th>                     <td>{@link SI#METRE}</td></tr>
+         * </table></blockquote>
+         *
+         * @see CommonCRS#NAD83
+         *
+         * @since 0.7
+         */
+        NAVD88(true, (short) 5703, (short) 5103),
+
+        /**
          * Height measured along the normal to the ellipsoid used in the definition of horizontal datum.
          * The unit of measurement is metres.
          *

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java?rev=1723780&r1=1723779&r2=1723780&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/NamedIdentifier.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -88,7 +88,7 @@ import java.util.Objects;
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
- * @version 0.6
+ * @version 0.7
  * @module
  */
 public class NamedIdentifier extends ImmutableIdentifier implements GenericName {
@@ -142,7 +142,59 @@ public class NamedIdentifier extends Imm
 
     /**
      * Constructs an identifier from the given properties. The content of the properties map is used as
-     * described in the {@linkplain ImmutableIdentifier#ImmutableIdentifier(Map) super-class constructor}.
+     * described in the {@linkplain ImmutableIdentifier#ImmutableIdentifier(Map) super-class constructor},
+     * with the addition of an optional {@code "name"} property.
+     *
+     * <table class="sis">
+     *   <caption>Recognized properties</caption>
+     *   <tr>
+     *     <th>Property name</th>
+     *     <th>Value type</th>
+     *     <th>Returned by</th>
+     *   </tr>
+     *   <tr>
+     *     <td>{@code "name"}</td>
+     *     <td>{@link GenericName}</td>
+     *     <td>(none)</td>
+     *   </tr>
+     *   <tr>
+     *     <th colspan="3" class="hsep">Defined in parent class (reminder)</th>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.metadata.Identifier#CODE_KEY}</td>
+     *     <td>{@link String}</td>
+     *     <td>{@link #getCode()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.metadata.Identifier#CODESPACE_KEY}</td>
+     *     <td>{@link String}</td>
+     *     <td>{@link #getCodeSpace()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.metadata.Identifier#AUTHORITY_KEY}</td>
+     *     <td>{@link String} or {@link Citation}</td>
+     *     <td>{@link #getAuthority()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.metadata.Identifier#VERSION_KEY}</td>
+     *     <td>{@link String}</td>
+     *     <td>{@link #getVersion()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.opengis.metadata.Identifier#DESCRIPTION_KEY}</td>
+     *     <td>{@link String} or {@link InternationalString}</td>
+     *     <td>{@link #getDescription()}</td>
+     *   </tr>
+     *   <tr>
+     *     <td>{@value org.apache.sis.referencing.AbstractIdentifiedObject#LOCALE_KEY}</td>
+     *     <td>{@link Locale}</td>
+     *     <td>(none)</td>
+     *   </tr>
+     * </table>
+     *
+     * The {@value org.opengis.metadata.Identifier#CODE_KEY} property is mandatory and all other properties
+     * are optional. If a {@code "name"} property is provided, then calls to name-related methods like
+     * {@link #tip()}, {@link #head()} and {@link #scope()} will delegate to the given name.
      *
      * @param  properties The properties to be given to this identifier.
      * @throws InvalidParameterValueException if a property has an invalid value.
@@ -150,6 +202,8 @@ public class NamedIdentifier extends Imm
      */
     public NamedIdentifier(final Map<String,?> properties) throws IllegalArgumentException {
         super(properties);
+        name = (GenericName) properties.get("name");
+        isNameSupplied = (name != null);
     }
 
     /**
@@ -171,7 +225,7 @@ public class NamedIdentifier extends Imm
         super(authority, Citations.getCodeSpace(authority), toString(code));
         if (code instanceof InternationalString) {
             name = createName(authority, super.getCodeSpace(), code);
-            isNameSupplied = true; // Because 'code' is an international string.
+            isNameSupplied = true;      // Because 'code' is an international string.
         }
     }
 
@@ -204,7 +258,7 @@ public class NamedIdentifier extends Imm
         super(authority, codeSpace, toString(code), version, description);
         if (code instanceof InternationalString) {
             name = createName(authority, codeSpace, code);
-            isNameSupplied = true; // Because 'code' is an international string.
+            isNameSupplied = true;      // Because 'code' is an international string.
         }
     }
 
@@ -232,7 +286,7 @@ public class NamedIdentifier extends Imm
     /**
      * Returns the generic name of this identifier.
      * The name will be constructed automatically the first time it will be needed.
-     * The name's scope is inferred from the shortest alternative title (if any).
+     * The name's head is inferred from the shortest alternative title (if any).
      * This heuristic rule is compatible to the ISO 19115 remark saying that the
      * {@linkplain Citation#getAlternateTitles() alternate titles} often contains abbreviation
      * (for example "DCW" as an alternative title for "Digital Chart of the World").
@@ -260,7 +314,7 @@ public class NamedIdentifier extends Imm
      */
     private static GenericName createName(final Citation authority, String codeSpace, final CharSequence code) {
         if (codeSpace == null) {
-            codeSpace = Citations.getCodeSpace(authority);   // Whitespaces trimed by Citations.
+            codeSpace = Citations.getCodeSpace(authority);          // Whitespaces trimed by Citations.
         }
         final NameFactory factory = DefaultFactories.forBuildin(NameFactory.class);
         if (codeSpace != null) {
@@ -410,7 +464,7 @@ public class NamedIdentifier extends Imm
         }
         if (super.equals(object)) {
             if (!isNameSupplied) {
-                return true; // No need to compare names if they are computed from the same values.
+                return true;            // No need to compare names if they are computed from the same values.
             }
             final NamedIdentifier that = (NamedIdentifier) object;
             return Objects.equals(this.getName(), that.getName());

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

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java?rev=1723780&r1=1723779&r2=1723780&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/AbstractDerivedCRS.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -217,20 +217,30 @@ abstract class AbstractDerivedCRS<C exte
      */
     @Override
     public boolean equals(final Object object, final ComparisonMode mode) {
+        if (object == this) {
+            return true;
+        }
         if (super.equals(object, mode)) {
             final boolean strict = (mode == ComparisonMode.STRICT);
             /*
              * Avoid never-ending recursivity: Conversion has a 'targetCRS' field (inherited from
              * the AbstractCoordinateOperation super-class) that is set to this AbstractDerivedCRS.
+             *
+             * Do NOT compare the baseCRS explicitely. This is done implicitely in the comparison of the Conversion
+             * objects, since (this.baseCRS == Conversion.sourceCRS) in Apache SIS.  The reason why we delegate the
+             * comparison of that CRS to the Conversion object is because we want to ignore the baseCRS axes if the
+             * mode said to ignore metadata, but ignoring axis order and units has implication on the MathTransform
+             * instances to compare.  The AbstractCoordinateOperation.equals(…) method implementation handles those
+             * cases.
              */
-            if (Semaphores.queryAndSet(Semaphores.COMPARING)) {
+            if (Semaphores.queryAndSet(Semaphores.CONVERSION_AND_CRS)) {
                 return true;
             } else try {
                 return deepEquals(strict ? conversionFromBase : getConversionFromBase(),
                                   strict ? ((AbstractDerivedCRS) object).conversionFromBase
                                          :  ((GeneralDerivedCRS) object).getConversionFromBase(), mode);
             } finally {
-                Semaphores.clear(Semaphores.COMPARING);
+                Semaphores.clear(Semaphores.CONVERSION_AND_CRS);
             }
         }
         return false;

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java?rev=1723780&r1=1723779&r2=1723780&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultCompoundCRS.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -112,6 +112,8 @@ import static org.apache.sis.internal.re
  * @since   0.4
  * @version 0.7
  * @module
+ *
+ * @see org.apache.sis.referencing.factory.GeodeticAuthorityFactory#createCompoundCRS(String)
  */
 @XmlType(name = "CompoundCRSType")
 @XmlRootElement(name = "CompoundCRS")
@@ -183,6 +185,8 @@ public class DefaultCompoundCRS extends
      *
      * @param properties The properties to be given to the coordinate reference system.
      * @param components The sequence of coordinate reference systems making this compound CRS.
+     *
+     * @see org.apache.sis.referencing.factory.GeodeticObjectFactory#createCompoundCRS(Map, CoordinateReferenceSystem...)
      */
     public DefaultCompoundCRS(final Map<String,?> properties, final CoordinateReferenceSystem... components) {
         super(properties, createCoordinateSystem(properties, components));

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java?rev=1723780&r1=1723779&r2=1723780&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -94,6 +94,8 @@ import org.apache.sis.util.Classes;
  * @since   0.6
  * @version 0.7
  * @module
+ *
+ * @see org.apache.sis.referencing.factory.GeodeticAuthorityFactory#createDerivedCRS(String)
  */
 @XmlType(name="DerivedCRSType", propOrder = {
     "baseCRS",
@@ -275,6 +277,7 @@ public class DefaultDerivedCRS extends A
      *         do not match the dimensions of {@code base} and {@code derivedCS} respectively.
      *
      * @see #DefaultDerivedCRS(Map, SingleCRS, Conversion, CoordinateSystem)
+     * @see org.apache.sis.referencing.factory.GeodeticObjectFactory#createDerivedCRS(Map, CoordinateReferenceSystem, Conversion, CoordinateSystem)
      */
     public static DefaultDerivedCRS create(final Map<String,?>    properties,
                                            final SingleCRS        baseCRS,
@@ -481,6 +484,12 @@ public class DefaultDerivedCRS extends A
 
     /**
      * Compares this coordinate reference system with the specified object for equality.
+     * In addition to the metadata documented in the
+     * {@linkplain org.apache.sis.referencing.AbstractIdentifiedObject#equals(Object, ComparisonMode) parent class},
+     * this method considers coordinate system axes of the {@linkplain #getBaseCRS() base CRS} as metadata.
+     * This means that if the given {@code ComparisonMode} is {@code IGNORE_METADATA} or {@code APPROXIMATIVE},
+     * then axis order of the base CRS are ignored
+     * (but <strong>not</strong> axis order of <strong>this</strong> derived CRS).
      *
      * @param  object The object to compare to {@code this}.
      * @param  mode {@link ComparisonMode#STRICT STRICT} for performing a strict comparison, or
@@ -490,7 +499,7 @@ public class DefaultDerivedCRS extends A
      */
     @Override
     public boolean equals(final Object object, final ComparisonMode mode) {
-        return (object == this) || super.equals(object, mode);
+        return super.equals(object, mode);
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java?rev=1723780&r1=1723779&r2=1723780&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultEngineeringCRS.java [UTF-8] Fri Jan  8 18:29:04 2016
@@ -61,6 +61,9 @@ import static org.apache.sis.util.Argume
  * @since   0.4
  * @version 0.7
  * @module
+ *
+ * @see org.apache.sis.referencing.datum.DefaultEngineeringDatum
+ * @see org.apache.sis.referencing.factory.GeodeticAuthorityFactory#createEngineeringCRS(String)
  */
 @XmlType(name = "EngineeringCRSType", propOrder = {
     "coordinateSystem",
@@ -131,6 +134,8 @@ public class DefaultEngineeringCRS exten
      * @param properties The properties to be given to the coordinate reference system.
      * @param datum The datum.
      * @param cs The coordinate system.
+     *
+     * @see org.apache.sis.referencing.factory.GeodeticObjectFactory#createEngineeringCRS(Map, EngineeringDatum, CoordinateSystem)
      */
     public DefaultEngineeringCRS(final Map<String,?> properties,
                                  final EngineeringDatum   datum,




Mime
View raw message