sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1713922 - in /sis/branches/JDK8/core: sis-metadata/src/main/java/org/apache/sis/io/wkt/ sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/ sis-referencing/src/main/java/org/apache/sis/referencing/operation/transfor...
Date Wed, 11 Nov 2015 19:51:16 GMT
Author: desruisseaux
Date: Wed Nov 11 19:51:16 2015
New Revision: 1713922

URL: http://svn.apache.org/viewvc?rev=1713922&view=rev
Log:
Format "Geographic/Geocentric conversion" in the two-dimensional case as a concatenation with
the "Geographic 3D/2D" conversion.
This is at WKT formatting time only - the objects in memory are different (they are matrices).
Opportunistically fix indentation of first element in CONCAT_MT[...].

Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.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/transform/AbstractMathTransform.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/EllipsoidalToCartesianTransform.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MolodenskyTransform.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/GeocentricTranslationTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/EllipsoidalToCartesianTransformTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java?rev=1713922&r1=1713921&r2=1713922&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
[UTF-8] Wed Nov 11 19:51:16 2015
@@ -493,7 +493,6 @@ public class Formatter implements Locali
      *
      * <p>This method has no effect in any of the following cases:</p>
      * <ul>
-     *   <li>WKT formatting has not yet started.</li>
      *   <li>This method has already been invoked before the next {@code append(…)}.</li>
      *   <li>The indentation is {@link WKTFormat#SINGLE_LINE}.</li>
      * </ul>
@@ -546,6 +545,8 @@ public class Formatter implements Locali
             } else {
                 buffer.append(symbols.getSeparator());
             }
+        } else if (requestNewLine) {
+            buffer.append(System.lineSeparator()).append(CharSequences.spaces(margin));
         }
         requestNewLine = false;
     }
@@ -557,7 +558,7 @@ public class Formatter implements Locali
      * @param keyword The element keyword (e.g. {@code "DATUM"}, {@code "AXIS"}, <i>etc</i>).
      */
     private void openElement(final boolean newLine, String keyword) {
-        if (newLine) {
+        if (newLine && buffer.length() != elementStart) {
             newLine();
         }
         appendSeparator();

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=1713922&r1=1713921&r2=1713922&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] Wed Nov 11 19:51:16 2015
@@ -27,6 +27,11 @@ import org.opengis.referencing.operation
 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;
 
 
 /**
@@ -49,7 +54,7 @@ public final class Geographic3Dto2D exte
     /**
      * The group of all parameters expected by this coordinate operation (in this case, none).
      */
-    private static final ParameterDescriptorGroup PARAMETERS =
+    static final ParameterDescriptorGroup PARAMETERS =
             builder().addIdentifier("9659").addName("Geographic3D to 2D conversion").createGroup();
 
     /**
@@ -106,4 +111,62 @@ public final class Geographic3Dto2D exte
         }
         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;
+            }
+        }
+    }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java?rev=1713922&r1=1713921&r2=1713922&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java
[UTF-8] Wed Nov 11 19:51:16 2015
@@ -932,7 +932,7 @@ public abstract class AbstractMathTransf
      * @param  transforms The full chain of concatenated transforms.
      * @param  index      The index of this transform in the {@code transforms} chain.
      * @param  inverse    Always {@code false}, except if we are formatting the inverse transform.
-     * @return Index of the last transform processed. Iteration should continue at that index
+ 1.
+     * @return Index of this transform in the {@code transforms} chain after processing.
      *
      * @see ConcatenatedTransform#getPseudoSteps()
      */
@@ -1098,7 +1098,7 @@ public abstract class AbstractMathTransf
          * but with the knowledge that this transform is an inverse transform.
          */
         @Override
-        final int beforeFormat(final List<Object> transforms, final int index, final
boolean inverse) {
+        int beforeFormat(final List<Object> transforms, final int index, final boolean
inverse) {
             final ContextualParameters parameters = getContextualParameters();
             if (parameters != null) {
                 return parameters.beforeFormat(transforms, index, inverse);

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java?rev=1713922&r1=1713921&r2=1713922&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java
[UTF-8] Wed Nov 11 19:51:16 2015
@@ -807,7 +807,7 @@ public class ContextualParameters extend
      * @param  transforms The full chain of concatenated transforms.
      * @param  index      The index of this transform in the {@code transforms} chain.
      * @param  inverse    Always {@code false}, except if we are formatting the inverse transform.
-     * @return Index of the last transform processed. Iteration should continue at that index
+ 1.
+     * @return Index of this transform in the {@code transforms} chain after processing.
      *
      * @see ConcatenatedTransform#getPseudoSteps()
      * @see AbstractMathTransform#beforeFormat(List, int, boolean)
@@ -941,12 +941,11 @@ public class ContextualParameters extend
                 assert (old instanceof LinearTransform);
             }
         } else {
-            index++;
             if (hasAfter) {
-                final Object old = transforms.set(index, after);
+                final Object old = transforms.set(index + 1, after);
                 assert (old instanceof LinearTransform);
             } else {
-                transforms.add(index, after);
+                transforms.add(index + 1, after);
             }
         }
         return index;

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/EllipsoidalToCartesianTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/EllipsoidalToCartesianTransform.java?rev=1713922&r1=1713921&r2=1713922&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/EllipsoidalToCartesianTransform.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/EllipsoidalToCartesianTransform.java
[UTF-8] Wed Nov 11 19:51:16 2015
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.referencing.operation.transform;
 
+import java.util.List;
 import java.util.Arrays;
 import java.util.Collections;
 import java.io.IOException;
@@ -41,6 +42,7 @@ import org.apache.sis.internal.referenci
 import org.apache.sis.internal.referencing.DirectPositionView;
 import org.apache.sis.internal.referencing.provider.GeocentricToGeographic;
 import org.apache.sis.internal.referencing.provider.GeographicToGeocentric;
+import org.apache.sis.internal.referencing.provider.Geographic3Dto2D;
 import org.apache.sis.parameter.DefaultParameterDescriptorGroup;
 import org.apache.sis.metadata.iso.ImmutableIdentifier;
 import org.apache.sis.referencing.operation.matrix.Matrix3;
@@ -249,9 +251,6 @@ public class EllipsoidalToCartesianTrans
         context = new ContextualParameters(GeographicToGeocentric.PARAMETERS, withHeight
? 4 : 3, 4);
         context.getOrCreate(SEMI_MAJOR).setValue(semiMajor, unit);
         context.getOrCreate(SEMI_MINOR).setValue(semiMinor, unit);
-        if (!withHeight) {
-            context.getOrCreate(DIMENSION).setValue(2);
-        }
         /*
          * Prepare two affine transforms to be executed before and after this EllipsoidalToCartesianTransform:
          *
@@ -538,7 +537,7 @@ public class EllipsoidalToCartesianTrans
      *       be rarely invoked. Since there is usually LinearTransforms before and after
this transform, the
      *       conversion between float and double will be handle by those LinearTransforms.
  If nevertheless
      *       this EllipsoidalToCartesianTransform is at the beginning or the end of a transformation
chain,
-     *       the method inherited from the subclass will work (even if slightly slower).
+     *       the methods inherited from the subclass will work (but may be slightly slower).
      */
 
     /**
@@ -798,5 +797,39 @@ next:   while (--numPts >= 0) {
         {
             inverseTransform(srcPts, srcOff, dstPts, dstOff, numPts);
         }
+
+        /**
+         * Given a transformation chain to format in WKT, inserts a "Geographic 3D to 2D"
pseudo-conversion
+         * after this transform (normally {@code transforms.get(index)}) if this conversion
computes no height.
+         *
+         * @param  transforms The full chain of concatenated transforms.
+         * @param  index      The index of this transform in the {@code transforms} chain.
+         * @return Index of this transform in the {@code transforms} chain after processing.
+         */
+        @Override
+        final int beforeFormat(final List<Object> transforms, int index, final boolean
inverse) {
+            index = super.beforeFormat(transforms, index, inverse);
+            if (!withHeight) {
+                transforms.add(++index, new Geographic3Dto2D.WKT(false));
+            }
+            return index;
+        }
+    }
+
+    /**
+     * Given a transformation chain to format in WKT, inserts a "Geographic 2D to 3D" pseudo-conversion
+     * before this transform (normally {@code transforms.get(index)}) if this conversion
expects no height.
+     *
+     * @param  transforms The full chain of concatenated transforms.
+     * @param  index      The index of this transform in the {@code transforms} chain.
+     * @return Index of this transform in the {@code transforms} chain after processing.
+     */
+    @Override
+    final int beforeFormat(final List<Object> transforms, int index, final boolean
inverse) {
+        index = super.beforeFormat(transforms, index, inverse);
+        if (!withHeight) {
+            transforms.add(index++, new Geographic3Dto2D.WKT(true));
+        }
+        return index;
     }
 }

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MolodenskyTransform.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MolodenskyTransform.java?rev=1713922&r1=1713921&r2=1713922&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MolodenskyTransform.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MolodenskyTransform.java
[UTF-8] Wed Nov 11 19:51:16 2015
@@ -701,8 +701,8 @@ public class MolodenskyTransform extends
      * NOTE: we do not bother to override the methods expecting a 'float' array because those
methods should
      *       be rarely invoked. Since there is usually LinearTransforms before and after
this transform, the
      *       conversion between float and double will be handle by those LinearTransforms.
  If nevertheless
-     *       this EllipsoidalToCartesianTransform is at the beginning or the end of a transformation
chain,
-     *       the method inherited from the subclass will work (even if slightly slower).
+     *       this MolodenskyTransform is at the beginning or the end of a transformation
chain,  the methods
+     *       inherited from the subclass will work (but may be slightly slower).
      */
 
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/GeocentricTranslationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/GeocentricTranslationTest.java?rev=1713922&r1=1713921&r2=1713922&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/GeocentricTranslationTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/GeocentricTranslationTest.java
[UTF-8] Wed Nov 11 19:51:16 2015
@@ -122,15 +122,11 @@ public final strictfp class GeocentricTr
     }
 
     /**
-     * Tests transformation of the sample point from WGS84 to ED50.
+     * Creates a transformation for the given method.
      *
-     * @param method     The method to test.
-     * @param sourceStep The {@link #samplePoint(int)} to use as the source coordinate.
-     * @param targetStep The {@link #samplePoint(int)} expected as a result of the transformation.
+     * @param method The method to test.
      */
-    private void datumShift(final GeocentricAffine method, final int sourceStep, final int
targetStep)
-            throws FactoryException, TransformException
-    {
+    private void create(final GeocentricAffine method) throws FactoryException {
         final ParameterValueGroup values = method.getParameters().createValue();
         values.parameter("X-axis translation").setValue( 84.87);
         values.parameter("Y-axis translation").setValue( 96.49);
@@ -138,9 +134,7 @@ public final strictfp class GeocentricTr
         if (method instanceof GeocentricAffineBetweenGeographic) {
             setEllipsoids(values, CommonCRS.WGS84.ellipsoid(), CommonCRS.ED50.ellipsoid());
         }
-        tolerance = precision(targetStep);
         transform = method.createMathTransform(DefaultFactories.forBuildin(MathTransformFactory.class),
values);
-        verifyTransform(samplePoint(sourceStep), samplePoint(targetStep));
     }
 
     /**
@@ -154,6 +148,18 @@ public final strictfp class GeocentricTr
     }
 
     /**
+     * Tests transformation of the sample point from WGS84 to ED50.
+     *
+     * @param sourceStep The {@link #samplePoint(int)} to use as the source coordinate.
+     * @param targetStep The {@link #samplePoint(int)} expected as a result of the transformation.
+     */
+    private void datumShift(final int sourceStep, final int targetStep) throws TransformException
{
+        tolerance = precision(targetStep);
+        verifyTransform(samplePoint(sourceStep), samplePoint(targetStep));
+        validate();
+    }
+
+    /**
      * Tests <cite>"Geocentric translations (geocentric domain)"</cite> (EPSG:1031).
      *
      * @throws FactoryException if an error occurred while creating the transform.
@@ -161,10 +167,10 @@ public final strictfp class GeocentricTr
      */
     @Test
     public void testGeocentricDomain() throws FactoryException, TransformException {
-        derivativeDeltas = new double[] {100, 100, 100};    // In metres
-        datumShift(new GeocentricTranslation(), 2, 3);
+        create(new GeocentricTranslation());
         assertTrue(transform instanceof LinearTransform);
-        validate();
+        derivativeDeltas = new double[] {100, 100, 100};    // In metres
+        datumShift(2, 3);
     }
 
     /**
@@ -176,13 +182,13 @@ public final strictfp class GeocentricTr
     @Test
     @DependsOnMethod("testGeocentricDomain")
     public void testGeographicDomain() throws FactoryException, TransformException {
+        create(new GeocentricTranslation3D());
+        assertFalse(transform instanceof LinearTransform);
         final double delta = toRadians(100.0 / 60) / 1852;      // Approximatively 100 metres
         derivativeDeltas = new double[] {delta, delta, 100};    // (Δλ, Δφ, Δh)
         zTolerance = Formulas.LINEAR_TOLERANCE / 2;             // Half the precision of
h value given by EPSG
         zDimension = new int[] {2};                             // Dimension of h where to
apply zTolerance
-        datumShift(new GeocentricTranslation3D(), 1, 4);
-        assertFalse(transform instanceof LinearTransform);
-        validate();
+        datumShift(1, 4);
     }
 
     /**
@@ -201,19 +207,46 @@ public final strictfp class GeocentricTr
     }
 
     /**
+     * Tests Well Known Text formatting of a two-dimensional transform.
+     * The main point of this test is to verify that Geographic 2D/3D conversions have been
+     * inserted before and after the transform, and that Geographic/Geocentric conversions
+     * have been replaced by Bursa-Wolf parameters for formatting purpose.
+     *
+     * @throws FactoryException if an error occurred while creating the transform.
+     */
+    @Test
+    @DependsOnMethod("testWKT3D")
+    public void testWKT2D() throws FactoryException {
+        create(new GeocentricTranslation2D());
+        assertWktEquals("CONCAT_MT[\n" +
+                        "  INVERSE_MT[PARAM_MT[“Geographic3D to 2D conversion”]],\n"
+
+                        "  PARAM_MT[“Ellipsoid_To_Geocentric”,\n" +
+                        "    PARAMETER[“semi_major”, 6378137.0],\n" +
+                        "    PARAMETER[“semi_minor”, 6356752.314245179]],\n" +
+                        "  PARAM_MT[“Geocentric translations (geocentric domain)”,\n"
+
+                        "    PARAMETER[“dx”, 84.87],\n" +
+                        "    PARAMETER[“dy”, 96.49],\n" +
+                        "    PARAMETER[“dz”, 116.95]],\n" +
+                        "  PARAM_MT[“Geocentric_To_Ellipsoid”,\n" +
+                        "    PARAMETER[“semi_major”, 6378388.0],\n" +
+                        "    PARAMETER[“semi_minor”, 6356911.9461279465]],\n" +
+                        "  PARAM_MT[“Geographic3D to 2D conversion”]]");
+    }
+
+    /**
      * Tests Well Known Text formatting.
      * The main point of this test is to verify that the affine transform between the two
      * Geographic/Geocentric conversions have been replaced by Bursa-Wolf parameters for
      * formatting purpose.
      *
      * @throws FactoryException if an error occurred while creating the transform.
-     * @throws TransformException if transformation of a sample point failed.
      */
     @Test
     @DependsOnMethod("testGeographicDomain")
-    public void testWKT() throws FactoryException, TransformException {
-        testGeographicDomain();     // For creating the transform.
-        assertWktEquals("CONCAT_MT[PARAM_MT[“Ellipsoid_To_Geocentric”,\n" +
+    public void testWKT3D() throws FactoryException {
+        create(new GeocentricTranslation3D());
+        assertWktEquals("CONCAT_MT[\n" +
+                        "  PARAM_MT[“Ellipsoid_To_Geocentric”,\n" +
                         "    PARAMETER[“semi_major”, 6378137.0],\n" +
                         "    PARAMETER[“semi_minor”, 6356752.314245179]],\n" +
                         "  PARAM_MT[“Geocentric translations (geocentric domain)”,\n"
+
@@ -228,7 +261,8 @@ public final strictfp class GeocentricTr
          * affines before, after and between the two Geographic/Geocentric conversions.
          */
         assertInternalWktEquals(
-                "Concat_MT[Param_MT[“Affine”,\n" +
+                "Concat_MT[\n" +
+                "  Param_MT[“Affine”,\n" +
                 "    Parameter[“num_row”, 4],\n" +
                 "    Parameter[“num_col”, 4],\n" +
                 "    Parameter[“elt_0_0”, 0.017453292519943295],\n" +

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/EllipsoidalToCartesianTransformTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/EllipsoidalToCartesianTransformTest.java?rev=1713922&r1=1713921&r2=1713922&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/EllipsoidalToCartesianTransformTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/EllipsoidalToCartesianTransformTest.java
[UTF-8] Wed Nov 11 19:51:16 2015
@@ -226,14 +226,14 @@ public final strictfp class EllipsoidalT
     }
 
     /**
-     * Tests the standard Well Known Text (version 1) formatting.
+     * Tests the standard Well Known Text (version 1) formatting for three-dimensional transforms.
      * The result is what we show to users, but is quite different than what SIS has in memory.
      *
      * @throws FactoryException if an error occurred while creating a transform.
      * @throws TransformException should never happen.
      */
     @Test
-    public void testWKT() throws FactoryException, TransformException {
+    public void testWKT3D() throws FactoryException, TransformException {
         createGeodeticConversion(CommonCRS.WGS84.ellipsoid(), true);
         assertWktEquals("PARAM_MT[“Ellipsoid_To_Geocentric”,\n" +
                         "  PARAMETER[“semi_major”, 6378137.0],\n" +
@@ -246,6 +246,30 @@ public final strictfp class EllipsoidalT
     }
 
     /**
+     * Tests the standard Well Known Text (version 1) formatting for two-dimensional transforms.
+     * The result is what we show to users, but is quite different than what SIS has in memory.
+     *
+     * @throws FactoryException if an error occurred while creating a transform.
+     * @throws TransformException should never happen.
+     */
+    @Test
+    public void testWKT2D() throws FactoryException, TransformException {
+        createGeodeticConversion(CommonCRS.WGS84.ellipsoid(), false);
+        assertWktEquals("CONCAT_MT[\n" +
+                        "  INVERSE_MT[PARAM_MT[“Geographic3D to 2D conversion”]],\n"
+
+                        "  PARAM_MT[“Ellipsoid_To_Geocentric”,\n" +
+                        "    PARAMETER[“semi_major”, 6378137.0],\n" +
+                        "    PARAMETER[“semi_minor”, 6356752.314245179]]]");
+
+        transform = transform.inverse();
+        assertWktEquals("CONCAT_MT[\n" +
+                        "  PARAM_MT[“Geocentric_To_Ellipsoid”,\n" +
+                        "    PARAMETER[“semi_major”, 6378137.0],\n" +
+                        "    PARAMETER[“semi_minor”, 6356752.314245179]],\n" +
+                        "  PARAM_MT[“Geographic3D to 2D conversion”]]");
+    }
+
+    /**
      * Tests the internal Well Known Text formatting.
      * This WKT shows what SIS has in memory for debugging purpose.
      * This is normally not what we show to users.
@@ -257,7 +281,8 @@ public final strictfp class EllipsoidalT
     public void testInternalWKT() throws FactoryException, TransformException {
         createGeodeticConversion(CommonCRS.WGS84.ellipsoid(), true);
         assertInternalWktEquals(
-                "Concat_MT[Param_MT[“Affine”,\n" +
+                "Concat_MT[\n" +
+                "  Param_MT[“Affine”,\n" +
                 "    Parameter[“num_row”, 4],\n" +
                 "    Parameter[“num_col”, 4],\n" +
                 "    Parameter[“elt_0_0”, 0.017453292519943295],\n" +
@@ -275,7 +300,8 @@ public final strictfp class EllipsoidalT
 
         transform = transform.inverse();
         assertInternalWktEquals(
-                "Concat_MT[Param_MT[“Affine”,\n" +
+                "Concat_MT[\n" +
+                "  Param_MT[“Affine”,\n" +
                 "    Parameter[“num_row”, 4],\n" +
                 "    Parameter[“num_col”, 4],\n" +
                 "    Parameter[“elt_0_0”, 1.567855942887398E-7],\n" +

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java?rev=1713922&r1=1713921&r2=1713922&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java
[UTF-8] Wed Nov 11 19:51:16 2015
@@ -295,7 +295,8 @@ public final strictfp class MolodenskyTr
     public void testInternalWKT() throws FactoryException, TransformException {
         create(true);
         assertInternalWktEquals(
-                "Concat_MT[Param_MT[“Affine”,\n" +
+                "Concat_MT[\n" +
+                "  Param_MT[“Affine”,\n" +
                 "    Parameter[“num_row”, 4],\n" +
                 "    Parameter[“num_col”, 4],\n" +
                 "    Parameter[“elt_0_0”, 0.017453292519943295],\n" +       // Degrees
to radians conversion



Mime
View raw message