[geos-commits] [SCM] GEOS branch 3.11 updated. 6229457c945ed5c3fa8e51f58c859b3d014cb7d1

git at osgeo.org git at osgeo.org
Wed Nov 22 07:50:10 PST 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".

The branch, 3.11 has been updated
       via  6229457c945ed5c3fa8e51f58c859b3d014cb7d1 (commit)
      from  6145340de03e26e6a1bbd0f1f2e676b56ad1b7c9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6229457c945ed5c3fa8e51f58c859b3d014cb7d1
Author: Martin Davis <mtnclimb at gmail.com>
Date:   Wed Nov 22 07:44:32 2023 -0800

    Fix DiscreteHausdorffDistance for LinearRing (#1000)

diff --git a/include/geos/algorithm/distance/DiscreteHausdorffDistance.h b/include/geos/algorithm/distance/DiscreteHausdorffDistance.h
index b8da5eeaa..651d86a94 100644
--- a/include/geos/algorithm/distance/DiscreteHausdorffDistance.h
+++ b/include/geos/algorithm/distance/DiscreteHausdorffDistance.h
@@ -36,19 +36,11 @@
 #endif
 
 namespace geos {
-namespace algorithm {
-//class RayCrossingCounter;
-}
 namespace geom {
 class Geometry;
 class Coordinate;
 //class CoordinateSequence;
 }
-namespace index {
-namespace intervalrtree {
-//class SortedPackedIntervalRTree;
-}
-}
 }
 
 namespace geos {
diff --git a/src/algorithm/distance/DistanceToPoint.cpp b/src/algorithm/distance/DistanceToPoint.cpp
index 36a1c059d..a96fe5cae 100644
--- a/src/algorithm/distance/DistanceToPoint.cpp
+++ b/src/algorithm/distance/DistanceToPoint.cpp
@@ -45,7 +45,7 @@ DistanceToPoint::computeDistance(const geom::Geometry& geom,
         return;
     }
 
-    if(geom.getGeometryTypeId() == GEOS_LINESTRING) {
+    if(geom.getGeometryTypeId() == GEOS_LINESTRING || geom.getGeometryTypeId() == GEOS_LINEARRING) {
         const LineString* ls = static_cast<const LineString*>(&geom);
         computeDistance(*ls, pt, ptDist);
     }
diff --git a/tests/unit/algorithm/distance/DiscreteHausdorffDistanceTest.cpp b/tests/unit/algorithm/distance/DiscreteHausdorffDistanceTest.cpp
index 46f4cb2da..3f7f72d36 100644
--- a/tests/unit/algorithm/distance/DiscreteHausdorffDistanceTest.cpp
+++ b/tests/unit/algorithm/distance/DiscreteHausdorffDistanceTest.cpp
@@ -198,5 +198,16 @@ void object::test<7>
                   DiscreteHausdorffDistance::distance(*g2, *g3));
 }
 
+// see https://github.com/libgeos/geos/issues/987
+template<>
+template<>
+void object::test<8>
+()
+{
+    runTest("LINEARRING (0 0, 0 10, 10 10, 10 0, 0 0)",
+            "LINEARRING (1 1, 1 9, 8 8, 9 1, 1 1)", 
+            2.8284271247461903);
+}
+
 } // namespace tut
 

-----------------------------------------------------------------------

Summary of changes:
 include/geos/algorithm/distance/DiscreteHausdorffDistance.h   |  8 --------
 src/algorithm/distance/DistanceToPoint.cpp                    |  2 +-
 .../unit/algorithm/distance/DiscreteHausdorffDistanceTest.cpp | 11 +++++++++++
 3 files changed, 12 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list