sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1737518 - in /sis/branches/JDK8/core/sis-referencing/src: main/java/org/apache/sis/internal/referencing/provider/ main/java/org/apache/sis/referencing/operation/ main/resources/META-INF/services/ test/java/org/apache/sis/internal/referenci...
Date Sat, 02 Apr 2016 16:40:26 GMT
Author: desruisseaux
Date: Sat Apr  2 16:40:25 2016
New Revision: 1737518

URL: http://svn.apache.org/viewvc?rev=1737518&view=rev
Log:
Fix support of Geographic 2D <-> 3D conversions.

Added:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic2Dto3D.java
      - copied, changed from r1737448, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2D.java
Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2D.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationInference.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/AllProvidersTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationInferenceTest.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java?rev=1737518&r1=1737517&r2=1737518&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java
[UTF-8] Sat Apr  2 16:40:25 2016
@@ -180,7 +180,7 @@ public abstract class AbstractProvider e
     }
 
     /**
-     * Creates a false easting or northing parameter in metre with a default value of 0.
+     * Creates a false easting, false northing or height parameter in metre with a default
value of 0.
      */
     static ParameterDescriptor<Double> createShift(final ParameterBuilder builder)
{
         return builder.create(0.0, SI.METRE);

Copied: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic2Dto3D.java
(from r1737448, sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2D.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic2Dto3D.java?p2=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic2Dto3D.java&p1=sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2D.java&r1=1737448&r2=1737518&rev=1737518&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2D.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic2Dto3D.java
[UTF-8] Sat Apr  2 16:40:25 2016
@@ -19,25 +19,26 @@ package org.apache.sis.internal.referenc
 import javax.xml.bind.annotation.XmlTransient;
 import org.opengis.util.FactoryException;
 import org.opengis.parameter.ParameterValueGroup;
+import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
 import org.opengis.referencing.operation.Conversion;
 import org.opengis.referencing.operation.MathTransform;
 import org.opengis.referencing.operation.MathTransformFactory;
-import org.opengis.referencing.operation.NoninvertibleTransformException;
 import org.apache.sis.referencing.operation.matrix.Matrices;
 import org.apache.sis.referencing.operation.matrix.MatrixSIS;
-import org.apache.sis.referencing.operation.transform.MathTransforms;
-import org.apache.sis.parameter.Parameterized;
-import org.apache.sis.io.wkt.Formatter;
-import org.apache.sis.io.wkt.FormattableObject;
-import org.apache.sis.internal.metadata.WKTKeywords;
-import org.apache.sis.internal.referencing.WKTUtilities;
+import org.apache.sis.metadata.iso.citation.Citations;
+import org.apache.sis.internal.util.Constants;
+import org.apache.sis.parameter.ParameterBuilder;
+import org.apache.sis.parameter.Parameters;
 
 
 /**
- * The provider for <cite>"Geographic 3D to 2D conversion"</cite> (EPSG:9659).
- * This is a trivial operation that just drop the height in a geographic coordinate.
- * The inverse operation arbitrarily set the ellipsoidal height to zero.
+ * The provider for <cite>"Geographic 2D to 3D conversion"</cite>.
+ * The default operation sets the ellipsoidal height to zero.
+ *
+ * <p>This operation is a SIS extension; the EPSG dataset defines only the 3D to 2D
case.
+ * Consequently, WKT formatting will not represent "2D to 3D" transform. Instead, WKT will
+ * format the inverse ({@code "INVERSE_MT"}) of 3D to 2D transform.</p>
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.7
@@ -45,28 +46,32 @@ import org.apache.sis.internal.referenci
  * @module
  */
 @XmlTransient
-public final class Geographic3Dto2D extends AbstractProvider {
+public final class Geographic2Dto3D extends AbstractProvider {
     /**
      * Serial number for inter-operability with different versions.
      */
-    private static final long serialVersionUID = -9103595336196565505L;
+    private static final long serialVersionUID = -1198461394243672064L;
 
     /**
-     * The group of all parameters expected by this coordinate operation (in this case, none).
+     * The ellipsoidal height to set.
      */
-    static final ParameterDescriptorGroup PARAMETERS = builder()
-            .addIdentifier("9659").addName("Geographic3D to 2D conversion").createGroup();
+    public static final ParameterDescriptor<Double> HEIGHT;
 
     /**
-     * The unique instance, created when first needed.
+     * The group of all parameters expected by this coordinate operation.
      */
-    private transient MathTransform transform;
+    public static final ParameterDescriptorGroup PARAMETERS;
+    static {
+        final ParameterBuilder builder = builder().setCodeSpace(Citations.SIS, Constants.SIS);
+        HEIGHT = createShift(builder.addName("height"));
+        PARAMETERS = builder.addName("Geographic2D to 3D conversion").createGroup(HEIGHT);
+    }
 
     /**
      * Constructs a provider with default parameters.
      */
-    public Geographic3Dto2D() {
-        super(3, 2, PARAMETERS);
+    public Geographic2Dto3D() {
+        super(2, 3, PARAMETERS);
     }
 
     /**
@@ -82,91 +87,19 @@ public final class Geographic3Dto2D exte
     /**
      * Returns the transform.
      *
-     * <div class="note"><b>Implementation note:</b>
-     * creating a transform that drop a dimension is trivial. We even have a helper method
for that:
-     * {@link Matrices#createDimensionSelect}  The difficulty is that the inverse of that
transform
-     * will set the height to NaN, while we want zero. The trick is to first create the transform
for
-     * the inverse transform with the zero that we want, then get the inverse of that inverse
transform.
-     * The transform that we get will remember where it come from (its inverse).
-     *
-     * <p>This work with SIS implementation, but is not guaranteed to work with other
implementations.
-     * For that reason, this method does not use the given {@code factory}.</p></div>
-     *
-     * @param  factory Ignored (can be null).
-     * @param  values Ignored.
-     * @return The math transform.
-     * @throws FactoryException should never happen.
+     * @param  factory The factory for creating affine transforms.
+     * @param  values The parameter values.
+     * @return The math transform for the given parameter values.
+     * @throws FactoryException if an error occurred while creating the transform.
      */
     @Override
-    public synchronized MathTransform createMathTransform(MathTransformFactory factory, ParameterValueGroup
values)
+    public MathTransform createMathTransform(MathTransformFactory factory, ParameterValueGroup
values)
             throws FactoryException
     {
-        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(3, 2, 1);
-            transform = MathTransforms.linear(m).inverse();
-        } catch (NoninvertibleTransformException e) {
-            throw new FactoryException(e);                          // Should never happen.
-        }
-        return transform;
-    }
-
-    /**
-     * A temporary placeholder used for formatting a {@code PARAM_MT["Geographic 3D to 2D
conversion"]}
-     * element in Well-Known Text format. This placeholder is needed there is no {@link MathTransform}
-     * implementation for the Geographic 3D to 2D conversion, since we use affine transform
instead.
-     */
-    public static final class WKT extends FormattableObject implements Parameterized {
-        /**
-         * {@code true} if this placeholder is for the inverse transform instead than the
direct one.
-         */
-        private final boolean inverse;
-
-        /**
-         * Creates a new object to be formatted.
-         *
-         * @param inverse {@code false} for the "Geographic3D to 2D" operation, or {@code
true} for its inverse.
-         */
-        public WKT(final boolean inverse) {
-            this.inverse = inverse;
-        }
-
-        /**
-         * Returns the parameters descriptor.
-         */
-        @Override
-        public ParameterDescriptorGroup getParameterDescriptors() {
-            return PARAMETERS;
-        }
-
-        /**
-         * Returns the parameter values.
-         */
-        @Override
-        public ParameterValueGroup getParameterValues() {
-            return PARAMETERS.createValue();
-        }
-
-        /**
-         * Formats a <cite>Well Known Text</cite> version 1 (WKT 1) element for
a transform using this group of parameters.
-         *
-         * <div class="note"><b>Compatibility note:</b>
-         * {@code Param_MT} is defined in the WKT 1 specification only.
-         * If the {@linkplain Formatter#getConvention() formatter convention} is set to WKT
2,
-         * then this method silently uses the WKT 1 convention without raising an error.</div>
-         *
-         * @return {@code "Param_MT"} or {@code "Inverse_MT"}.
-         */
-        @Override
-        protected String formatTo(final Formatter formatter) {
-            if (inverse) {
-                formatter.append(new WKT(false));
-                return WKTKeywords.Inverse_MT;
-            } else {
-                WKTUtilities.appendParamMT(getParameterValues(), formatter);
-                return WKTKeywords.Param_MT;
-            }
-        }
+        final Parameters pv = Parameters.castOrWrap(values);
+        final MatrixSIS m = Matrices.createDiagonal(4, 3);
+        m.setElement(2, 2, pv.doubleValue(HEIGHT));
+        m.setElement(3, 2, 1);
+        return factory.createAffineTransform(m);
     }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2D.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2D.java?rev=1737518&r1=1737517&r2=1737518&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2D.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Geographic3Dto2D.java
[UTF-8] Sat Apr  2 16:40:25 2016
@@ -37,7 +37,7 @@ import org.apache.sis.internal.referenci
 /**
  * The provider for <cite>"Geographic 3D to 2D conversion"</cite> (EPSG:9659).
  * This is a trivial operation that just drop the height in a geographic coordinate.
- * The inverse operation arbitrarily set the ellipsoidal height to zero.
+ * The inverse operation arbitrarily sets the ellipsoidal height to zero.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.7
@@ -54,7 +54,7 @@ public final class Geographic3Dto2D exte
     /**
      * The group of all parameters expected by this coordinate operation (in this case, none).
      */
-    static final ParameterDescriptorGroup PARAMETERS = builder()
+    public static final ParameterDescriptorGroup PARAMETERS = builder()
             .addIdentifier("9659").addName("Geographic3D to 2D conversion").createGroup();
 
     /**
@@ -113,9 +113,9 @@ public final class Geographic3Dto2D exte
     }
 
     /**
-     * A temporary placeholder used for formatting a {@code PARAM_MT["Geographic 3D to 2D
conversion"]}
-     * element in Well-Known Text format. This placeholder is needed there is no {@link MathTransform}
-     * implementation for the Geographic 3D to 2D conversion, since we use affine transform
instead.
+     * A temporary placeholder used for formatting a {@code PARAM_MT["Geographic 3D to 2D
conversion"]} element in
+     * Well-Known Text format. This placeholder is needed because there is no {@link MathTransform}
implementation
+     * for the Geographic 3D to 2D conversion, since we use affine transform instead.
      */
     public static final class WKT extends FormattableObject implements Parameterized {
         /**

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationInference.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationInference.java?rev=1737518&r1=1737517&r2=1737518&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationInference.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationInference.java
[UTF-8] Sat Apr  2 16:40:25 2016
@@ -38,6 +38,8 @@ import org.apache.sis.internal.metadata.
 import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.internal.referencing.CoordinateOperations;
 import org.apache.sis.internal.referencing.PositionalAccuracyConstant;
+import org.apache.sis.internal.referencing.provider.Geographic2Dto3D;
+import org.apache.sis.internal.referencing.provider.Geographic3Dto2D;
 import org.apache.sis.internal.referencing.provider.GeographicToGeocentric;
 import org.apache.sis.internal.referencing.provider.GeocentricToGeographic;
 import org.apache.sis.internal.referencing.provider.GeocentricAffine;
@@ -501,11 +503,18 @@ public class CoordinateOperationInferenc
             parameters = (isGeographicToGeocentric ? GeographicToGeocentric.PARAMETERS
                                                    : GeocentricToGeographic.PARAMETERS).createValue();
         } else {
-            parameters = TensorParameters.WKT1.createValueGroup(properties(Constants.AFFINE));
 // Initialized to identity.
-            parameters.parameter(Constants.NUM_COL).setValue(sourceCS.getDimension() + 1);
-            parameters.parameter(Constants.NUM_ROW).setValue(targetCS.getDimension() + 1);
-            before = mtFactory.createCoordinateSystemChange(sourceCS, targetCS);
-            context.setSource(targetCS);
+            final int sourceDim = sourceCS.getDimension();
+            final int targetDim = targetCS.getDimension();
+            if ((sourceDim & ~1) == 2 && (sourceDim ^ targetDim) == 1) {    //
sourceDim == 2 or 3 and difference with targetDim is 1.
+                parameters = (sourceDim == 2 ? Geographic2Dto3D.PARAMETERS
+                                             : Geographic3Dto2D.PARAMETERS).createValue();
+            } else {
+                parameters = TensorParameters.WKT1.createValueGroup(properties(Constants.AFFINE));
     // Initialized to identity.
+                parameters.parameter(Constants.NUM_COL).setValue(targetDim + 1);
+                parameters.parameter(Constants.NUM_ROW).setValue(targetDim + 1);
+                before = mtFactory.createCoordinateSystemChange(sourceCS, targetCS);
+                context.setSource(targetCS);
+            }
         }
         /*
          * Transform between differents datums using Bursa Wolf parameters. The Bursa Wolf
parameters are used
@@ -727,7 +736,7 @@ public class CoordinateOperationInferenc
             }
         }
         properties.put(ReferencingServices.OPERATION_TYPE_KEY, type);
-        if (Conversion.class.isAssignableFrom(type)) {
+        if (Conversion.class.isAssignableFrom(type) && transform.isIdentity()) {
             properties.replace(IdentifiedObject.NAME_KEY, AXIS_CHANGES, IDENTITY);
         }
         return factorySIS.createSingleOperation(properties, sourceCRS, targetCRS, null, method,
transform);

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=1737518&r1=1737517&r2=1737518&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] Sat Apr  2 16:40:25 2016
@@ -2,6 +2,7 @@
 # Heavier classes (e.g. having more dependencies) or classes less likely to be used, should
be last.
 org.apache.sis.internal.referencing.provider.Affine
 org.apache.sis.internal.referencing.provider.Geographic3Dto2D
+org.apache.sis.internal.referencing.provider.Geographic2Dto3D
 org.apache.sis.internal.referencing.provider.GeographicOffsets
 org.apache.sis.internal.referencing.provider.GeographicOffsets2D
 org.apache.sis.internal.referencing.provider.VerticalOffset

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AllProvidersTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AllProvidersTest.java?rev=1737518&r1=1737517&r2=1737518&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AllProvidersTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AllProvidersTest.java
[UTF-8] Sat Apr  2 16:40:25 2016
@@ -68,6 +68,7 @@ public final strictfp class AllProviders
             GeographicToGeocentric.class,
             GeocentricToGeographic.class,
             Geographic3Dto2D.class,
+            Geographic2Dto3D.class,
             Molodensky.class,
             AbridgedMolodensky.class,
             Equirectangular.class,
@@ -92,7 +93,8 @@ public final strictfp class AllProviders
             ObliqueStereographic.class,
             NTv2.class,
             NADCON.class,
-            FranceGeocentricInterpolation.class
+            FranceGeocentricInterpolation.class,
+            Interpolation1D.class
         };
     }
 

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationInferenceTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationInferenceTest.java?rev=1737518&r1=1737517&r2=1737518&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationInferenceTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationInferenceTest.java
[UTF-8] Sat Apr  2 16:40:25 2016
@@ -194,9 +194,10 @@ public final strictfp class CoordinateOp
 
         final GeographicCRS       targetCRS = CommonCRS.WGS84.geographic();
         final CoordinateOperation operation = factory.createOperation(sourceCRS, targetCRS);
-        assertSame ("sourceCRS",  sourceCRS,  operation.getSourceCRS());
-        assertSame ("targetCRS",  targetCRS,  operation.getTargetCRS());
-        assertFalse("isIdentity", operation.getMathTransform().isIdentity());
+        assertSame  ("sourceCRS",  sourceCRS,  operation.getSourceCRS());
+        assertSame  ("targetCRS",  targetCRS,  operation.getTargetCRS());
+        assertFalse ("isIdentity", operation.getMathTransform().isIdentity());
+        assertEquals("name", "Datum shift", operation.getName().getCode());
         assertSetEquals(Arrays.asList(DATUM_SHIFT_APPLIED), operation.getCoordinateOperationAccuracy());
         assertInstanceOf("operation", Transformation.class, operation);
         assertEquals("method", "Geocentric translations (geog2D domain)",
@@ -238,9 +239,10 @@ public final strictfp class CoordinateOp
 
         final GeographicCRS       targetCRS = CommonCRS.WGS84.geographic();
         final CoordinateOperation operation = factory.createOperation(sourceCRS, targetCRS);
-        assertSame ("sourceCRS",  sourceCRS,  operation.getSourceCRS());
-        assertSame ("targetCRS",  targetCRS,  operation.getTargetCRS());
-        assertFalse("isIdentity", operation.getMathTransform().isIdentity());
+        assertSame  ("sourceCRS",  sourceCRS,  operation.getSourceCRS());
+        assertSame  ("targetCRS",  targetCRS,  operation.getTargetCRS());
+        assertFalse ("isIdentity", operation.getMathTransform().isIdentity());
+        assertEquals("name", "Datum shift", operation.getName().getCode());
         assertSetEquals(Arrays.asList(DATUM_SHIFT_APPLIED), operation.getCoordinateOperationAccuracy());
         assertInstanceOf("operation", Transformation.class, operation);
         assertEquals("method", "Geocentric translations (geog2D domain)",
@@ -282,9 +284,10 @@ public final strictfp class CoordinateOp
 
         final GeocentricCRS       targetCRS = CommonCRS.WGS84.geocentric();
         final CoordinateOperation operation = factory.createOperation(sourceCRS, targetCRS);
-        assertSame ("sourceCRS",  sourceCRS,  operation.getSourceCRS());
-        assertSame ("targetCRS",  targetCRS,  operation.getTargetCRS());
-        assertFalse("isIdentity", operation.getMathTransform().isIdentity());
+        assertSame  ("sourceCRS",  sourceCRS,  operation.getSourceCRS());
+        assertSame  ("targetCRS",  targetCRS,  operation.getTargetCRS());
+        assertFalse ("isIdentity", operation.getMathTransform().isIdentity());
+        assertEquals("name", "Datum shift", operation.getName().getCode());
         assertSetEquals(Arrays.asList(DATUM_SHIFT_APPLIED), operation.getCoordinateOperationAccuracy());
         assertInstanceOf("operation", Transformation.class, operation);
         assertEquals("method", "Geocentric translations (geocentric domain)",
@@ -334,8 +337,9 @@ public final strictfp class CoordinateOp
                 "    Unit[“US survey foot”, 0.304800609601219]]");
 
         final CoordinateOperation operation = factory.createOperation(sourceCRS, targetCRS);
-        assertSame("sourceCRS", sourceCRS, operation.getSourceCRS());
-        assertSame("targetCRS", targetCRS, operation.getTargetCRS());
+        assertSame  ("sourceCRS", sourceCRS, operation.getSourceCRS());
+        assertSame  ("targetCRS", targetCRS, operation.getTargetCRS());
+        assertEquals("name", "TM", operation.getName().getCode());
         assertInstanceOf("operation", Projection.class, operation);
 
         final ParameterValueGroup param = ((SingleOperation) operation).getParameterValues();
@@ -393,8 +397,9 @@ public final strictfp class CoordinateOp
         final TemporalCRS sourceCRS = CommonCRS.Temporal.UNIX.crs();
         final TemporalCRS targetCRS = CommonCRS.Temporal.MODIFIED_JULIAN.crs();
         final CoordinateOperation operation = factory.createOperation(sourceCRS, targetCRS);
-        assertSame("sourceCRS", sourceCRS, operation.getSourceCRS());
-        assertSame("targetCRS", targetCRS, operation.getTargetCRS());
+        assertSame  ("sourceCRS", sourceCRS, operation.getSourceCRS());
+        assertSame  ("targetCRS", targetCRS, operation.getTargetCRS());
+        assertEquals("name", "Axis changes", operation.getName().getCode());
         assertInstanceOf("operation", Conversion.class, operation);
 
         transform = operation.getMathTransform();
@@ -424,14 +429,15 @@ public final strictfp class CoordinateOp
      * @throws FactoryException if the operation can not be created.
      * @throws TransformException if an error occurred while converting the test points.
      */
-//  @Test
+    @Test
     @DependsOnMethod("testIdentityTransform")
     public void testGeographic3D_to_2D() throws FactoryException, TransformException {
         final GeographicCRS sourceCRS = CommonCRS.WGS84.geographic3D();
         final GeographicCRS targetCRS = CommonCRS.WGS84.geographic();
         final CoordinateOperation operation = factory.createOperation(sourceCRS, targetCRS);
-        assertSame("sourceCRS", sourceCRS, operation.getSourceCRS());
-        assertSame("targetCRS", targetCRS, operation.getTargetCRS());
+        assertSame  ("sourceCRS", sourceCRS, operation.getSourceCRS());
+        assertSame  ("targetCRS", targetCRS, operation.getTargetCRS());
+        assertEquals("name", "Axis changes", operation.getName().getCode());
         assertInstanceOf("operation", Conversion.class, operation);
 
         transform = operation.getMathTransform();
@@ -443,6 +449,15 @@ public final strictfp class CoordinateOp
             0, 1, 0, 0,
             0, 0, 0, 1
         }), ((LinearTransform) transform).getMatrix(), STRICT, false));
+
+        isInverseTransformSupported = false;
+        verifyTransform(new double[] {
+            30, 10,  20,
+            20, 30, -10
+        }, new double[] {
+            30, 10,
+            20, 30
+        });
         validate();
     }
 
@@ -453,14 +468,15 @@ public final strictfp class CoordinateOp
      * @throws FactoryException if the operation can not be created.
      * @throws TransformException if an error occurred while converting the test points.
      */
-//  @Test
+    @Test
     @DependsOnMethod("testGeographic3D_to_2D")
     public void testGeographic2D_to_3D() throws Exception {
         final GeographicCRS sourceCRS = CommonCRS.WGS84.geographic();
         final GeographicCRS targetCRS = CommonCRS.WGS84.geographic3D();
         final CoordinateOperation operation = factory.createOperation(sourceCRS, targetCRS);
-        assertSame("sourceCRS", sourceCRS, operation.getSourceCRS());
-        assertSame("targetCRS", targetCRS, operation.getTargetCRS());
+        assertSame  ("sourceCRS", sourceCRS, operation.getSourceCRS());
+        assertSame  ("targetCRS", targetCRS, operation.getTargetCRS());
+        assertEquals("name", "Axis changes", operation.getName().getCode());
         assertInstanceOf("operation", Conversion.class, operation);
 
         transform = operation.getMathTransform();



Mime
View raw message