sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1678705 - /sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java
Date Mon, 11 May 2015 09:38:10 GMT
Author: desruisseaux
Date: Mon May 11 09:38:10 2015
New Revision: 1678705

URL: http://svn.apache.org/r1678705
Log:
Referencing: check for number of dimensions can make an exception for "Affine" operation,
since it can easily be extended to any number of dimensions.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java?rev=1678705&r1=1678704&r2=1678705&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java
[UTF-8] Mon May 11 09:38:10 2015
@@ -28,9 +28,11 @@ import org.opengis.referencing.operation
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.apache.sis.parameter.Parameterized;
+import org.apache.sis.referencing.IdentifiedObjects;
 import org.apache.sis.referencing.operation.transform.MathTransforms;
 import org.apache.sis.referencing.operation.transform.PassThroughTransform;
 import org.apache.sis.internal.referencing.OperationMethods;
+import org.apache.sis.internal.util.Constants;
 import org.apache.sis.util.collection.Containers;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.ArgumentChecks;
@@ -195,7 +197,7 @@ class AbstractSingleOperation extends Ab
         Integer expected = method.getSourceDimensions();
         if (expected != null && actual > expected) {
             /*
-             * The given MathTransform use more dimensions than the OperationMethod.
+             * The given MathTransform uses more dimensions than the OperationMethod.
              * Try to locate one and only one sub-transform, ignoring axis swapping and scaling.
              */
             MathTransform subTransform = null;
@@ -227,8 +229,16 @@ class AbstractSingleOperation extends Ab
             }
             isTarget = 1; // true: wrong dimension is the target one.
         }
-        throw new IllegalArgumentException(Errors.getResources(properties).getString(
-                Errors.Keys.MismatchedTransformDimension_3, isTarget, expected, actual));
+        /*
+         * At least one dimension does not match.  In principle this is an error, but we
make an exception for the
+         * "Affine parametric transformation" (EPSG:9624). The reason is that while OGC define
that transformation
+         * as two-dimensional, it can easily be extended to any number of dimensions. Note
that Apache SIS already
+         * has special handling for this operation (a TensorParameters dedicated class, etc.)
+         */
+        if (!IdentifiedObjects.isHeuristicMatchForName(method, Constants.AFFINE)) {
+            throw new IllegalArgumentException(Errors.getResources(properties).getString(
+                    Errors.Keys.MismatchedTransformDimension_3, isTarget, expected, actual));
+        }
     }
 
     /**



Mime
View raw message