sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 01/01: Merge bug fixes from branch 'geoapi-3.1'.
Date Mon, 27 May 2019 19:06:24 GMT
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 6d188cfb20bfb86b6f8afb389d838ed1a0246802
Merge: 9351e54 ead7586
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Mon May 27 21:05:42 2019 +0200

    Merge bug fixes from branch 'geoapi-3.1'.

 .../org/apache/sis/console/MetadataCommand.java    |   5 +-
 .../sis/metadata/iso/citation/Citations.java       |   4 +-
 .../apache/sis/metadata/sql/MetadataFallback.java  |   8 +-
 .../org/apache/sis/metadata/sql/Citations.sql      |  28 +--
 .../sis/metadata/iso/DefaultMetadataTest.java      |   2 +-
 .../sis/internal/referencing/j2d/Bezier.java       | 189 ++++++++++++-------
 .../sis/parameter/DefaultParameterValue.java       | 210 +++++++++++++--------
 .../java/org/apache/sis/parameter/Verifier.java    |  88 +++++----
 .../apache/sis/referencing/GeodeticCalculator.java |  58 ++----
 .../operation/projection/TransverseMercator.java   |  43 ++++-
 .../sis/referencing/GeodeticCalculatorTest.java    |  15 +-
 .../apache/sis/referencing/crs/HardCodedCRS.java   |  25 ++-
 .../projection/MapProjectionTestCase.java          |   1 +
 .../projection/TransverseMercatorTest.java         |  65 ++++++-
 .../org/apache/sis/test/widget/ShapeViewer.java    |   2 +-
 .../src/main/java/org/apache/sis/util/Classes.java |  43 ++---
 .../src/main/java/org/apache/sis/util/Numbers.java |  18 +-
 .../java/org/apache/sis/test/OptionalTestData.java |  27 +++
 .../storage/earthobservation/LandsatReader.java    |   3 +-
 .../apache/sis/storage/geotiff/GeoTiffStore.java   |   1 +
 .../org/apache/sis/internal/netcdf/Convention.java |  25 ++-
 .../apache/sis/internal/netcdf/GridMapping.java    |  39 +++-
 .../apache/sis/storage/netcdf/MetadataReader.java  |   4 +-
 .../sis/internal/storage/MetadataBuilder.java      |  38 +++-
 .../org/apache/sis/internal/storage/csv/Store.java |   1 +
 .../apache/sis/internal/storage/gpx/Metadata.java  |   2 +-
 26 files changed, 626 insertions(+), 318 deletions(-)

diff --cc core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/TransverseMercatorTest.java
index 4d4567f,bc79bb3..ddc4d1d
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/TransverseMercatorTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/TransverseMercatorTest.java
@@@ -28,8 -33,11 +33,10 @@@ import org.apache.sis.test.DependsOn
  import org.junit.Test;
  
  import static java.lang.Double.NaN;
+ import static java.lang.StrictMath.min;
  import static java.lang.StrictMath.toRadians;
  import static org.apache.sis.test.Assert.*;
+ import static org.apache.sis.internal.referencing.provider.TransverseMercator.LATITUDE_OF_ORIGIN;
 -import org.opengis.test.CalculationType;
  
  
  /**
@@@ -167,4 -179,54 +174,54 @@@ public final strictfp class TransverseM
          tolerance = Formulas.LINEAR_TOLERANCE;
          verifyTransform(source, target);
      }
+ 
+     /**
+      * Compares with <cite>Karney (2009) Test data for the transverse Mercator projection</cite>.
+      * This is an optional test executed only if the {@code $SIS_DATA/Tests/TMcoords.dat}
file is found.
+      *
+      * @throws IOException if an error occurred while reading the test file.
+      * @throws FactoryException if an error occurred while creating the map projection.
+      * @throws TransformException if an error occurred while transforming coordinates.
+      */
+     @Test
+     public void compareAgainstDataset() throws IOException, FactoryException, TransformException
{
+         try (LineNumberReader reader = OptionalTestData.TRANSVERSE_MERCATOR.reader()) {
+             createCompleteProjection(new org.apache.sis.internal.referencing.provider.TransverseMercator(),
+                     WGS84_A,    // Semi-major axis length
+                     WGS84_B,    // Semi-minor axis length
+                     0,          // Central meridian
+                     0,          // Latitude of origin
+                     NaN,        // Standard parallel 1 (none)
+                     NaN,        // Standard parallel 2 (none)
+                     0.9996,     // Scale factor
+                     0,          // False easting
+                     0);         // False northing
+             final double[] source = new double[2];
+             final double[] target = new double[2];
+             String line;
+             while ((line = reader.readLine()) != null) {
+                 Arrays.fill(source, Double.NaN);
+                 final CharSequence[] split = CharSequences.split(line, ' ');
+                 for (int i=min(split.length, 4); --i >= 0;) {
+                     final double value = Double.parseDouble(split[i].toString());
+                     if (i <= 1) source[i ^ 1] = value;                              //
Swap axis order.
+                     else        target[i - 2] = value;
+                 }
+                 // Relax tolerance for longitudes very far from central meridian.
+                 final double longitude = StrictMath.abs(source[0]);
+                 if (longitude < TransverseMercator.DOMAIN_OF_VALIDITY) {
+                     if (StrictMath.abs(source[1]) >= 89.9) tolerance = 0.1;
+                     else if (longitude <= 60) tolerance = Formulas.LINEAR_TOLERANCE;
+                     else if (longitude <= 66) tolerance = 0.1;
+                     else if (longitude <= 70) tolerance = 1;
+                     else if (longitude <= 72) tolerance = 2;
+                     else if (longitude <= 74) tolerance = 10;
+                     else if (longitude <= 76) tolerance = 30;
+                     else                      tolerance = 1000;
+                     transform.transform(source, 0, source, 0, 1);
 -                    assertCoordinateEquals(line, target, source, reader.getLineNumber(),
CalculationType.DIRECT_TRANSFORM);
++                    assertCoordinateEquals(line, target, source, reader.getLineNumber(),
false);
+                 }
+             }
+         }
+     }
  }


Mime
View raw message