sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 01/01: Fix wrong CRS reported reported by getPositionCRS() and getGeographicCRS().
Date Thu, 16 May 2019 13:50:29 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit a1d9fa916454a6b9d1527a264e90f2407c6b7d8c
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Thu May 16 15:10:03 2019 +0200

    Fix wrong CRS reported reported by getPositionCRS() and getGeographicCRS().
---
 .../src/main/java/org/apache/sis/referencing/GeodeticCalculator.java  | 4 ++--
 .../test/java/org/apache/sis/referencing/GeodeticCalculatorTest.java  | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticCalculator.java
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticCalculator.java
index 443a01c..d474b26 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticCalculator.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticCalculator.java
@@ -215,7 +215,7 @@ public class GeodeticCalculator {
      * @return the default CRS for {@link Position} instances.
      */
     public CoordinateReferenceSystem getPositionCRS() {
-        return userToGeodetic.getCoordinateReferenceSystem();
+        return userToGeodetic.defaultCRS;
     }
 
     /**
@@ -226,7 +226,7 @@ public class GeodeticCalculator {
      * @return the coordinate reference system of (φ,λ) coordinates.
      */
     public GeographicCRS getGeographicCRS() {
-        return (GeographicCRS) userToGeodetic.defaultCRS;
+        return (GeographicCRS) userToGeodetic.getCoordinateReferenceSystem();
     }
 
     /**
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticCalculatorTest.java
b/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticCalculatorTest.java
index 521cc9a..80c5610 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticCalculatorTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticCalculatorTest.java
@@ -21,6 +21,7 @@ import java.awt.geom.Point2D;
 import java.awt.geom.PathIterator;
 import java.util.Random;
 import org.opengis.geometry.DirectPosition;
+import org.opengis.referencing.cs.AxisDirection;
 import org.opengis.referencing.operation.TransformException;
 import org.apache.sis.internal.referencing.j2d.ShapeUtilities;
 import org.apache.sis.internal.referencing.Formulas;
@@ -192,6 +193,8 @@ public final strictfp class GeodeticCalculatorTest extends TestCase {
     @DependsOnMethod("testGeodesicDistanceAndAzimuths")
     public void testUsingTransform() throws TransformException {
         final GeodeticCalculator c = create(true);
+        assertAxisDirectionsEqual("GeographicCRS", c.getGeographicCRS().getCoordinateSystem(),
AxisDirection.NORTH, AxisDirection.EAST);
+        assertAxisDirectionsEqual("PositionCRS",     c.getPositionCRS().getCoordinateSystem(),
AxisDirection.EAST, AxisDirection.NORTH);
         final double φ = -33.0;
         final double λ = -71.6;
         c.setStartPoint(new DirectPosition2D(λ, φ));


Mime
View raw message