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: Take a more representative center of data.
Date Wed, 02 Dec 2020 18:07:07 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 1c395af  Take a more representative center of data.
1c395af is described below

commit 1c395af46708f031b430a5b5e884ae5a993e5fc7
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Wed Dec 2 19:05:52 2020 +0100

    Take a more representative center of data.
---
 .../org/apache/sis/internal/referencing/ExtentSelector.java   | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ExtentSelector.java
b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ExtentSelector.java
index 3dd3652..bb4e12e 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ExtentSelector.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ExtentSelector.java
@@ -172,12 +172,11 @@ public final class ExtentSelector<T> {
      * Otherwise other criteria documented in class javadoc are applied.
      *
      * @param  extent  the extent to evaluate, or {@code null} if none.
-     * @param  object  an optional user object associated to the given extent.
+     * @param  object  an user object associated to the given extent.
      */
     public void evaluate(final Extent extent, final T object) {
         final GeographicBoundingBox bbox = Extents.getGeographicBoundingBox(extent);
-        final GeographicBoundingBox intersection = Extents.intersection(bbox, areaOfInterest);
-        final double area = Extents.area(intersection);
+        final double area = Extents.area(Extents.intersection(bbox, areaOfInterest));
         /*
          * Accept the given object if it is the first one (`best = null`), or if it covers
a larger area than
          * previous object, or if the previous object had no extent information at all (`largestArea`
is NaN)
@@ -199,17 +198,17 @@ public final class ExtentSelector<T> {
                 if (notEquals(out, outsideArea)) {
                     return;
                 }
-                final double pd = pseudoDistance(intersection);
+                final double pd = pseudoDistance(bbox);
                 if (!(pd < pseudoDistance)) {
                     return;
                 }
                 pseudoDistance = pd;
             } else {
-                pseudoDistance = pseudoDistance(intersection);
+                pseudoDistance = pseudoDistance(bbox);
             }
             outsideArea = out;
         } else {
-            pseudoDistance = pseudoDistance(intersection);
+            pseudoDistance = pseudoDistance(bbox);
             outsideArea    = Extents.area(bbox) - area;
         }
         largestArea = area;


Mime
View raw message