[geos-commits] [SCM] GEOS branch main updated. 6e6afa8c95f6f82bf704a8e11da9e7b25ca3b072

git at osgeo.org git at osgeo.org
Wed Apr 26 11:53:08 PDT 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  6e6afa8c95f6f82bf704a8e11da9e7b25ca3b072 (commit)
      from  787c5541968728105c7a1d1be84869521eab8931 (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 6e6afa8c95f6f82bf704a8e11da9e7b25ca3b072
Author: Martin Davis <mtnclimb at gmail.com>
Date:   Wed Apr 26 11:51:57 2023 -0700

    Remove Orientation.isCCW exception (#878)

diff --git a/capi/geos_c.h.in b/capi/geos_c.h.in
index c68b2ff5e..c701dc163 100644
--- a/capi/geos_c.h.in
+++ b/capi/geos_c.h.in
@@ -2320,8 +2320,7 @@ extern int GEOS_DLL GEOSCoordSeq_getDimensions(
 
 /**
 * Check orientation of a coordinate sequence. Closure of the sequence is
-* assumed. Invalid (collapsed) sequences will return false. Short (less
-* than 4 points) sequences will return exception.
+* assumed. Invalid (collapsed) or short (fewer than 4 points) sequences return false.
 * \param s the coordinate sequence
 * \param is_ccw pointer for ccw value, 1 if counter-clockwise orientation, 0 otherwise
 * \return 0 on exception, 1 on success
diff --git a/src/algorithm/Orientation.cpp b/src/algorithm/Orientation.cpp
index a3edb14c3..55ff3fe82 100644
--- a/src/algorithm/Orientation.cpp
+++ b/src/algorithm/Orientation.cpp
@@ -50,8 +50,7 @@ Orientation::isCCW(const geom::CoordinateSequence* ring)
     int inPts = static_cast<int>(ring->size()) - 1;
     // sanity check
     if (inPts < 3)
-        throw util::IllegalArgumentException(
-            "Ring has fewer than 4 points, so orientation cannot be determined");
+        return false;
 
     uint32_t nPts = static_cast<uint32_t>(inPts);
     /**
@@ -146,4 +145,3 @@ Orientation::isCCWArea(const geom::CoordinateSequence* ring)
 
 } // namespace geos.algorithm
 } //namespace geos
-
diff --git a/tests/unit/capi/GEOSCoordSeqTest.cpp b/tests/unit/capi/GEOSCoordSeqTest.cpp
index 9b06b0d91..03feb3efa 100644
--- a/tests/unit/capi/GEOSCoordSeqTest.cpp
+++ b/tests/unit/capi/GEOSCoordSeqTest.cpp
@@ -319,7 +319,8 @@ void object::test<9>
     GEOSCoordSeq_setX(cs_, 2, 1);
     GEOSCoordSeq_setY(cs_, 2, 0);
 
-    ensure_equals(GEOSCoordSeq_isCCW(cs_, &ccw), 0);
+    ensure_equals(GEOSCoordSeq_isCCW(cs_, &ccw), 1);
+    ensure(!ccw);
 }
 
 template<>
@@ -331,7 +332,8 @@ void object::test<10>
     cs_ = GEOSCoordSeq_create(0, 0);
     char ccw;
 
-    ensure_equals(GEOSCoordSeq_isCCW(cs_, &ccw), 0);
+    ensure_equals(GEOSCoordSeq_isCCW(cs_, &ccw), 1);
+    ensure(!ccw);
 }
 
 template<>
@@ -765,4 +767,3 @@ void object::test<21>()
 }
 
 } // namespace tut
-

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

Summary of changes:
 capi/geos_c.h.in                     | 3 +--
 src/algorithm/Orientation.cpp        | 4 +---
 tests/unit/capi/GEOSCoordSeqTest.cpp | 7 ++++---
 3 files changed, 6 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list