[geos-commits] [SCM] GEOS branch main updated. 4907d593aa6aa31c25dbe73933bf66995a04e498
git at osgeo.org
git at osgeo.org
Thu Jul 25 11:41:38 PDT 2024
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 4907d593aa6aa31c25dbe73933bf66995a04e498 (commit)
from 6201229a66ae3eef2b0c62cc39dbab48b2e3df7e (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 4907d593aa6aa31c25dbe73933bf66995a04e498
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Thu Jul 25 11:41:01 2024 -0700
Add envelope condition in support of RelateNG
diff --git a/include/geos/noding/MCIndexSegmentSetMutualIntersector.h b/include/geos/noding/MCIndexSegmentSetMutualIntersector.h
index abc687919..12fe5d8b3 100644
--- a/include/geos/noding/MCIndexSegmentSetMutualIntersector.h
+++ b/include/geos/noding/MCIndexSegmentSetMutualIntersector.h
@@ -20,12 +20,15 @@
#include <geos/index/strtree/TemplateSTRtree.h> // inherited
namespace geos {
+namespace geom {
+ class Envelope;
+}
namespace index {
-class SpatialIndex;
+ class SpatialIndex;
}
namespace noding {
-class SegmentString;
-class SegmentIntersector;
+ class SegmentString;
+ class SegmentIntersector;
}
}
@@ -51,6 +54,17 @@ public:
, nOverlaps(0)
, overlapTolerance(p_tolerance)
, indexBuilt(false)
+ , envelope(nullptr)
+ {}
+
+ MCIndexSegmentSetMutualIntersector(const geom::Envelope* p_envelope)
+ : monoChains()
+ , indexCounter(0)
+ , processCounter(0)
+ , nOverlaps(0)
+ , overlapTolerance(0.0)
+ , indexBuilt(false)
+ , envelope(p_envelope)
{}
MCIndexSegmentSetMutualIntersector()
@@ -117,6 +131,7 @@ private:
*/
bool indexBuilt;
MonoChains indexChains;
+ const geom::Envelope* envelope;
void addToIndex(SegmentString* segStr);
diff --git a/src/noding/MCIndexSegmentSetMutualIntersector.cpp b/src/noding/MCIndexSegmentSetMutualIntersector.cpp
index 148ace410..b5b5e4d49 100644
--- a/src/noding/MCIndexSegmentSetMutualIntersector.cpp
+++ b/src/noding/MCIndexSegmentSetMutualIntersector.cpp
@@ -12,6 +12,7 @@
*
**********************************************************************/
+#include <geos/geom/Envelope.h>
#include <geos/noding/MCIndexSegmentSetMutualIntersector.h>
#include <geos/noding/SegmentSetMutualIntersector.h>
#include <geos/noding/SegmentString.h>
@@ -47,8 +48,14 @@ MCIndexSegmentSetMutualIntersector::addToMonoChains(SegmentString* segStr)
{
if (segStr->size() == 0)
return;
+ MonoChains segChains;
MonotoneChainBuilder::getChains(segStr->getCoordinates(),
- segStr, monoChains);
+ segStr, segChains);
+ for (auto& mc : segChains) {
+ if (envelope == nullptr || envelope->intersects(mc.getEnvelope())) {
+ monoChains.push_back(mc);
+ }
+ }
}
@@ -89,7 +96,9 @@ MCIndexSegmentSetMutualIntersector::process(SegmentString::ConstVect* segStrings
{
if (!indexBuilt) {
for (auto& mc: indexChains) {
- index.insert(&(mc.getEnvelope(overlapTolerance)), &mc);
+ if (envelope == nullptr || envelope->intersects(mc.getEnvelope())) {
+ index.insert(&(mc.getEnvelope(overlapTolerance)), &mc);
+ }
}
indexBuilt = true;
}
-----------------------------------------------------------------------
Summary of changes:
.../noding/MCIndexSegmentSetMutualIntersector.h | 21 ++++++++++++++++++---
src/noding/MCIndexSegmentSetMutualIntersector.cpp | 13 +++++++++++--
2 files changed, 29 insertions(+), 5 deletions(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list