sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] branch geoapi-4.0 updated: Rename GeodeticCalculator.setStart/EndPoint(double, double) as setStart/EndGeographicPoint(double, double).
Date Fri, 24 May 2019 09:53:45 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


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new 17cdbf7  Rename GeodeticCalculator.setStart/EndPoint(double, double) as setStart/EndGeographicPoint(double,
double).
17cdbf7 is described below

commit 17cdbf74967eb92bb558728f306a4ae57df4c851
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Fri May 24 11:41:23 2019 +0200

    Rename GeodeticCalculator.setStart/EndPoint(double, double) as setStart/EndGeographicPoint(double,
double).
---
 .../org/apache/sis/services/LocationServlet.java   |  2 +-
 .../org/apache/sis/distance/LatLonPointRadius.java |  4 +-
 .../apache/sis/referencing/GeodeticCalculator.java | 24 ++++-----
 .../sis/referencing/GeodeticCalculatorTest.java    | 60 +++++++++++-----------
 .../java/org/apache/sis/index/tree/QuadTree.java   |  4 +-
 5 files changed, 47 insertions(+), 47 deletions(-)

diff --git a/application/sis-webapp/src/main/java/org/apache/sis/services/LocationServlet.java
b/application/sis-webapp/src/main/java/org/apache/sis/services/LocationServlet.java
index 419fe4d..e06d73a 100644
--- a/application/sis-webapp/src/main/java/org/apache/sis/services/LocationServlet.java
+++ b/application/sis-webapp/src/main/java/org/apache/sis/services/LocationServlet.java
@@ -307,7 +307,7 @@ public class LocationServlet extends HttpServlet {
 
         double radiusKM = Double.parseDouble(radius);
         final GeodeticCalculator calculator = GeodeticCalculator.create(CommonCRS.SPHERE.geographic());
-        calculator.setStartPoint(point.y, point.x);
+        calculator.setStartGeographicPoint(point.y, point.x);
         calculator.setGeodesicDistance(radiusKM);
 
         StringBuilder regionStr = new StringBuilder();
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/distance/LatLonPointRadius.java
b/core/sis-referencing/src/main/java/org/apache/sis/distance/LatLonPointRadius.java
index 267346f..a485f43 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/distance/LatLonPointRadius.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/distance/LatLonPointRadius.java
@@ -83,7 +83,7 @@ public class LatLonPointRadius {
     if (numberOfPoints > 0) { bearingIncrement = 360/numberOfPoints; }
 
     final GeodeticCalculator calculator = GeodeticCalculator.create(CommonCRS.SPHERE.geographic());
-    calculator.setStartPoint(center.getOrdinate(1), center.getOrdinate(0));
+    calculator.setStartGeographicPoint(center.getOrdinate(1), center.getOrdinate(0));
     calculator.setGeodesicDistance(radius);
 
     try {
@@ -116,7 +116,7 @@ public class LatLonPointRadius {
     int numberOfCrossOvers = 0;
 
     final GeodeticCalculator calculator = GeodeticCalculator.create(CommonCRS.SPHERE.geographic());
-    calculator.setStartPoint(center.getOrdinate(1), center.getOrdinate(0));
+    calculator.setStartGeographicPoint(center.getOrdinate(1), center.getOrdinate(0));
 
     Path2D path = new Path2D.Double();
     double initX = Double.NaN, previousX = Double.NaN;
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 1bb659d..8bbcbae 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
@@ -112,7 +112,7 @@ public class GeodeticCalculator {
 
     /**
      * The (<var>latitude</var>, <var>longitude</var>) coordinates
of the start point <strong>in radians</strong>.
-     * This point is set by {@link #setStartPoint(double, double)}.
+     * This point is set by {@link #setStartGeographicPoint(double, double)}.
      *
      * @see #START_POINT
      */
@@ -120,7 +120,7 @@ public class GeodeticCalculator {
 
     /**
      * The (<var>latitude</var>, <var>longitude</var>) coordinates
of the end point <strong>in radians</strong>.
-     * This point is set by {@link #setEndPoint(double, double)}.
+     * This point is set by {@link #setEndGeographicPoint(double, double)}.
      *
      * @see #END_POINT
      */
@@ -284,7 +284,7 @@ public class GeodeticCalculator {
 
     /**
      * Sets the starting point as coordinates in arbitrary reference system. This method
transforms the given
-     * coordinates to geographic coordinates, then delegates to {@link #setStartPoint(double,
double)}.
+     * coordinates to geographic coordinates, then delegates to {@link #setStartGeographicPoint(double,
double)}.
      * If the given point is not associated to a Coordinate Reference System (CRS), then
this method assumes
      * the CRS specified at construction time.
      *
@@ -295,7 +295,7 @@ public class GeodeticCalculator {
      */
     public void setStartPoint(final Position point) throws TransformException {
         final DirectPosition p = userToGeodetic.transform(point.getDirectPosition());
-        setStartPoint(p.getOrdinate(0), p.getOrdinate(1));
+        setStartGeographicPoint(p.getOrdinate(0), p.getOrdinate(1));
     }
 
     /**
@@ -308,10 +308,10 @@ public class GeodeticCalculator {
      * @param  latitude   the latitude in degrees between {@value Latitude#MIN_VALUE}° and
{@value Latitude#MAX_VALUE}°.
      * @param  longitude  the longitude in degrees.
      *
-     * @see #setEndPoint(double, double)
+     * @see #setEndGeographicPoint(double, double)
      * @see #moveToEndPoint()
      */
-    public void setStartPoint(final double latitude, final double longitude) {
+    public void setStartGeographicPoint(final double latitude, final double longitude) {
         ArgumentChecks.ensureFinite("latitude",  latitude);
         ArgumentChecks.ensureFinite("longitude", longitude);
         φ1 = toRadians(max(Latitude.MIN_VALUE, min(Latitude.MAX_VALUE, latitude)));
@@ -342,7 +342,7 @@ public class GeodeticCalculator {
 
     /**
      * Sets the destination as coordinates in arbitrary reference system. This method transforms
the given
-     * coordinates to geographic coordinates, then delegates to {@link #setEndPoint(double,
double)}.
+     * coordinates to geographic coordinates, then delegates to {@link #setEndGeographicPoint(double,
double)}.
      * If the given point is not associated to a Coordinate Reference System (CRS), then
this method assumes
      * the CRS specified at construction time.
      *
@@ -353,7 +353,7 @@ public class GeodeticCalculator {
      */
     public void setEndPoint(final Position position) throws TransformException {
         final DirectPosition p = userToGeodetic.transform(position.getDirectPosition());
-        setEndPoint(p.getOrdinate(0), p.getOrdinate(1));
+        setEndGeographicPoint(p.getOrdinate(0), p.getOrdinate(1));
     }
 
     /**
@@ -365,9 +365,9 @@ public class GeodeticCalculator {
      * @param  latitude   the latitude in degrees between {@value Latitude#MIN_VALUE}° and
{@value Latitude#MAX_VALUE}°.
      * @param  longitude  the longitude in degrees.
      *
-     * @see #setStartPoint(double, double)
+     * @see #setStartGeographicPoint(double, double)
      */
-    public void setEndPoint(final double latitude, final double longitude) {
+    public void setEndGeographicPoint(final double latitude, final double longitude) {
         ArgumentChecks.ensureFinite("latitude",  latitude);
         ArgumentChecks.ensureFinite("longitude", longitude);
         φ2 = toRadians(max(Latitude.MIN_VALUE, min(Latitude.MAX_VALUE, latitude)));
@@ -614,7 +614,7 @@ public class GeodeticCalculator {
      * geodesic distance} and the {@linkplain #getEndPoint() end point} are discarded by
this method call;
      * some of them will need to be specified again.
      *
-     * @see #setStartPoint(double, double)
+     * @see #setStartGeographicPoint(double, double)
      */
     public void moveToEndPoint() {
         if (isInvalid(END_POINT)) {
@@ -812,7 +812,7 @@ public class GeodeticCalculator {
                 point[i] = 0;
             }
             userToGeodetic.transform(point);
-            setEndPoint(point[0], point[1]);
+            setEndGeographicPoint(point[0], point[1]);
             /*
              * Computes the azimuth to the given point. This azimuth may be different than
the azimuth of the
              * geodesic path we are building. Compute the point that we would have if the
azimuth was correct
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 b628331..0980a66 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
@@ -108,11 +108,11 @@ public final strictfp class GeodeticCalculatorTest extends TestCase
{
     public void testCardinalAzimuths() {
         final GeodeticCalculator c = create(false);
         final double tolerance = 0.2;
-        c.setStartPoint(20, 12);
-        c.setEndPoint(20, 13);  assertEquals("East",   90, c.getStartingAzimuth(), tolerance);
-        c.setEndPoint(21, 12);  assertEquals("North",   0, c.getStartingAzimuth(), tolerance);
-        c.setEndPoint(20, 11);  assertEquals("West",  -90, c.getStartingAzimuth(), tolerance);
-        c.setEndPoint(19, 12);  assertEquals("South", 180, c.getStartingAzimuth(), tolerance);
+        c.setStartGeographicPoint(20, 12);
+        c.setEndGeographicPoint(20, 13);  assertEquals("East",   90, c.getStartingAzimuth(),
tolerance);
+        c.setEndGeographicPoint(21, 12);  assertEquals("North",   0, c.getStartingAzimuth(),
tolerance);
+        c.setEndGeographicPoint(20, 11);  assertEquals("West",  -90, c.getStartingAzimuth(),
tolerance);
+        c.setEndGeographicPoint(19, 12);  assertEquals("South", 180, c.getStartingAzimuth(),
tolerance);
     }
 
     /**
@@ -122,18 +122,18 @@ public final strictfp class GeodeticCalculatorTest extends TestCase
{
     public void testAzimuthAtPoles() {
         final GeodeticCalculator c = create(false);
         final double tolerance = 0.2;
-        c.setStartPoint( 90,  30);
-        c.setEndPoint  ( 20,  20);  assertEquals(-170, c.getStartingAzimuth(), tolerance);
-        c.setEndPoint  ( 20,  40);  assertEquals( 170, c.getStartingAzimuth(), tolerance);
-        c.setEndPoint  ( 20,  30);  assertEquals( 180, c.getStartingAzimuth(), tolerance);
-        c.setEndPoint  (-20,  30);  assertEquals( 180, c.getStartingAzimuth(), tolerance);
-        c.setEndPoint  (-90,  30);  assertEquals( 180, c.getStartingAzimuth(), tolerance);
+        c.setStartGeographicPoint( 90,  30);
+        c.setEndGeographicPoint  ( 20,  20);  assertEquals(-170, c.getStartingAzimuth(),
tolerance);
+        c.setEndGeographicPoint  ( 20,  40);  assertEquals( 170, c.getStartingAzimuth(),
tolerance);
+        c.setEndGeographicPoint  ( 20,  30);  assertEquals( 180, c.getStartingAzimuth(),
tolerance);
+        c.setEndGeographicPoint  (-20,  30);  assertEquals( 180, c.getStartingAzimuth(),
tolerance);
+        c.setEndGeographicPoint  (-90,  30);  assertEquals( 180, c.getStartingAzimuth(),
tolerance);
 
-        c.setStartPoint( 90,   0);
-        c.setEndPoint  ( 20,  20);  assertEquals( 160, c.getStartingAzimuth(), tolerance);
-        c.setEndPoint  ( 20, -20);  assertEquals(-160, c.getStartingAzimuth(), tolerance);
-        c.setEndPoint  ( 20,   0);  assertEquals( 180, c.getStartingAzimuth(), tolerance);
-        c.setEndPoint  (-90,   0);  assertEquals( 180, c.getStartingAzimuth(), tolerance);
+        c.setStartGeographicPoint( 90,   0);
+        c.setEndGeographicPoint  ( 20,  20);  assertEquals( 160, c.getStartingAzimuth(),
tolerance);
+        c.setEndGeographicPoint  ( 20, -20);  assertEquals(-160, c.getStartingAzimuth(),
tolerance);
+        c.setEndGeographicPoint  ( 20,   0);  assertEquals( 180, c.getStartingAzimuth(),
tolerance);
+        c.setEndGeographicPoint  (-90,   0);  assertEquals( 180, c.getStartingAzimuth(),
tolerance);
     }
 
     /**
@@ -144,10 +144,10 @@ public final strictfp class GeodeticCalculatorTest extends TestCase
{
         final Random random = TestUtilities.createRandomNumberGenerator();
         final GeodeticCalculator c = create(false);
         final double r = c.ellipsoid.getSemiMajorAxis() * (PI / 180);
-        c.setStartPoint(0, 0);
+        c.setStartGeographicPoint(0, 0);
         for (int i=0; i<100; i++) {
             final double x = 360 * random.nextDouble() - 180;
-            c.setEndPoint(0, x);
+            c.setEndGeographicPoint(0, x);
             final double expected = abs(x) * r;
             assertEquals("Geodesic",   expected, c.getGeodesicDistance(), Formulas.LINEAR_TOLERANCE);
             assertEquals("Rhumb line", expected, c.getRhumblineLength(),  Formulas.LINEAR_TOLERANCE);
@@ -165,8 +165,8 @@ public final strictfp class GeodeticCalculatorTest extends TestCase {
     @Test
     public void testGeodesicDistanceAndAzimuths() throws TransformException {
         final GeodeticCalculator c = create(false);
-        c.setStartPoint(-33.0, -71.6);          // Valparaíso
-        c.setEndPoint  ( 31.4, 121.8);          // Shanghai
+        c.setStartGeographicPoint(-33.0, -71.6);            // Valparaíso
+        c.setEndGeographicPoint  ( 31.4, 121.8);            // Shanghai
         /*
          * Wikipedia example gives:
          *
@@ -224,7 +224,7 @@ public final strictfp class GeodeticCalculatorTest extends TestCase {
     @DependsOnMethod("testUsingTransform")
     public void testCircularRegion2D() throws TransformException {
         final GeodeticCalculator c = create(true);
-        c.setStartPoint(-33.0, -71.6);                          // Valparaíso
+        c.setStartGeographicPoint(-33.0, -71.6);                // Valparaíso
         c.setGeodesicDistance(100000);                          // 100 km
         Shape region = c.createCircularRegion2D(10000);
         if (VisualCheck.SHOW_WIDGET) {
@@ -250,8 +250,8 @@ public final strictfp class GeodeticCalculatorTest extends TestCase {
     public void testGeodesicPath2D() throws TransformException {
         final GeodeticCalculator c = create(true);
         final double tolerance = 0.05;
-        c.setStartPoint(-33.0, -71.6);                                                  //
Valparaíso
-        c.setEndPoint  ( 31.4, 121.8);                                                  //
Shanghai
+        c.setStartGeographicPoint(-33.0, -71.6);                                        //
Valparaíso
+        c.setEndGeographicPoint  ( 31.4, 121.8);                                        //
Shanghai
         final Shape singleCurve = c.createGeodesicPath2D(Double.POSITIVE_INFINITY);
         final Shape multiCurves = c.createGeodesicPath2D(10000);                        //
10 km tolerance.
         /*
@@ -278,8 +278,8 @@ public final strictfp class GeodeticCalculatorTest extends TestCase {
     public void testGeodesicPathOnEquator() throws TransformException {
         final GeodeticCalculator c = create(false);
         final double tolerance = 1E-12;
-        c.setStartPoint(0, 20);
-        c.setEndPoint  (0, 12);
+        c.setStartGeographicPoint(0, 20);
+        c.setEndGeographicPoint  (0, 12);
         assertEquals(-90, c.getStartingAzimuth(), tolerance);
         assertEquals(-90, c.getEndingAzimuth(),   tolerance);
         final Shape geodeticCurve = c.createGeodesicPath2D(1);
@@ -309,8 +309,8 @@ public final strictfp class GeodeticCalculatorTest extends TestCase {
             final double φ2 = random.nextDouble() * 180 -  90;
             final double Δλ = random.nextDouble() * 360 - 180;
             final double λ2 = IEEEremainder(λ1 + Δλ, 360);
-            c.setStartPoint(φ1, λ1);
-            c.setEndPoint  (φ2, λ2);
+            c.setStartGeographicPoint(φ1, λ1);
+            c.setEndGeographicPoint  (φ2, λ2);
             final double geodesic  = c.getGeodesicDistance();
             final double rhumbLine = c.getRhumblineLength();
             final GeodesicData expected = reference.Inverse(φ1, λ1, φ2, λ2);
@@ -350,7 +350,7 @@ public final strictfp class GeodeticCalculatorTest extends TestCase {
                 default: fail("Unexpected segment"); break;
                 case PathIterator.SEG_MOVETO: break;
                 case PathIterator.SEG_LINETO: {
-                    c.setEndPoint(buffer[0], buffer[1]);
+                    c.setEndGeographicPoint(buffer[0], buffer[1]);
                     aErrors.accept(abs(c.getStartingAzimuth() - azimuth));
                     c.setStartingAzimuth(azimuth);
                     DirectPosition endPoint = c.getEndPoint();
@@ -395,7 +395,7 @@ public final strictfp class GeodeticCalculatorTest extends TestCase {
                      */
                     final double tolerance = data[6] * 0.01;                // 1% of distance.
                     final double cosφ = abs(cos(toRadians(data[3])));       // For adjusting
longitude tolerance.
-                    c.setStartPoint(data[0], data[1]);                      // (φ₁, λ₁)
+                    c.setStartGeographicPoint(data[0], data[1]);            // (φ₁, λ₁)
                     if (random.nextBoolean()) {
                         /*
                          * Computes the end point from a distance and azimuth. The angular
tolerance
@@ -429,7 +429,7 @@ public final strictfp class GeodeticCalculatorTest extends TestCase {
                          * of them for making sure that GeodeticCalculator never see the
expected
                          * values.
                          */
-                        c.setEndPoint(data[3], data[4]);            // (φ₂, λ₂)
+                        c.setEndGeographicPoint(data[3], data[4]);  // (φ₂, λ₂)
                         compareGeodeticData(data, c,
                                 Formulas.ANGULAR_TOLERANCE,         // Latitude tolerance
                                 Formulas.ANGULAR_TOLERANCE,         // Longitude tolerance
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/index/tree/QuadTree.java b/storage/sis-storage/src/main/java/org/apache/sis/index/tree/QuadTree.java
index 855e8ba..92fcdea 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/index/tree/QuadTree.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/index/tree/QuadTree.java
@@ -350,8 +350,8 @@ public class QuadTree {
                     DirectPosition2D latLon = data[i].getLatLon();
                     double distance;
                     synchronized (calculator) {
-                        calculator.setStartPoint(latLon.y, latLon.x);
-                        calculator.setEndPoint(point.y, point.x);
+                        calculator.setStartGeographicPoint(latLon.y, latLon.x);
+                        calculator.setEndGeographicPoint(point.y, point.x);
                         distance = calculator.getGeodesicDistance();
                     }
                     if (distance <= radiusKM) {


Mime
View raw message