[geos-commits] [SCM] GEOS branch 3.12 updated. c6ee309b2dfcc4334279c915be43952f75620ceb

git at osgeo.org git at osgeo.org
Wed Nov 22 07:47:33 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.12 has been updated
       via  c6ee309b2dfcc4334279c915be43952f75620ceb (commit)
      from  3fead1bbd0f513fac490cb83a3fc5eff6009a5de (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 c6ee309b2dfcc4334279c915be43952f75620ceb
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