[geos-commits] [SCM] GEOS branch master updated. 02bde79dd08fb84b3f42b93083fa6f4ce4ca17bd
    git at osgeo.org 
    git at osgeo.org
       
    Fri Mar  5 22:27:23 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  02bde79dd08fb84b3f42b93083fa6f4ce4ca17bd (commit)
      from  c0fd82567062272d9fda1dcb73f2d5417823961f (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 02bde79dd08fb84b3f42b93083fa6f4ce4ca17bd
Author: Martin Davis <mtnclimb at gmail.com>
Date:   Fri Mar 5 22:27:14 2021 -0800
    Add geosop clipRect operation
diff --git a/util/geosop/GeomFunction.cpp b/util/geosop/GeomFunction.cpp
index b63f8e2..a17723b 100644
--- a/util/geosop/GeomFunction.cpp
+++ b/util/geosop/GeomFunction.cpp
@@ -19,6 +19,7 @@
 #include <geos/geom/Polygon.h>
 #include <geos/geom/GeometryCollection.h>
 #include <geos/geom/IntersectionMatrix.h>
+#include <geos/geom/Envelope.h>
 #include <geos/geom/PrecisionModel.h>
 #include <geos/geom/GeometryFactory.h>
 #include <geos/geom/prep/PreparedGeometry.h>
@@ -28,6 +29,8 @@
 #include <geos/geom/util/Densifier.h>
 #include <geos/operation/linemerge/LineMerger.h>
 #include <geos/operation/distance/DistanceOp.h>
+#include <geos/operation/intersection/RectangleIntersection.h>
+#include <geos/operation/intersection/Rectangle.h>
 #include <geos/operation/relate/RelateOp.h>
 #include <geos/operation/valid/MakeValid.h>
 #include <geos/operation/overlayng/OverlayNG.h>
@@ -380,6 +383,16 @@ GeomFunction::init()
             return new Result( OverlayNG::overlay(geom.get(), geomB.get(), OverlayNG::UNION, &pm) );
         });
 
+    add("clipRect", "clips geometry A to envelope of B", 2, 0,
+        [](const std::unique_ptr<Geometry>& geom, const std::unique_ptr<Geometry>& geomB, double d)->Result* {
+            (void)d;  // prevent unused variable warning
+            using geos::operation::intersection::Rectangle;
+            using geos::operation::intersection::RectangleIntersection;
+            const Envelope* env = geomB->getEnvelopeInternal();
+            Rectangle rect(env->getMinX(), env->getMinY(), env->getMaxX(), env->getMaxY());
+            return new Result( RectangleIntersection::clip( *geom, rect) );
+        });
+
 }
 
 /* static */
-----------------------------------------------------------------------
Summary of changes:
 util/geosop/GeomFunction.cpp | 13 +++++++++++++
 1 file changed, 13 insertions(+)
hooks/post-receive
-- 
GEOS
    
    
More information about the geos-commits
mailing list