sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1738658 [1/2] - in /sis/branches/JDK8/core: sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/ sis-referencing/src/main/java/org/apache/sis/referencing/ sis-referencing/src/main/java/org/apache/sis/referencing/fact...
Date Mon, 11 Apr 2016 22:31:35 GMT
Author: desruisseaux
Date: Mon Apr 11 22:31:34 2016
New Revision: 1738658

URL: http://svn.apache.org/viewvc?rev=1738658&view=rev
Log:
Initial support of search for operations between three-dimensional CRS (with ellipsoidal height)
when only operations between two-dimensional CRS are found in CoordinateOperationRegistry.

Added:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeodeticOperation.java   (with props)
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Providers.java   (with props)
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProviderMock.java
      - copied, changed from r1738656, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/MockProvider.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProvidersTest.java
      - copied, changed from r1738656, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AllProvidersTest.java
Removed:
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AllProvidersTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/MockProvider.java
Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbridgedMolodensky.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/CoordinateFrameRotation.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/CoordinateFrameRotation2D.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/CoordinateFrameRotation3D.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/FranceGeocentricInterpolation.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffineBetweenGeographic.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation2D.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation3D.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets2D.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LongitudeRotation.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Molodensky.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MolodenskyInterpolation.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PositionVector7Param.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PositionVector7Param2D.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PositionVector7Param3D.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/VerticalOffset.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
    sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/SeismicBinGridMock.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TopocentricConversionMock.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationRegistryTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java
    sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/util/LazySetTest.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbridgedMolodensky.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbridgedMolodensky.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbridgedMolodensky.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbridgedMolodensky.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -82,11 +82,11 @@ public final class AbridgedMolodensky ex
     /**
      * Constructs a provider for the given dimensions.
      *
-     * @param sourceDimension Number of dimensions in the source CRS of this operation method.
-     * @param targetDimension Number of dimensions in the target CRS of this operation method.
-     * @param redimensioned   Providers for all combinations between 2D and 3D cases.
+     * @param sourceDimensions  number of dimensions in the source CRS of this operation method.
+     * @param targetDimensions  number of dimensions in the target CRS of this operation method.
+     * @param redimensioned     providers for all combinations between 2D and 3D cases, or {@code null}.
      */
-    private AbridgedMolodensky(int sourceDimension, int targetDimension, GeocentricAffineBetweenGeographic[] redimensioned) {
+    private AbridgedMolodensky(int sourceDimension, int targetDimension, GeodeticOperation[] redimensioned) {
         super(sourceDimension, targetDimension, PARAMETERS, redimensioned);
     }
 

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -236,10 +236,10 @@ public final class Affine extends Abstra
      * Returns the operation method for the specified source and target dimensions.
      * This method provides different {@code Affine} instances for different dimensions.
      *
-     * @param sourceDimensions The number of source dimensions.
-     * @param targetDimensions The number of target dimensions.
-     * @param isAffine {@code true} if the transform is affine.
-     * @return The provider for transforms of the given source and target dimensions.
+     * @param  sourceDimensions  the number of source dimensions.
+     * @param  targetDimensions  the number of target dimensions.
+     * @param  isAffine          {@code true} if the transform is affine.
+     * @return the provider for transforms of the given source and target dimensions.
      */
     public static Affine getProvider(final int sourceDimensions, final int targetDimensions, final boolean isAffine) {
         Affine method;

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/CoordinateFrameRotation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/CoordinateFrameRotation.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/CoordinateFrameRotation.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/CoordinateFrameRotation.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -57,7 +57,7 @@ public final class CoordinateFrameRotati
      * Constructs the provider.
      */
     public CoordinateFrameRotation() {
-        super(3, 3, PARAMETERS);
+        super(3, 3, PARAMETERS, null);
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/CoordinateFrameRotation2D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/CoordinateFrameRotation2D.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/CoordinateFrameRotation2D.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/CoordinateFrameRotation2D.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -57,7 +57,22 @@ public final class CoordinateFrameRotati
      * Constructs the provider.
      */
     public CoordinateFrameRotation2D() {
-        super(2, 2, PARAMETERS, null);
+        this(null);
+    }
+
+    /**
+     * Constructs a provider that can be resized.
+     */
+    CoordinateFrameRotation2D(GeodeticOperation[] redimensioned) {
+        super(2, 2, PARAMETERS, redimensioned);
+    }
+
+    /**
+     * Returns the three-dimensional variant of this operation method.
+     */
+    @Override
+    Class<CoordinateFrameRotation3D> variant3D() {
+        return CoordinateFrameRotation3D.class;
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/CoordinateFrameRotation3D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/CoordinateFrameRotation3D.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/CoordinateFrameRotation3D.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/CoordinateFrameRotation3D.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -58,7 +58,8 @@ public final class CoordinateFrameRotati
      */
     @SuppressWarnings("ThisEscapedInObjectConstruction")
     public CoordinateFrameRotation3D() {
-        this(3, 3, new CoordinateFrameRotation3D[4]);
+        this(3, 3, new GeocentricAffineBetweenGeographic[4]);
+        redimensioned[0] = new CoordinateFrameRotation2D(      redimensioned);
         redimensioned[1] = new CoordinateFrameRotation3D(2, 3, redimensioned);
         redimensioned[2] = new CoordinateFrameRotation3D(3, 2, redimensioned);
         redimensioned[3] = this;
@@ -67,11 +68,11 @@ public final class CoordinateFrameRotati
     /**
      * Constructs a provider for the given dimensions.
      *
-     * @param sourceDimensions Number of dimensions in the source CRS of this operation method.
-     * @param targetDimensions Number of dimensions in the target CRS of this operation method.
-     * @param redimensioned    Providers for all combinations between 2D and 3D cases.
+     * @param sourceDimensions  number of dimensions in the source CRS of this operation method.
+     * @param targetDimensions  number of dimensions in the target CRS of this operation method.
+     * @param redimensioned     providers for all combinations between 2D and 3D cases, or {@code null}.
      */
-    private CoordinateFrameRotation3D(int sourceDimensions, int targetDimensions, GeocentricAffineBetweenGeographic[] redimensioned) {
+    private CoordinateFrameRotation3D(int sourceDimensions, int targetDimensions, GeodeticOperation[] redimensioned) {
         super(sourceDimensions, targetDimensions, PARAMETERS, redimensioned);
     }
 

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/FranceGeocentricInterpolation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/FranceGeocentricInterpolation.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/FranceGeocentricInterpolation.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/FranceGeocentricInterpolation.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -38,8 +38,6 @@ import org.opengis.parameter.InvalidPara
 import org.opengis.referencing.datum.Ellipsoid;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.MathTransformFactory;
-import org.opengis.referencing.operation.Transformation;
-import org.opengis.referencing.operation.OperationMethod;
 import org.opengis.referencing.operation.NoninvertibleTransformException;
 import org.opengis.util.FactoryException;
 import org.apache.sis.internal.system.Loggers;
@@ -47,7 +45,6 @@ import org.apache.sis.internal.system.Da
 import org.apache.sis.internal.referencing.NilReferencingObject;
 import org.apache.sis.parameter.ParameterBuilder;
 import org.apache.sis.parameter.Parameters;
-import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.logging.Logging;
 import org.apache.sis.util.resources.Errors;
@@ -92,7 +89,7 @@ import java.nio.file.Files;
  * @module
  */
 @XmlTransient
-public class FranceGeocentricInterpolation extends AbstractProvider {
+public class FranceGeocentricInterpolation extends GeodeticOperation {
     /**
      * Serial number for inter-operability with different versions.
      */
@@ -171,18 +168,6 @@ public class FranceGeocentricInterpolati
     }
 
     /**
-     * The providers for all combinations between 2D and 3D cases.
-     * 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>
-     * </ul>
-     *
-     * This array is initialized at construction time and shall not be modified after.
-     */
-    final FranceGeocentricInterpolation[] redimensioned;
-
-    /**
      * Constructs a provider.
      */
     @SuppressWarnings("ThisEscapedInObjectConstruction")
@@ -197,32 +182,17 @@ public class FranceGeocentricInterpolati
     /**
      * Constructs a provider for the given number of dimensions.
      *
-     * @param sourceDimensions Number of dimensions in the source CRS of this operation method.
-     * @param targetDimensions Number of dimensions in the target CRS of this operation method.
-     * @param parameters       The set of parameters (never {@code null}).
-     * @param redimensioned    Providers for all combinations between 2D and 3D cases.
+     * @param sourceDimensions  number of dimensions in the source CRS of this operation method.
+     * @param targetDimensions  number of dimensions in the target CRS of this operation method.
+     * @param parameters        description of parameters expected by this operation.
+     * @param redimensioned     providers for all combinations between 2D and 3D cases, or {@code null}.
      */
     FranceGeocentricInterpolation(final int sourceDimensions,
                                   final int targetDimensions,
                                   final ParameterDescriptorGroup parameters,
-                                  final FranceGeocentricInterpolation[] redimensioned)
+                                  final GeodeticOperation[] redimensioned)
     {
-        super(sourceDimensions, targetDimensions, parameters);
-        this.redimensioned = redimensioned;
-    }
-
-    /**
-     * Returns the same operation method, but for different number of dimensions.
-     *
-     * @param  sourceDimensions The desired number of input dimensions.
-     * @param  targetDimensions The desired number of output dimensions.
-     * @return The redimensioned operation method, or {@code this} if no change is needed.
-     */
-    @Override
-    public OperationMethod redimension(final int sourceDimensions, final int targetDimensions) {
-        ArgumentChecks.ensureBetween("sourceDimensions", 2, 3, sourceDimensions);
-        ArgumentChecks.ensureBetween("targetDimensions", 2, 3, targetDimensions);
-        return redimensioned[((sourceDimensions & 1) << 1) | (targetDimensions & 1)];
+        super(sourceDimensions, targetDimensions, parameters, redimensioned);
     }
 
     /**
@@ -239,13 +209,13 @@ public class FranceGeocentricInterpolati
     }
 
     /**
-     * Returns the base interface of the {@code CoordinateOperation} instances that use this method.
+     * The inverse of {@code FranceGeocentricInterpolation} is a different operation.
      *
-     * @return Fixed to {@link Transformation}.
+     * @return {@code false}.
      */
     @Override
-    public Class<Transformation> getOperationType() {
-        return Transformation.class;
+    public final boolean isInvertible() {
+        return false;
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -30,7 +30,6 @@ import org.opengis.referencing.cs.Coordi
 import org.opengis.referencing.operation.Matrix;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.MathTransformFactory;
-import org.opengis.referencing.operation.Transformation;
 import org.apache.sis.internal.referencing.Formulas;
 import org.apache.sis.internal.referencing.WKTUtilities;
 import org.apache.sis.internal.metadata.WKTKeywords;
@@ -64,7 +63,7 @@ import org.apache.sis.util.logging.Loggi
  * @module
  */
 @XmlTransient
-public abstract class GeocentricAffine extends AbstractProvider {
+public abstract class GeocentricAffine extends GeodeticOperation {
     /**
      * Serial number for inter-operability with different versions.
      */
@@ -153,22 +152,13 @@ public abstract class GeocentricAffine e
     /**
      * Constructs a provider with the specified parameters.
      *
-     * @param sourceDimensions Number of dimensions in the source CRS of this operation method.
-     * @param targetDimensions Number of dimensions in the target CRS of this operation method.
-     * @param parameters       Description of parameters expected by this operation.
+     * @param sourceDimensions  number of dimensions in the source CRS of this operation method.
+     * @param targetDimensions  number of dimensions in the target CRS of this operation method.
+     * @param parameters        description of parameters expected by this operation.
+     * @param redimensioned     providers for all combinations between 2D and 3D cases, or {@code null}.
      */
-    GeocentricAffine(int sourceDimensions, int targetDimensions, ParameterDescriptorGroup parameters) {
-        super(sourceDimensions, targetDimensions, parameters);
-    }
-
-    /**
-     * Returns the interface implemented by all coordinate operations that extends this class.
-     *
-     * @return Fixed to {@link Transformation}.
-     */
-    @Override
-    public final Class<Transformation> getOperationType() {
-        return Transformation.class;
+    GeocentricAffine(int sourceDimensions, int targetDimensions, ParameterDescriptorGroup parameters, GeodeticOperation[] redimensioned) {
+        super(sourceDimensions, targetDimensions, parameters, redimensioned);
     }
 
     /**
@@ -178,16 +168,6 @@ public abstract class GeocentricAffine e
     abstract int getType();
 
     /**
-     * The inverse of this operation is the same operation with parameter signs inverted.
-     *
-     * @return {@code true} for all {@code GeocentricAffine}.
-     */
-    @Override
-    public final boolean isInvertible() {
-        return true;
-    }
-
-    /**
      * Creates a math transform from the specified group of parameter values.
      * The default implementation creates an affine transform, but some subclasses
      * will wrap that affine operation into Geographic/Geocentric conversions.
@@ -207,12 +187,12 @@ public abstract class GeocentricAffine e
         boolean reverseRotation = false;
         switch (getType()) {
             default:             throw new AssertionError();
-            case FRAME_ROTATION: reverseRotation = true;               // Fall through
+            case FRAME_ROTATION: reverseRotation = true;                    // Fall through
             case SEVEN_PARAM:    parameters.rX = pv.doubleValue(RX);
                                  parameters.rY = pv.doubleValue(RY);
                                  parameters.rZ = pv.doubleValue(RZ);
                                  parameters.dS = pv.doubleValue(DS);
-            case TRANSLATION:    parameters.tX = pv.doubleValue(TX);   // Fall through
+            case TRANSLATION:    parameters.tX = pv.doubleValue(TX);        // Fall through
                                  parameters.tY = pv.doubleValue(TY);
                                  parameters.tZ = pv.doubleValue(TZ);
         }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffineBetweenGeographic.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffineBetweenGeographic.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffineBetweenGeographic.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffineBetweenGeographic.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -25,13 +25,11 @@ import org.opengis.parameter.ParameterDe
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.MathTransformFactory;
 import org.opengis.referencing.operation.NoninvertibleTransformException;
-import org.opengis.referencing.operation.OperationMethod;
 import org.apache.sis.referencing.operation.transform.EllipsoidToCentricTransform;
 import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.parameter.ParameterBuilder;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.parameter.Parameters;
-import org.apache.sis.util.ArgumentChecks;
 
 
 /**
@@ -101,52 +99,17 @@ public abstract class GeocentricAffineBe
     }
 
     /**
-     * The providers for all combinations between 2D and 3D cases, or {@code null} if none.
-     * If non-null, then array length shall be 4. Indices are built with following rules:
-     *
-     * <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>
-     * </ul>
-     *
-     * <strong>Do not modify this array after construction</strong>, since the same array is shared by many
-     * objects and there is no synchronization.
-     */
-    final GeocentricAffineBetweenGeographic[] redimensioned;
-
-    /**
      * Constructs a provider with the specified parameters.
      *
-     * @param sourceDimensions Number of dimensions in the source CRS of this operation method.
-     * @param targetDimensions Number of dimensions in the target CRS of this operation method.
-     * @param parameters       Description of parameters expected by this operation.
-     * @param redimensioned    The providers for all combinations between 2D and 3D cases, or {@code null}.
+     * @param sourceDimensions  number of dimensions in the source CRS of this operation method.
+     * @param targetDimensions  number of dimensions in the target CRS of this operation method.
+     * @param parameters        description of parameters expected by this operation.
+     * @param redimensioned     providers for all combinations between 2D and 3D cases, or {@code null}.
      */
-    GeocentricAffineBetweenGeographic(int sourceDimensions, int targetDimensions, ParameterDescriptorGroup parameters,
-            final GeocentricAffineBetweenGeographic[] redimensioned)
+    GeocentricAffineBetweenGeographic(int sourceDimensions, int targetDimensions,
+            ParameterDescriptorGroup parameters, GeodeticOperation[] redimensioned)
     {
-        super(sourceDimensions, targetDimensions, parameters);
-        this.redimensioned = redimensioned;
-    }
-
-    /**
-     * Returns the same operation method, but for different number of dimensions.
-     *
-     * @param  sourceDimensions The desired number of input dimensions.
-     * @param  targetDimensions The desired number of output dimensions.
-     * @return The redimensioned operation method, or {@code this} if no change is needed.
-     */
-    @Override
-    public final OperationMethod redimension(final int sourceDimensions, final int targetDimensions) {
-        if (redimensioned != null) {
-            ArgumentChecks.ensureBetween("sourceDimensions", 2, 3, sourceDimensions);
-            ArgumentChecks.ensureBetween("targetDimensions", 2, 3, targetDimensions);
-            final OperationMethod m = redimensioned[((sourceDimensions & 1) << 1) | (targetDimensions & 1)];
-            if (m != null) {
-                return m;
-            }
-        }
-        return super.redimension(sourceDimensions, targetDimensions);
+        super(sourceDimensions, targetDimensions, parameters, redimensioned);
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -52,7 +52,7 @@ public final class GeocentricTranslation
      * Constructs the provider.
      */
     public GeocentricTranslation() {
-        super(3, 3, PARAMETERS);
+        super(3, 3, PARAMETERS, null);
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation2D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation2D.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation2D.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation2D.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -56,7 +56,22 @@ public final class GeocentricTranslation
      * Constructs the provider.
      */
     public GeocentricTranslation2D() {
-        super(2, 2, PARAMETERS, null);
+        this(null);
+    }
+
+    /**
+     * Constructs a provider that can be resized.
+     */
+    GeocentricTranslation2D(GeodeticOperation[] redimensioned) {
+        super(2, 2, PARAMETERS, redimensioned);
+    }
+
+    /**
+     * Returns the three-dimensional variant of this operation method.
+     */
+    @Override
+    Class<GeocentricTranslation3D> variant3D() {
+        return GeocentricTranslation3D.class;
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation3D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation3D.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation3D.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricTranslation3D.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -53,7 +53,8 @@ public final class GeocentricTranslation
      */
     @SuppressWarnings("ThisEscapedInObjectConstruction")
     public GeocentricTranslation3D() {
-        this(3, 3, new GeocentricTranslation3D[4]);
+        this(3, 3, new GeocentricAffineBetweenGeographic[4]);
+        redimensioned[0] = new GeocentricTranslation2D(      redimensioned);
         redimensioned[1] = new GeocentricTranslation3D(2, 3, redimensioned);
         redimensioned[2] = new GeocentricTranslation3D(3, 2, redimensioned);
         redimensioned[3] = this;
@@ -62,11 +63,11 @@ public final class GeocentricTranslation
     /**
      * Constructs a provider for the given dimensions.
      *
-     * @param sourceDimensions Number of dimensions in the source CRS of this operation method.
-     * @param targetDimensions Number of dimensions in the target CRS of this operation method.
-     * @param redimensioned    Providers for all combinations between 2D and 3D cases.
+     * @param sourceDimensions  number of dimensions in the source CRS of this operation method.
+     * @param targetDimensions  number of dimensions in the target CRS of this operation method.
+     * @param redimensioned     providers for all combinations between 2D and 3D cases, or {@code null}.
      */
-    private GeocentricTranslation3D(int sourceDimensions, int targetDimensions, GeocentricAffineBetweenGeographic[] redimensioned) {
+    private GeocentricTranslation3D(int sourceDimensions, int targetDimensions, GeodeticOperation[] redimensioned) {
         super(sourceDimensions, targetDimensions, PARAMETERS, redimensioned);
     }
 

Added: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeodeticOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeodeticOperation.java?rev=1738658&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeodeticOperation.java (added)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeodeticOperation.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.referencing.provider;
+
+import javax.xml.bind.annotation.XmlTransient;
+import org.opengis.parameter.ParameterDescriptorGroup;
+import org.opengis.referencing.operation.OperationMethod;
+import org.opengis.referencing.operation.Transformation;
+
+
+/**
+ * Base class for providers that perform an operation on geographic or geocentric coordinates.
+ * In the geographic case, those operations can have two-dimensional and three-dimensional variants
+ * by adding or omitting the ellipsoidal height. Sometime those variants are explicitely declared
+ * in the EPSG database and are implemented in this package as separated operations. Sometime those
+ * variants are specific to Apache SIS and can be fetched only by a call to {@link #redimension(int, int)}.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.7
+ * @version 0.7
+ * @module
+ */
+@XmlTransient
+abstract class GeodeticOperation extends AbstractProvider {
+    /**
+     * For cross-version compatibility.
+     */
+    private static final long serialVersionUID = 5431035501162127059L;
+
+    /**
+     * The providers for all combinations between 2D and 3D cases, or {@code null} if none.
+     * If non-null, then array length shall be 4. Indices are built with following rules:
+     *
+     * <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>
+     * </ul>
+     *
+     * <strong>Do not modify this array after construction</strong>, since the same array is shared by many
+     * objects and there is no synchronization.
+     */
+    final GeodeticOperation[] redimensioned;
+
+    /**
+     * Constructs a math transform provider from a set of parameters. The provider name and
+     * {@linkplain #getIdentifiers() identifiers} will be the same than the parameter ones.
+     * This method expects an array either {@code null} or of length 4 with methods of the
+     * following dimensions:
+     *
+     * <ol>
+     *   <li>2 → 2 dimensions in {@code redimensioned[0]}</li>
+     *   <li>2 → 3 dimensions in {@code redimensioned[1]}</li>
+     *   <li>3 → 2 dimensions in {@code redimensioned[2]}</li>
+     *   <li>3 → 3 dimensions in {@code redimensioned[3]}</li>
+     * </ol>
+     *
+     * @param sourceDimensions  number of dimensions in the source CRS of this operation method.
+     * @param targetDimensions  number of dimensions in the target CRS of this operation method.
+     * @param parameters        description of parameters expected by this operation.
+     * @param redimensioned     providers for all combinations between 2D and 3D cases, or {@code null}.
+     */
+    GeodeticOperation(final int sourceDimensions,
+                      final int targetDimensions,
+                      final ParameterDescriptorGroup parameters,
+                      final GeodeticOperation[] redimensioned)
+    {
+        super(sourceDimensions, targetDimensions, parameters);
+        this.redimensioned = redimensioned;
+    }
+
+    /**
+     * Returns the three-dimensional variant of this operation method, or {@code null} if none.
+     * This method needs to be overridden only if the three-dimensional variant is an instance
+     * of a different class than this instance.
+     */
+    Class<? extends GeodeticOperation> variant3D() {
+        return null;
+    }
+
+    /**
+     * Returns the elements of the given array at an index computed from the given dimensions.
+     *
+     * @param  sourceDimensions  the desired number of input dimensions.
+     * @param  targetDimensions  the desired number of output dimensions.
+     * @return the redimensioned operation method, or {@code null} if none.
+     */
+    @Override
+    public final OperationMethod redimension(final int sourceDimensions, final int targetDimensions) {
+        if (redimensioned != null && (sourceDimensions & ~1) == 2 && (targetDimensions & ~1) == 2) {
+            final GeodeticOperation m = redimensioned[((sourceDimensions & 1) << 1) | (targetDimensions & 1)];
+            if (m != null) {
+                assert (m.getSourceDimensions() == sourceDimensions) : sourceDimensions;
+                assert (m.getTargetDimensions() == targetDimensions) : targetDimensions;
+                return m;
+            }
+        }
+        return super.redimension(sourceDimensions, targetDimensions);
+    }
+
+    /**
+     * Returns the interface implemented by all coordinate operations that extends this class.
+     *
+     * @return Fixed to {@link Transformation}.
+     */
+    @Override
+    public final Class<Transformation> getOperationType() {
+        return Transformation.class;
+    }
+
+    /**
+     * The inverse of {@code GeodeticOperation} is usually the same operation with parameter signs inverted.
+     *
+     * @return {@code true} for most {@code GeodeticOperation} instances.
+     */
+    @Override
+    public boolean isInvertible() {
+        return true;
+    }
+}

Propchange: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeodeticOperation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeodeticOperation.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -25,7 +25,6 @@ import org.opengis.parameter.ParameterDe
 import org.opengis.parameter.ParameterNotFoundException;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.MathTransformFactory;
-import org.opengis.referencing.operation.Transformation;
 import org.apache.sis.parameter.ParameterBuilder;
 import org.apache.sis.parameter.Parameters;
 import org.apache.sis.referencing.operation.matrix.Matrix4;
@@ -43,7 +42,7 @@ import org.apache.sis.referencing.operat
  * @module
  */
 @XmlTransient
-public class GeographicOffsets extends AbstractProvider {
+public class GeographicOffsets extends GeodeticOperation {
     /**
      * Serial number for inter-operability with different versions.
      */
@@ -79,35 +78,22 @@ public class GeographicOffsets extends A
     /**
      * Constructs a provider with default parameters.
      */
+    @SuppressWarnings("ThisEscapedInObjectConstruction")
     public GeographicOffsets() {
-        super(3, 3, PARAMETERS);
+        super(3, 3, PARAMETERS, new GeographicOffsets[4]);
+        redimensioned[0] = new GeographicOffsets2D(redimensioned);
+        redimensioned[1] = new GeographicOffsets(2, 3, PARAMETERS, redimensioned);
+        redimensioned[2] = new GeographicOffsets(3, 2, PARAMETERS, redimensioned);
+        redimensioned[3] = this;
     }
 
     /**
      * For subclasses constructor only.
      */
-    GeographicOffsets(int dim, ParameterDescriptorGroup parameters) {
-        super(dim, dim, parameters);
-    }
-
-    /**
-     * Returns the operation type.
-     *
-     * @return Interface implemented by all coordinate operations that use this method.
-     */
-    @Override
-    public final Class<Transformation> getOperationType() {
-        return Transformation.class;
-    }
-
-    /**
-     * The inverse of this operation is the same operation with parameter signs inverted.
-     *
-     * @return {@code true} for all {@code GeocentricAffine}.
-     */
-    @Override
-    public final boolean isInvertible() {
-        return true;
+    GeographicOffsets(int sourceDimensions, int targetDimensions,
+            ParameterDescriptorGroup parameters, GeodeticOperation[] redimensioned)
+    {
+        super(sourceDimensions, targetDimensions, parameters, redimensioned);
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets2D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets2D.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets2D.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeographicOffsets2D.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -53,7 +53,22 @@ public final class GeographicOffsets2D e
      * Constructs a provider with default parameters.
      */
     public GeographicOffsets2D() {
-        super(2, PARAMETERS);
+        this(null);
+    }
+
+    /**
+     * Constructs a provider that can be resized.
+     */
+    GeographicOffsets2D(GeodeticOperation[] redimensioned) {
+        super(2, 2, PARAMETERS, redimensioned);
+    }
+
+    /**
+     * Returns the three-dimensional variant of this operation method.
+     */
+    @Override
+    Class<GeographicOffsets> variant3D() {
+        return GeographicOffsets.class;
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LongitudeRotation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LongitudeRotation.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LongitudeRotation.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LongitudeRotation.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -65,8 +65,24 @@ public final class LongitudeRotation ext
     /**
      * Constructs a provider with default parameters.
      */
+    @SuppressWarnings("ThisEscapedInObjectConstruction")
     public LongitudeRotation() {
-        super(2, PARAMETERS);
+        this(2, 2, new LongitudeRotation[4]);
+        redimensioned[0] = this;
+        redimensioned[1] = new LongitudeRotation(2, 3, redimensioned);
+        redimensioned[2] = new LongitudeRotation(3, 2, redimensioned);
+        redimensioned[3] = new LongitudeRotation(3, 3, redimensioned);
+    }
+
+    /**
+     * Constructs a provider for the given dimensions.
+     *
+     * @param sourceDimensions  number of dimensions in the source CRS of this operation method.
+     * @param targetDimensions  number of dimensions in the target CRS of this operation method.
+     * @param redimensioned     providers for all combinations between 2D and 3D cases.
+     */
+    private LongitudeRotation(int sourceDimensions, int targetDimensions, GeodeticOperation[] redimensioned) {
+        super(sourceDimensions, targetDimensions, PARAMETERS, redimensioned);
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Molodensky.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Molodensky.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Molodensky.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Molodensky.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -146,11 +146,11 @@ public final class Molodensky extends Ge
     /**
      * Constructs a provider for the given dimensions.
      *
-     * @param sourceDimensions Number of dimensions in the source CRS of this operation method.
-     * @param targetDimensions Number of dimensions in the target CRS of this operation method.
-     * @param redimensioned    Providers for all combinations between 2D and 3D cases.
+     * @param sourceDimensions  number of dimensions in the source CRS of this operation method.
+     * @param targetDimensions  number of dimensions in the target CRS of this operation method.
+     * @param redimensioned     providers for all combinations between 2D and 3D cases.
      */
-    private Molodensky(int sourceDimensions, int targetDimensions, GeocentricAffineBetweenGeographic[] redimensioned) {
+    private Molodensky(int sourceDimensions, int targetDimensions, GeodeticOperation[] redimensioned) {
         super(sourceDimensions, targetDimensions, PARAMETERS, redimensioned);
     }
 

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MolodenskyInterpolation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MolodenskyInterpolation.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MolodenskyInterpolation.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MolodenskyInterpolation.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -68,15 +68,15 @@ public final class MolodenskyInterpolati
     /**
      * Constructs a provider for the given number of dimensions.
      *
-     * @param sourceDimensions Number of dimensions in the source CRS of this operation method.
-     * @param targetDimensions Number of dimensions in the target CRS of this operation method.
-     * @param parameters       The set of parameters (never {@code null}).
-     * @param redimensioned    Providers for all combinations between 2D and 3D cases.
+     * @param sourceDimensions  number of dimensions in the source CRS of this operation method.
+     * @param targetDimensions  number of dimensions in the target CRS of this operation method.
+     * @param parameters        description of parameters expected by this operation.
+     * @param redimensioned     providers for all combinations between 2D and 3D cases, or {@code null}.
      */
     private MolodenskyInterpolation(final int sourceDimensions,
                                     final int targetDimensions,
                                     final ParameterDescriptorGroup parameters,
-                                    final FranceGeocentricInterpolation[] redimensioned)
+                                    final GeodeticOperation[] redimensioned)
     {
         super(sourceDimensions, targetDimensions, parameters, redimensioned);
     }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PositionVector7Param.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PositionVector7Param.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PositionVector7Param.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PositionVector7Param.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -56,7 +56,7 @@ public final class PositionVector7Param
      * Constructs the provider.
      */
     public PositionVector7Param() {
-        super(3, 3, PARAMETERS);
+        super(3, 3, PARAMETERS, null);
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PositionVector7Param2D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PositionVector7Param2D.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PositionVector7Param2D.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PositionVector7Param2D.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -59,7 +59,22 @@ public final class PositionVector7Param2
      * Constructs the provider.
      */
     public PositionVector7Param2D() {
-        super(2, 2, PARAMETERS, null);
+        this(null);
+    }
+
+    /**
+     * Constructs a provider that can be resized.
+     */
+    PositionVector7Param2D(GeodeticOperation[] redimensioned) {
+        super(2, 2, PARAMETERS, redimensioned);
+    }
+
+    /**
+     * Returns the three-dimensional variant of this operation method.
+     */
+    @Override
+    Class<PositionVector7Param3D> variant3D() {
+        return PositionVector7Param3D.class;
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PositionVector7Param3D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PositionVector7Param3D.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PositionVector7Param3D.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PositionVector7Param3D.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -56,7 +56,8 @@ public final class PositionVector7Param3
      */
     @SuppressWarnings("ThisEscapedInObjectConstruction")
     public PositionVector7Param3D() {
-        this(3, 3, new PositionVector7Param3D[4]);
+        this(3, 3, new GeocentricAffineBetweenGeographic[4]);
+        redimensioned[0] = new PositionVector7Param2D(      redimensioned);
         redimensioned[1] = new PositionVector7Param3D(2, 3, redimensioned);
         redimensioned[2] = new PositionVector7Param3D(3, 2, redimensioned);
         redimensioned[3] = this;
@@ -65,11 +66,11 @@ public final class PositionVector7Param3
     /**
      * Constructs a provider for the given dimensions.
      *
-     * @param sourceDimensions Number of dimensions in the source CRS of this operation method.
-     * @param targetDimensions Number of dimensions in the target CRS of this operation method.
-     * @param redimensioned    Providers for all combinations between 2D and 3D cases.
+     * @param sourceDimensions  number of dimensions in the source CRS of this operation method.
+     * @param targetDimensions  number of dimensions in the target CRS of this operation method.
+     * @param redimensioned     providers for all combinations between 2D and 3D cases, or {@code null}.
      */
-    private PositionVector7Param3D(int sourceDimensions, int targetDimensions, GeocentricAffineBetweenGeographic[] redimensioned) {
+    private PositionVector7Param3D(int sourceDimensions, int targetDimensions, GeodeticOperation[] redimensioned) {
         super(sourceDimensions, targetDimensions, PARAMETERS, redimensioned);
     }
 

Added: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Providers.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Providers.java?rev=1738658&view=auto
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Providers.java (added)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Providers.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.internal.referencing.provider;
+
+import java.util.List;
+import org.opengis.referencing.operation.OperationMethod;
+import org.apache.sis.internal.util.LazySet;
+
+
+/**
+ * The provider of coordinate operations. All operations are read from the information provided
+ * in the {@code META-INF/services/org.opengis.referencing.operation.OperationMethod} files.
+ *
+ * <p>This class is <strong>not</strong> thread-safe. Synchronization are user's responsibility.</p>
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.7
+ * @version 0.7
+ * @module
+ */
+public final class Providers extends LazySet<OperationMethod> {
+    /**
+     * Creates new set of provider.
+     */
+    public Providers() {
+        super(OperationMethod.class);
+    }
+
+    /**
+     * Caches a new element, possibly substituting the created instance by a previously created instance.
+     *
+     * @param element The element to add to the cache.
+     */
+    @Override
+    protected void cache(OperationMethod element) {
+        if (element instanceof GeodeticOperation) {
+            final Class<?> variant3D = ((GeodeticOperation) element).variant3D();
+            if (variant3D != null) {
+                final List<OperationMethod> cached = cached();
+                for (int i=cached.size(); --i >= 0;) {
+                    final OperationMethod m = cached.get(i);
+                    if (m.getClass() == variant3D) {
+                        final GeodeticOperation candidate = ((GeodeticOperation) m).redimensioned[0];
+                        if (candidate != null) {            // Should not be null, but let be safe.
+                            assert candidate.getClass() == element.getClass() : variant3D;
+                            element = candidate;
+                            break;
+                        }
+                    }
+                }
+            }
+        }
+        super.cache(element);
+    }
+}

Propchange: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Providers.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Providers.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/VerticalOffset.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/VerticalOffset.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/VerticalOffset.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/VerticalOffset.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -70,7 +70,7 @@ public final class VerticalOffset extend
      * Constructs a provider with default parameters.
      */
     public VerticalOffset() {
-        super(1, PARAMETERS);
+        super(1, 1, PARAMETERS, null);
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -89,7 +89,7 @@ final class AuthorityFactories<T extends
      * Creates a new provider for factories of the given type.
      */
     private AuthorityFactories(final Class<T> type) {
-        super(ServiceLoader.load(type));
+        super(type);
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -1588,11 +1588,11 @@ public class MultiAuthoritiesFactory ext
      */
     public void reload() {
         for (int type=0; type < providers.length; type++) {
-            Iterable<?> provider = providers[type];
+            final Iterable<?> provider = providers[type];
             if (provider != null) {
                 synchronized (provider) {
                     if (provider instanceof LazySet<?>) {
-                        provider = ((LazySet<?>) provider).reload();
+                        ((LazySet<?>) provider).reload();
                     }
                     if (provider instanceof ServiceLoader<?>) {
                         ((ServiceLoader<?>) provider).reload();

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -28,6 +28,7 @@ import java.util.logging.LogRecord;
 import javax.measure.converter.ConversionException;
 
 import org.opengis.util.FactoryException;
+import org.opengis.util.NoSuchIdentifierException;
 import org.opengis.metadata.Identifier;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.referencing.IdentifiedObject;
@@ -44,9 +45,11 @@ import org.apache.sis.referencing.Abstra
 import org.apache.sis.referencing.cs.CoordinateSystems;
 import org.apache.sis.referencing.operation.matrix.Matrices;
 import org.apache.sis.referencing.operation.transform.MathTransforms;
+import org.apache.sis.referencing.operation.transform.DefaultMathTransformFactory;
 import org.apache.sis.referencing.factory.IdentifiedObjectFinder;
 import org.apache.sis.referencing.factory.MissingFactoryResourceException;
 import org.apache.sis.metadata.iso.extent.Extents;
+import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.internal.metadata.ReferencingServices;
 import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.internal.util.Citations;
@@ -174,11 +177,14 @@ final class CoordinateOperationRegistry
                 CoordinateOperation operation = search(source, target);
                 if (operation != null) {
                     /*
-                     * Found an operation. If we had to extract the horizontal part of some 3D CRS,
-                     * then we need to modify the coordinate operation.
+                     * Found an operation. If we had to extract the horizontal part of some 3D CRS, then we
+                     * need to modify the coordinate operation in order to match the new number of dimensions.
                      */
                     if (combine != 0) {
                         operation = propagateVertical(operation, source != sourceCRS, target != targetCRS);
+                        if (operation == null) {
+                            continue;
+                        }
                         operation = complete(operation, sourceCRS, targetCRS);
                     }
                     return operation;
@@ -421,6 +427,7 @@ final class CoordinateOperationRegistry
      * @param  targetCRS  the target CRS to give to the new operation.
      * @param  mtFactory  the math transform factory to use.
      * @return a new operation, or {@code operation} if {@code prepend} and {@code append} were nulls or identity transforms.
+     * @throws IllegalArgumentException if the operation method can not have the desired number of dimensions.
      * @throws FactoryException if the operation can not be constructed.
      */
     private CoordinateOperation transform(final CoordinateReferenceSystem sourceCRS,
@@ -429,7 +436,7 @@ final class CoordinateOperationRegistry
                                           final MathTransform             append,
                                           final CoordinateReferenceSystem targetCRS,
                                           final MathTransformFactory      mtFactory)
-            throws FactoryException
+            throws IllegalArgumentException, FactoryException
     {
         if ((prepend == null || prepend.isIdentity()) && (append == null || append.isIdentity())) {
             return operation;
@@ -463,7 +470,7 @@ final class CoordinateOperationRegistry
         if (prepend != null) transform = mtFactory.createConcatenatedTransform(prepend, transform);
         if (append  != null) transform = mtFactory.createConcatenatedTransform(transform, append);
         assert !transform.equals(operation.getMathTransform()) : transform;
-        return recreate(operation, sourceCRS, targetCRS, transform);
+        return recreate(operation, sourceCRS, targetCRS, transform, null);
     }
 
     /**
@@ -475,13 +482,17 @@ final class CoordinateOperationRegistry
      * @param  sourceCRS  the source CRS specified by the user.
      * @param  targetCRS  the target CRS specified by the user
      * @param  transform  the math transform to use in replacement to the one in {@code operation}.
+     * @param  method     the operation method, or {@code null} for attempting an automatic detection.
      * @return a new operation from the given source CRS to target CRS using the given transform.
+     * @throws IllegalArgumentException if the operation method can not have the desired number of dimensions.
      * @throws FactoryException if an error occurred while creating the new operation.
      */
     private CoordinateOperation recreate(final CoordinateOperation       operation,
                                                CoordinateReferenceSystem sourceCRS,
                                                CoordinateReferenceSystem targetCRS,
-                                         final MathTransform             transform) throws FactoryException
+                                         final MathTransform             transform,
+                                               OperationMethod           method)
+            throws IllegalArgumentException, FactoryException
     {
         /*
          * If the user-provided CRS are approximatively equal to the coordinate operation CRS, keep the later.
@@ -493,10 +504,11 @@ final class CoordinateOperationRegistry
         if (Utilities.equalsApproximatively(targetCRS, crs = operation.getTargetCRS())) targetCRS = crs;
         final Map<String,Object> properties = new HashMap<>(derivedFrom(operation));
         /*
-         * Determine whether the operation to create is a Conversion or a Transformation.
-         * Conversion may also be a more accurate type like Projection. We want the GeoAPI
-         * interface. The most reliable way is to ask to the operation, but this is SIS-specific.
-         * The fallback uses reflection.
+         * Determine whether the operation to create is a Conversion or a Transformation
+         * (could also be a Conversion subtype like Projection, but this is less important).
+         * We want the GeoAPI interface, not the implementation class.
+         * The most reliable way is to ask to the 'AbstractOperation.getInterface()' method,
+         * but this is SIS-specific. The fallback uses reflection.
          */
         if (operation instanceof AbstractIdentifiedObject) {
             properties.put(ReferencingServices.OPERATION_TYPE_KEY,
@@ -509,14 +521,30 @@ final class CoordinateOperationRegistry
             }
         }
         /*
-         * Reuse the same operation method, just changing its number of dimension.
+         * Reuse the same operation method, but we may need to change its number of dimension.
+         * The capability to resize an OperationMethod is specific to Apache SIS, so we must
+         * be prepared to see the 'redimension' call fails. In such case, we will try to get
+         * the SIS implementation of the operation method and try again.
          */
-        OperationMethod method = null;
         if (operation instanceof SingleOperation) {
             final SingleOperation single = (SingleOperation) operation;
             properties.put(ReferencingServices.PARAMETERS_KEY, single.getParameterValues());
-            method = DefaultOperationMethod.redimension(single.getMethod(),
-                            transform.getSourceDimensions(), transform.getTargetDimensions());
+            if (method == null) {
+                final int sourceDimensions = transform.getSourceDimensions();
+                final int targetDimensions = transform.getTargetDimensions();
+                method = single.getMethod();
+                try {
+                    method = DefaultOperationMethod.redimension(method, sourceDimensions, targetDimensions);
+                } catch (IllegalArgumentException ex) {
+                    try {
+                        method = factory.getOperationMethod(method.getName().getCode());
+                        method = DefaultOperationMethod.redimension(method, sourceDimensions, targetDimensions);
+                    } catch (NoSuchIdentifierException | IllegalArgumentException se) {
+                        ex.addSuppressed(se);
+                        throw ex;
+                    }
+                }
+            }
         }
         return factorySIS.createSingleOperation(properties, sourceCRS, targetCRS,
                 AbstractCoordinateOperation.getInterpolationCRS(operation), method, transform);
@@ -541,10 +569,11 @@ final class CoordinateOperationRegistry
      * @param  target3D  {@code true} for adding ellipsoidal height in target coordinates.
      * @return a coordinate operation with the source and/or target coordinates made 3D,
      *         or {@code null} if this method does not know how to create the operation.
+     * @throws IllegalArgumentException if the operation method can not have the desired number of dimensions.
      * @throws FactoryException if an error occurred while creating the coordinate operation.
      */
     private CoordinateOperation propagateVertical(final CoordinateOperation operation,
-            final boolean source3D, final boolean target3D) throws FactoryException
+            final boolean source3D, final boolean target3D) throws IllegalArgumentException, FactoryException
     {
         final List<CoordinateOperation> operations = new ArrayList<>();
         if (operation instanceof ConcatenatedOperation) {
@@ -574,9 +603,10 @@ final class CoordinateOperationRegistry
      * @param  forward     {@code true} for adding the vertical axis at the beginning, or
      *                     {@code false} for adding the vertical axis at the end.
      * @return {@code true} on success.
+     * @throws IllegalArgumentException if the operation method can not have the desired number of dimensions.
      */
     private boolean propagateVertical(final ListIterator<CoordinateOperation> operations, final boolean forward)
-            throws FactoryException
+            throws IllegalArgumentException, FactoryException
     {
         while (forward ? operations.hasNext() : operations.hasPrevious()) {
             final CoordinateOperation op = forward ? operations.next() : operations.previous();
@@ -594,14 +624,40 @@ final class CoordinateOperationRegistry
                 break;
             }
             /*
-             * We can process only linear operations, otherwise we would not know how to add a dimension.
+             * We can process mostly linear operations, otherwise it is hard to know how to add a dimension.
              * Examples of linear operations are:
              *
              *   - Longitude rotation (EPSG:9601). Note that this is a transformation rather than a conversion.
              *   - Geographic3D to 2D conversion (EPSG:9659).
+             *
+             * However there is a few special cases where we may be able to add a dimension in a non-linear operation.
+             * We can attempt those special cases by just giving the same parameters to the math transform factory
+             * together with the desired CRS. Examples of such special cases are:
+             *
+             *   - Geocentric translations (geog2D domain)
+             *   - Coordinate Frame Rotation (geog2D domain)
+             *   - Position Vector transformation (geog2D domain)
              */
             Matrix matrix = MathTransforms.getMatrix(op.getMathTransform());
             if (matrix == null) {
+                if (op instanceof SingleOperation) {
+                    final MathTransformFactory mtFactory = factorySIS.getMathTransformFactory();
+                    if (mtFactory instanceof DefaultMathTransformFactory) {
+                        final CoordinateReferenceSystem source3D = toGeodetic3D(sourceCRS);
+                        final CoordinateReferenceSystem target3D = toGeodetic3D(targetCRS);
+                        final MathTransform mt;
+                        try {
+                            mt = ((DefaultMathTransformFactory) mtFactory).createParameterizedTransform(
+                                    ((SingleOperation) op).getParameterValues(),
+                                    ReferencingUtilities.createTransformContext(source3D, target3D, null));
+                        } catch (FactoryException e) {
+                            log(e);
+                            break;
+                        }
+                        operations.set(recreate(op, source3D, target3D, mt, mtFactory.getLastMethodUsed()));
+                        return true;
+                    }
+                }
                 break;
             }
             /*
@@ -629,7 +685,7 @@ final class CoordinateOperationRegistry
                  * conform to the definition provided by the authority.
                  */
                 final MathTransform mt = factorySIS.getMathTransformFactory().createAffineTransform(matrix);
-                operations.set(recreate(op, toGeodetic3D(sourceCRS), toGeodetic3D(targetCRS), mt));
+                operations.set(recreate(op, toGeodetic3D(sourceCRS), toGeodetic3D(targetCRS), mt, null));
             }
             /*
              * If we processed the operation that change the number of dimensions, we are done.

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -61,6 +61,7 @@ import org.apache.sis.internal.referenci
 import org.apache.sis.internal.referencing.j2d.ParameterizedAffine;
 import org.apache.sis.internal.referencing.provider.AbstractProvider;
 import org.apache.sis.internal.referencing.provider.VerticalOffset;
+import org.apache.sis.internal.referencing.provider.Providers;
 import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.parameter.DefaultParameterValueGroup;
@@ -267,7 +268,7 @@ public class DefaultMathTransformFactory
          *
          * Wrapping the ServiceLoader in a LazySet avoid this issue.
          */
-        this(new LazySet<>(ServiceLoader.load(OperationMethod.class)));
+        this(new Providers());
     }
 
     /**
@@ -384,7 +385,10 @@ public class DefaultMathTransformFactory
         ArgumentChecks.ensureNonEmpty("identifier", identifier);
         OperationMethod method = methodsByName.get(identifier);
         if (method == null) {
-            method = ReferencingServices.getInstance().getOperationMethod(methods, identifier);
+            final ReferencingServices services = ReferencingServices.getInstance();
+            synchronized (methods) {
+                method = services.getOperationMethod(methods, identifier);
+            }
             if (method == null) {
                 throw new NoSuchIdentifierException(Errors.format(Errors.Keys.NoSuchOperationMethod_1, identifier), identifier);
             }
@@ -1414,9 +1418,9 @@ public class DefaultMathTransformFactory
     public void reload() {
         synchronized (methods) {
             methodsByName.clear();
-            Iterable<? extends OperationMethod> m = methods;
+            final Iterable<? extends OperationMethod> m = methods;
             if (m instanceof LazySet<?>) { // Workaround for JDK bug. See DefaultMathTransformFactory() constructor.
-                m = ((LazySet<? extends OperationMethod>) m).reload();
+                ((LazySet<? extends OperationMethod>) m).reload();
             }
             if (m instanceof ServiceLoader<?>) {
                 ((ServiceLoader<?>) m).reload();

Modified: sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/resources/META-INF/services/org.opengis.referencing.operation.OperationMethod [UTF-8] Mon Apr 11 22:31:34 2016
@@ -12,12 +12,12 @@ org.apache.sis.internal.referencing.prov
 org.apache.sis.internal.referencing.provider.CoordinateFrameRotation
 org.apache.sis.internal.referencing.provider.GeographicToGeocentric
 org.apache.sis.internal.referencing.provider.GeocentricToGeographic
-org.apache.sis.internal.referencing.provider.GeocentricTranslation2D
 org.apache.sis.internal.referencing.provider.GeocentricTranslation3D
-org.apache.sis.internal.referencing.provider.PositionVector7Param2D
+org.apache.sis.internal.referencing.provider.GeocentricTranslation2D
 org.apache.sis.internal.referencing.provider.PositionVector7Param3D
-org.apache.sis.internal.referencing.provider.CoordinateFrameRotation2D
+org.apache.sis.internal.referencing.provider.PositionVector7Param2D
 org.apache.sis.internal.referencing.provider.CoordinateFrameRotation3D
+org.apache.sis.internal.referencing.provider.CoordinateFrameRotation2D
 org.apache.sis.internal.referencing.provider.Molodensky
 org.apache.sis.internal.referencing.provider.AbridgedMolodensky
 org.apache.sis.internal.referencing.provider.Equirectangular

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java?rev=1738658&r1=1738657&r2=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/PoleRotationMock.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -36,7 +36,7 @@ import org.apache.sis.parameter.Paramete
  * @module
  */
 @SuppressWarnings("serial")
-public final strictfp class PoleRotationMock extends MockProvider {
+public final strictfp class PoleRotationMock extends ProviderMock {
     /**
      * The group of all parameters expected by this coordinate operation.
      */

Copied: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProviderMock.java (from r1738656, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/MockProvider.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProviderMock.java?p2=sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProviderMock.java&p1=sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/MockProvider.java&r1=1738656&r2=1738658&rev=1738658&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/MockProvider.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/ProviderMock.java [UTF-8] Mon Apr 11 22:31:34 2016
@@ -34,15 +34,15 @@ import org.apache.sis.referencing.operat
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.6
- * @version 0.6
+ * @version 0.7
  * @module
  */
 @SuppressWarnings("serial")
-abstract strictfp class MockProvider extends AbstractProvider {
+abstract strictfp class ProviderMock extends AbstractProvider {
     /**
      * Creates a new mock provider.
      */
-    MockProvider(final int sourceDimension,
+    ProviderMock(final int sourceDimension,
                  final int targetDimension,
                  final ParameterDescriptorGroup parameters)
     {
@@ -59,8 +59,8 @@ abstract strictfp class MockProvider ext
     @Override
     public final MathTransform createMathTransform(MathTransformFactory factory, ParameterValueGroup parameters) {
         return new AbstractMathTransform() {
-            @Override public int getSourceDimensions() {return MockProvider.this.getSourceDimensions();}
-            @Override public int getTargetDimensions() {return MockProvider.this.getTargetDimensions();}
+            @Override public int getSourceDimensions() {return ProviderMock.this.getSourceDimensions();}
+            @Override public int getTargetDimensions() {return ProviderMock.this.getTargetDimensions();}
             @Override
             public Matrix transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, boolean derivate) {
                 throw new UnsupportedOperationException();



Mime
View raw message