[geos-commits] [SCM] GEOS branch main updated. 4286a70ea3321b41930633b1de364f40dfbeefcb

git at osgeo.org git at osgeo.org
Wed Nov 22 07:45:09 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, main has been updated
       via  4286a70ea3321b41930633b1de364f40dfbeefcb (commit)
      from  301bc462db3b8fd3d28137ccbfb8d0ee85d0c479 (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 4286a70ea3321b41930633b1de364f40dfbeefcb
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 5dc1dd0a6..be136edee 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 1891b63f8..b98343229 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 5f21fe420..735344cd5 100644
--- a/tests/unit/algorithm/distance/DiscreteHausdorffDistanceTest.cpp
+++ b/tests/unit/algorithm/distance/DiscreteHausdorffDistanceTest.cpp
@@ -216,5 +216,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