sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1715748 - in /sis/branches/JDK8/core/sis-referencing/src: main/java/org/apache/sis/internal/referencing/provider/ main/java/org/apache/sis/referencing/datum/ main/java/org/apache/sis/referencing/operation/transform/ test/java/org/apache/si...
Date Mon, 23 Nov 2015 09:46:40 GMT
Author: desruisseaux
Date: Mon Nov 23 09:46:40 2015
New Revision: 1715748

URL: http://svn.apache.org/viewvc?rev=1715748&view=rev
Log:
Renamed the GR3DF97A.txt test file as GR3DF-extract.txt for making clear that it contains
only a small subset of the data (less than 0.14%).
Minor rewriting of bilinear interpolation code in DatumShiftGrid for reducing the amount of
multiplications.

Added:
    sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/internal/referencing/provider/GR3DF-extract.txt
      - copied unchanged from r1715747, sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/internal/referencing/provider/GR3DF97A.txt
Removed:
    sis/branches/JDK8/core/sis-referencing/src/test/resources/org/apache/sis/internal/referencing/provider/GR3DF97A.txt
Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridCompressed.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DatumShiftGrid.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MolodenskyFormula.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/FranceGeocentricInterpolationTest.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/InterpolatedGeocentricTransformTest.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridCompressed.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridCompressed.java?rev=1715748&r1=1715747&r2=1715748&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridCompressed.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridCompressed.java
[UTF-8] Mon Nov 23 09:46:40 2015
@@ -163,8 +163,11 @@ final class DatumShiftGridCompressed ext
         final int p1 = nx + p0;
         for (int dim = 0; dim < data.length; dim++) {
             final short[] values = data[dim];
-            offsets[dim] = ((1-y) * ((1-x)*values[p0] + x*values[p0+1])
-                             + y  * ((1-x)*values[p1] + x*values[p1+1])) * scale + averages[dim];
+            double r0 = values[p0];
+            double r1 = values[p1];
+            r0 +=  x * (values[p0+1] - r0);
+            r1 +=  x * (values[p1+1] - r1);
+            offsets[dim] = (y * (r1 - r0) + r0) * scale + averages[dim];
         }
     }
 

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DatumShiftGrid.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DatumShiftGrid.java?rev=1715748&r1=1715747&r2=1715748&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DatumShiftGrid.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DatumShiftGrid.java
[UTF-8] Mon Nov 23 09:46:40 2015
@@ -235,8 +235,11 @@ public abstract class DatumShiftGrid imp
         y -= gridY;
         final int n = getShiftDimensions();
         for (int dim = 0; dim < n; dim++) {
-            offsets[dim] = (1-y) * ((1-x)*getCellValue(dim, gridX, gridY  ) + x*getCellValue(dim,
gridX+1, gridY  ))
-                            + y  * ((1-x)*getCellValue(dim, gridX, gridY+1) + x*getCellValue(dim,
gridX+1, gridY+1));
+            double r0 = getCellValue(dim, gridX,   gridY  );
+            double r1 = getCellValue(dim, gridX,   gridY+1);
+            r0 +=  x * (getCellValue(dim, gridX+1, gridY  ) - r0);
+            r1 +=  x * (getCellValue(dim, gridX+1, gridY+1) - r1);
+            offsets[dim] = y * (r1 - r0) + r0;
         }
     }
 

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MolodenskyFormula.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MolodenskyFormula.java?rev=1715748&r1=1715747&r2=1715748&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MolodenskyFormula.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/MolodenskyFormula.java
[UTF-8] Mon Nov 23 09:46:40 2015
@@ -334,7 +334,7 @@ abstract class MolodenskyFormula extends
     /**
      * Implementation of {@link #transform(double[], int, double[], int, boolean)} with possibility
      * to override some field values. In this method signature, parameters having the same
name than
-     * fields have the same value, except if some special circumstances:
+     * fields have the same value, except in some special circumstances:
      *
      * <ul>
      *   <li>{@code tX}, {@code tY} and {@code tZ} parameters always have the values
of {@link #tX}, {@link #tY}

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/FranceGeocentricInterpolationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/FranceGeocentricInterpolationTest.java?rev=1715748&r1=1715747&r2=1715748&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/FranceGeocentricInterpolationTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/FranceGeocentricInterpolationTest.java
[UTF-8] Mon Nov 23 09:46:40 2015
@@ -48,6 +48,12 @@ import java.nio.file.Path;
  */
 public final strictfp class FranceGeocentricInterpolationTest extends TestCase {
     /**
+     * Name of the file containing a small extract of the "{@code GR3DF97A.txt}" file.
+     * The amount of data in this test file is less than 0.14% of the original file.
+     */
+    public static final String TEST_FILE = "GR3DF-extract.txt";
+
+    /**
      * Returns the sample point for a step in the example given by the NTG_88 guidance note.
      * The steps numbers go from 1 (NTF) to 3 (RGF93).
      * Precision is given by {@link #ANGULAR_TOLERANCE}.
@@ -92,6 +98,7 @@ public final strictfp class FranceGeocen
         assertTrue (FranceGeocentricInterpolation.isRecognized(Paths.get("GR3DF97A.txt")));
         assertTrue (FranceGeocentricInterpolation.isRecognized(Paths.get("gr3df")));
         assertFalse(FranceGeocentricInterpolation.isRecognized(Paths.get("gr3d")));
+        assertTrue (FranceGeocentricInterpolation.isRecognized(Paths.get(TEST_FILE)));
     }
 
     /**
@@ -127,8 +134,8 @@ public final strictfp class FranceGeocen
      */
     @TestStep
     private static DatumShiftGridFile testGridAsFloats() throws URISyntaxException, IOException,
FactoryException {
-        final URL url = FranceGeocentricInterpolationTest.class.getResource("GR3DF97A.txt");
-        assertNotNull("Test file \"GR3DF97A.txt\" not found.", url);
+        final URL url = FranceGeocentricInterpolationTest.class.getResource(TEST_FILE);
+        assertNotNull("Test file \"" + TEST_FILE + "\" not found.", url);
         final Path file = Paths.get(url.toURI());
         final DatumShiftGridFile.Float grid;
         try (final BufferedReader in = Files.newBufferedReader(file)) {
@@ -205,8 +212,8 @@ public final strictfp class FranceGeocen
     @Test
     @DependsOnMethod("testGrid")
     public void testGetOrLoad() throws URISyntaxException, FactoryException {
-        final URL file = FranceGeocentricInterpolationTest.class.getResource("GR3DF97A.txt");
-        assertNotNull("Test file \"GR3DF97A.txt\" not found.", file);
+        final URL file = FranceGeocentricInterpolationTest.class.getResource(TEST_FILE);
+        assertNotNull("Test file \"" + TEST_FILE + "\" not found.", file);
         final DatumShiftGridFile grid = FranceGeocentricInterpolation.getOrLoad(
                 Paths.get(file.toURI()), new double[] {
                         FranceGeocentricInterpolation.TX,

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/InterpolatedGeocentricTransformTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/InterpolatedGeocentricTransformTest.java?rev=1715748&r1=1715747&r2=1715748&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/InterpolatedGeocentricTransformTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/InterpolatedGeocentricTransformTest.java
[UTF-8] Mon Nov 23 09:46:40 2015
@@ -64,8 +64,8 @@ public final strictfp class Interpolated
      * @throws FactoryException if an error occurred while loading the grid.
      */
     private void create() throws FactoryException {
-        final URL file = FranceGeocentricInterpolationTest.class.getResource("GR3DF97A.txt");
-        assertNotNull("Test file \"GR3DF97A.txt\" not found.", file);
+        final URL file = FranceGeocentricInterpolationTest.class.getResource(FranceGeocentricInterpolationTest.TEST_FILE);
+        assertNotNull("Test file \"" + FranceGeocentricInterpolationTest.TEST_FILE + "\"
not found.", file);
         final Ellipsoid source = HardCodedDatum.NTF.getEllipsoid();     // Clarke 1880 (IGN)
         final Ellipsoid target = CommonCRS.ETRS89.ellipsoid();          // GRS 1980 ellipsoid
         final FranceGeocentricInterpolation provider = new FranceGeocentricInterpolation();
@@ -136,7 +136,8 @@ public final strictfp class Interpolated
                 "  PARAMETER[“src_semi_minor”, 6356752.314140356],\n" +
                 "  PARAMETER[“tgt_semi_major”, 6378249.2],\n" +
                 "  PARAMETER[“tgt_semi_minor”, 6356515.0],\n" +
-                "  PARAMETER[“Geocentric translations file”, “\\E.*\\W\\QGR3DF97A.txt”]]\\E");
+                "  PARAMETER[“Geocentric translations file”, “\\E.*\\W\\Q" +
+                             FranceGeocentricInterpolationTest.TEST_FILE + "”]]\\E");
 
         transform = transform.inverse();
         assertWktEqualsRegex("(?m)\\Q" +
@@ -146,7 +147,8 @@ public final strictfp class Interpolated
                 "  PARAMETER[“src_semi_minor”, 6356515.0],\n" +
                 "  PARAMETER[“tgt_semi_major”, 6378137.0],\n" +
                 "  PARAMETER[“tgt_semi_minor”, 6356752.314140356],\n" +
-                "  PARAMETER[“Geocentric translations file”, “\\E.*\\W\\QGR3DF97A.txt”]]\\E");
+                "  PARAMETER[“Geocentric translations file”, “\\E.*\\W\\Q" +
+                             FranceGeocentricInterpolationTest.TEST_FILE + "”]]\\E");
     }
 
     /**
@@ -170,7 +172,8 @@ public final strictfp class Interpolated
                 "    Parameter[“src_semi_minor”, 6356515.0],\n" +
                 "    Parameter[“Semi-major axis length difference”, -112.2],\n" +
                 "    Parameter[“Flattening difference”, -5.455231352930652E-5],\n" +
-                "    ParameterFile[“Geocentric translations file”, “\\E.*\\W\\QGR3DF97A.txt”,
Id[“EPSG”, 8727]],\n" +
+                "    ParameterFile[“Geocentric translations file”, “\\E.*\\W\\Q" +
+                                   FranceGeocentricInterpolationTest.TEST_FILE + "”, Id[“EPSG”,
8727]],\n" +
                 "    Parameter[“dim”, 2]],\n" +
                 "  Param_MT[“Affine parametric transformation”,\n" +
                 "    Parameter[“A0”, 57.29577951308232, Id[“EPSG”, 8623]],\n" + 
    // Radians to degrees conversion



Mime
View raw message