[geos-commits] [SCM] GEOS branch main updated. 12321f7276512ec722bc95ad51e2a8e01acc9ea1

git at osgeo.org git at osgeo.org
Mon May 8 13:22:52 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  12321f7276512ec722bc95ad51e2a8e01acc9ea1 (commit)
       via  afbcf679e4038129c322590401f2ab068dc222aa (commit)
       via  711b540ba4a6aa43a163e15ca03d4bed2e780ca6 (commit)
      from  cd6e737d00b5b9279bfe0f3b174b9612b93b5f94 (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 12321f7276512ec722bc95ad51e2a8e01acc9ea1
Author: Martin Davis <mtnclimb at gmail.com>
Date:   Mon May 8 13:22:32 2023 -0700

    Update NEWS

diff --git a/NEWS.md b/NEWS.md
index 0eeb49079..14714aee3 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -64,6 +64,7 @@ xxxx-xx-xx
   - LargestEmptyCircle: enhance boundary to allow any polygonal geometry (GH-859, Martin Davis)
   - Fix MaximumInscribedCircle and LargestEmptyCircle performance and memory issues (GH-883, Martin Davis)
   - GEOSHasZ: Fix handling with empty geometries (GH-887, Mike Taves)
+  - OffsetCurve: fix EndCap parameter handling (GH-899, Martin Davis)
 
 - Changes:
   - Remove Orientation.isCCW exception to simplify logic and align with JTS (GH-878, Martin Davis)

commit afbcf679e4038129c322590401f2ab068dc222aa
Author: Martin Davis <mtnclimb at gmail.com>
Date:   Mon May 8 13:16:41 2023 -0700

    Fix OffsetCurve EndCap parameter handling (#899)

diff --git a/capi/geos_ts_c.cpp b/capi/geos_ts_c.cpp
index 363e34864..9941292e5 100644
--- a/capi/geos_ts_c.cpp
+++ b/capi/geos_ts_c.cpp
@@ -1179,7 +1179,7 @@ extern "C" {
     {
         return execute(extHandle, [&]() {
             BufferParameters bp;
-            bp.setEndCapStyle(BufferParameters::CAP_FLAT);
+            //-- use default cap style ROUND 
             bp.setQuadrantSegments(quadsegs);
 
             if(joinStyle > BufferParameters::JOIN_BEVEL) {
diff --git a/include/geos/operation/buffer/OffsetCurve.h b/include/geos/operation/buffer/OffsetCurve.h
index 299cbdd8c..1a9f450be 100644
--- a/include/geos/operation/buffer/OffsetCurve.h
+++ b/include/geos/operation/buffer/OffsetCurve.h
@@ -223,13 +223,16 @@ public:
     OffsetCurve(const Geometry& geom, double dist, BufferParameters& bp)
         : inputGeom(geom)
         , distance(dist)
-        , bufferParams(bp)
         , matchDistance(std::abs(dist)/MATCH_DISTANCE_FACTOR)
         , geomFactory(geom.getFactory())
         {
             if (!std::isfinite(dist)) {
                 throw util::IllegalArgumentException("OffsetCurve distance must be a finite value");
             }
+            //-- set buffer params, leaving cap style as the default CAP_ROUND
+            bufferParams.setQuadrantSegments( bp.getQuadrantSegments());
+            bufferParams.setJoinStyle( bp.getJoinStyle());
+            bufferParams.setMitreLimit( bp.getMitreLimit());
         };
 
     /**
diff --git a/tests/unit/capi/GEOSOffsetCurveTest.cpp b/tests/unit/capi/GEOSOffsetCurveTest.cpp
index ccda8f0ce..c2ab6805c 100644
--- a/tests/unit/capi/GEOSOffsetCurveTest.cpp
+++ b/tests/unit/capi/GEOSOffsetCurveTest.cpp
@@ -132,7 +132,7 @@ void object::test<5>()
         "LINESTRING(33282908 6005055,33282900 6005050,33282892 6005042,33282876 6005007,33282863 6004982,33282866 6004971,33282876 6004975,33282967 6005018,33282999 6005031)",
         // Old algorithm
         // "LINESTRING EMPTY",
-        "LINESTRING (33282915.823395286 6005042.482567544, 33282948.754269265 6005058.043310193, 33282949.87329309 6005058.534544426, 33282982.439409934 6005071.764529393)",
+        "LINESTRING (33282939.63869393 6005053.735950421, 33282948.754269257 6005058.043310191, 33282949.873293087 6005058.534544423, 33282982.439409934 6005071.764529393)",
         44, 1, GEOSBUF_JOIN_MITRE, 1,
         0.000001
         );
@@ -246,5 +246,19 @@ void object::test<11>()
         );
 }
 
+// Test negative offset
+// See https://github.com/libgeos/geos/issues/897
+template<>
+template<>
+void object::test<12>()
+{
+    checkOffset(
+        "LINESTRING (292671.05 7336734.42, 292624.85 7336739.72, 292623.53 7336739.92, 292622.36 7336740.2, 292621.35 7336740.57, 292620.94 7336740.78, 292620.61 7336740.97, 292620.33 7336741.14, 292620.13 7336741.29, 292619.79 7336741.57, 292619.48 7336741.86, 292619.34 7336742.01, 292619.21 7336742.17, 292619.09 7336742.34, 292618.98 7336742.51, 292618.8 7336742.88, 292618.63 7336743.25, 292618.57 7336743.43, 292618.52 7336743.58, 292618.48 7336743.71, 292618.46 7336743.8, 292618.44 7336743.98, 292618.42 7336744.15, 292618.41 7336744.33, 292618.4 7336744.51, 292618.39 7336744.69, 292618.38 7336744.88, 292618.38 7336744.91, 292618.38 7336744.95, 292618.38 7336744.99, 292618.38 7336745.02, 292618.38 7336745.06, 292618.38 7336745.1, 292618.38 7336745.13, 292618.38 7336745.17, 292618.38 7336745.21, 292618.38 7336745.25, 292618.38 7336745.43, 292618.41 7336746.92)",
+        "LINESTRING (292672.7595667329 7336749.322260955, 292631.53009245027 7336754.052049131)",
+        -15, 8, GEOSBUF_JOIN_ROUND, 0,
+        0.000001
+        );
+}
+
 } // namespace tut
 

commit 711b540ba4a6aa43a163e15ca03d4bed2e780ca6
Author: Martin Davis <mtnclimb at gmail.com>
Date:   Mon May 8 11:40:29 2023 -0700

    Improve geosop OffsetCurve call

diff --git a/util/geosop/GeometryOp.cpp b/util/geosop/GeometryOp.cpp
index 3f72be214..5424b92e1 100644
--- a/util/geosop/GeometryOp.cpp
+++ b/util/geosop/GeometryOp.cpp
@@ -292,9 +292,7 @@ std::vector<GeometryOpCreator> opRegistry {
     catConst,
     "compute the offset curve of geometry by a distance",
     [](const std::unique_ptr<Geometry>& geom, double d) {
-        geos::operation::buffer::BufferParameters bp;
-
-        geos::operation::buffer::OffsetCurve oc(*geom, d, bp);
+        geos::operation::buffer::OffsetCurve oc(*geom, d);
         std::unique_ptr<Geometry> g3 = oc.getCurve();
         return new Result( g3.release() );
     });

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

Summary of changes:
 NEWS.md                                     |  1 +
 capi/geos_ts_c.cpp                          |  2 +-
 include/geos/operation/buffer/OffsetCurve.h |  5 ++++-
 tests/unit/capi/GEOSOffsetCurveTest.cpp     | 16 +++++++++++++++-
 util/geosop/GeometryOp.cpp                  |  4 +---
 5 files changed, 22 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list