[geos-commits] [SCM] GEOS branch master updated. 34d4b086b74078daa415242ef2534967e1aa1cd2

git at osgeo.org git at osgeo.org
Tue Jan 12 20:19:56 PST 2021


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, master has been updated
       via  34d4b086b74078daa415242ef2534967e1aa1cd2 (commit)
      from  995b5574dc7117a1367393c4e1cf2eeb1387b2fc (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 34d4b086b74078daa415242ef2534967e1aa1cd2
Author: Martin Davis <mtnclimb at gmail.com>
Date:   Tue Jan 12 20:19:48 2021 -0800

    Add geosop lineMerge operation

diff --git a/util/geosop/GeomFunction.cpp b/util/geosop/GeomFunction.cpp
index c818711..ccd1b75 100644
--- a/util/geosop/GeomFunction.cpp
+++ b/util/geosop/GeomFunction.cpp
@@ -25,6 +25,7 @@
 #include <geos/geom/prep/PreparedGeometryFactory.h>
 #include <geos/algorithm/construct/MaximumInscribedCircle.h>
 #include <geos/algorithm/MinimumBoundingCircle.h>
+#include <geos/operation/linemerge/LineMerger.h>
 #include <geos/operation/distance/DistanceOp.h>
 #include <geos/operation/relate/RelateOp.h>
 #include <geos/operation/valid/MakeValid.h>
@@ -152,6 +153,20 @@ GeomFunction::init()
             return new Result( std::move(res) );
         });
 
+    add("lineMerge", "merges the lines of geometry A", 1, 0,
+        [](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+            geos::operation::linemerge::LineMerger lmrgr;
+            lmrgr.add(geom.get());
+
+            std::vector<std::unique_ptr<LineString>> lines = lmrgr.getMergedLineStrings();
+
+            std::vector<std::unique_ptr<const Geometry>> geoms;
+            for(unsigned int i = 0; i < lines.size(); i++) {
+                geoms.push_back( std::move(lines[i]) );
+            }
+            return new Result( std::move(geoms) ) ;
+        });
+
     add("delaunay", "computes the Delaunay Triangulation of geometry A vertices", 1, 0,
         [](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
             geos::triangulate::DelaunayTriangulationBuilder builder;

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

Summary of changes:
 util/geosop/GeomFunction.cpp | 15 +++++++++++++++
 1 file changed, 15 insertions(+)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list