sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1713015 - in /sis/branches/JDK8/core/sis-referencing/src: main/java/org/apache/sis/internal/referencing/provider/Molodensky.java test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java
Date Fri, 06 Nov 2015 18:53:18 GMT
Author: desruisseaux
Date: Fri Nov  6 18:53:18 2015
New Revision: 1713015

URL: http://svn.apache.org/viewvc?rev=1713015&view=rev
Log:
Added more tests.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Molodensky.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/MolodenskyTransformTest.java

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=1713015&r1=1713014&r2=1713015&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] Fri Nov  6 18:53:18 2015
@@ -36,10 +36,8 @@ import org.apache.sis.referencing.datum.
 import org.apache.sis.referencing.operation.transform.MolodenskyTransform;
 import org.apache.sis.internal.referencing.NilReferencingObject;
 import org.apache.sis.internal.referencing.Formulas;
-import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.util.ArgumentChecks;
-import org.apache.sis.util.logging.Logging;
 import org.apache.sis.util.Debug;
 
 
@@ -272,8 +270,8 @@ public final class Molodensky extends Ge
             if (value != null) {
                 return value;
             }
-        } catch (ParameterNotFoundException e) {
-            Logging.recoverableException(Logging.getLogger(Loggers.COORDINATE_OPERATION),
Molodensky.class, "createMathTransform", e);
+        } catch (ParameterNotFoundException | IllegalStateException e) {
+            // Ignore - this is okay for this method contract.
         }
         return Double.NaN;
     }

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=1713015&r1=1713014&r2=1713015&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] Fri Nov  6 18:53:18 2015
@@ -20,6 +20,9 @@ import org.opengis.util.FactoryException
 import org.opengis.referencing.datum.Ellipsoid;
 import org.opengis.referencing.operation.MathTransformFactory;
 import org.opengis.referencing.operation.TransformException;
+import org.opengis.parameter.ParameterValueGroup;
+import org.apache.sis.internal.referencing.provider.AbridgedMolodensky;
+import org.apache.sis.internal.referencing.provider.Molodensky;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.internal.referencing.Formulas;
 import org.apache.sis.referencing.CommonCRS;
@@ -29,11 +32,13 @@ import static java.lang.StrictMath.toRad
 
 // Test dependencies
 import org.apache.sis.internal.referencing.provider.GeocentricTranslationTest;
+import org.apache.sis.test.mock.MathTransformFactoryMock;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestUtilities;
 import org.opengis.test.ToleranceModifier;
 import org.opengis.test.ToleranceModifiers;
+import org.opengis.test.referencing.ParameterizedTransformTest;
 import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
@@ -169,7 +174,7 @@ public final strictfp class MolodenskyTr
      * high for this test.
      *
      * @throws FactoryException if an error occurred while creating a transform step.
-     * @throws TransformException if a conversion failed.
+     * @throws TransformException if a transformation failed.
      */
     @Test
     @DependsOnMethod("testMolodensky")
@@ -185,6 +190,49 @@ public final strictfp class MolodenskyTr
     }
 
     /**
+     * Tests the creation through the provider.
+     *
+     * @throws FactoryException if an error occurred while creating a transform step.
+     * @throws TransformException if a transformation failed.
+     */
+    @Test
+    @DependsOnMethod("testRandomPoints")
+    public void testProvider() throws FactoryException, TransformException {
+        final MathTransformFactory factory = new MathTransformFactoryMock(new Molodensky());
+        final ParameterValueGroup parameters = factory.getDefaultParameters("Molodenski");
+        parameters.parameter("dim").setValue(3);
+        parameters.parameter("dx").setValue(-3.0);
+        parameters.parameter("dy").setValue(142.0);
+        parameters.parameter("dz").setValue(183.0);
+        parameters.parameter("src_semi_major").setValue(6378206.4);
+        parameters.parameter("src_semi_minor").setValue(6356583.8);
+        parameters.parameter("tgt_semi_major").setValue(6378137.0);
+        parameters.parameter("tgt_semi_minor").setValue(6356752.31414036);
+        transform = factory.createParameterizedTransform(parameters);
+        assertEquals(3, transform.getSourceDimensions());
+        assertEquals(3, transform.getTargetDimensions());
+        final double delta = toRadians(100.0 / 60) / 1852;          // Approximatively 100
metres
+        derivativeDeltas = new double[] {delta, delta, 100};        // (Δλ, Δφ, Δh)
+        tolerance = Formulas.ANGULAR_TOLERANCE * 5;
+        zTolerance = Formulas.LINEAR_TOLERANCE * 5;
+        zDimension = new int[] {2};
+        verifyInDomain(CoordinateDomain.RANGE_10, ORDINATE_COUNT);
+    }
+
+    /**
+     * Runs the test defined in the GeoAPI-conformance module.
+     *
+     * @throws FactoryException if an error occurred while creating a transform step.
+     * @throws TransformException if a transformation failed.
+     */
+//  @Test
+    @DependsOnMethod("testProvider")
+    @org.junit.Ignore("Need to investigate a 1cm error in height value.")
+    public void runGeoapiTest() throws FactoryException, TransformException {
+        new ParameterizedTransformTest(new MathTransformFactoryMock(new AbridgedMolodensky())).testAbridgedMolodensky();
+    }
+
+    /**
      * Tests the standard Well Known Text (version 1) formatting.
      * The result is what we show to users, but may quite different than what SIS has in
memory.
      *



Mime
View raw message