Commit 4907d59 1 parent 6201229 commit 4907d59 Copy full SHA for 4907d59
File tree 2 files changed +29
-5
lines changed
2 files changed +29
-5
lines changed Original file line number Diff line number Diff line change 20
20
#include < geos/index/strtree/TemplateSTRtree.h> // inherited
21
21
22
22
namespace geos {
23
+ namespace geom {
24
+ class Envelope ;
25
+ }
23
26
namespace index {
24
- class SpatialIndex ;
27
+ class SpatialIndex ;
25
28
}
26
29
namespace noding {
27
- class SegmentString ;
28
- class SegmentIntersector ;
30
+ class SegmentString ;
31
+ class SegmentIntersector ;
29
32
}
30
33
}
31
34
@@ -51,6 +54,17 @@ class MCIndexSegmentSetMutualIntersector : public SegmentSetMutualIntersector {
51
54
, nOverlaps(0 )
52
55
, overlapTolerance(p_tolerance)
53
56
, indexBuilt(false )
57
+ , envelope(nullptr )
58
+ {}
59
+
60
+ MCIndexSegmentSetMutualIntersector (const geom::Envelope* p_envelope)
61
+ : monoChains()
62
+ , indexCounter(0 )
63
+ , processCounter(0 )
64
+ , nOverlaps(0 )
65
+ , overlapTolerance(0.0 )
66
+ , indexBuilt(false )
67
+ , envelope(p_envelope)
54
68
{}
55
69
56
70
MCIndexSegmentSetMutualIntersector ()
@@ -117,6 +131,7 @@ class MCIndexSegmentSetMutualIntersector : public SegmentSetMutualIntersector {
117
131
*/
118
132
bool indexBuilt;
119
133
MonoChains indexChains;
134
+ const geom::Envelope* envelope;
120
135
121
136
void addToIndex (SegmentString* segStr);
122
137
Original file line number Diff line number Diff line change 12
12
*
13
13
**********************************************************************/
14
14
15
+ #include < geos/geom/Envelope.h>
15
16
#include < geos/noding/MCIndexSegmentSetMutualIntersector.h>
16
17
#include < geos/noding/SegmentSetMutualIntersector.h>
17
18
#include < geos/noding/SegmentString.h>
@@ -47,8 +48,14 @@ MCIndexSegmentSetMutualIntersector::addToMonoChains(SegmentString* segStr)
47
48
{
48
49
if (segStr->size () == 0 )
49
50
return ;
51
+ MonoChains segChains;
50
52
MonotoneChainBuilder::getChains (segStr->getCoordinates (),
51
- segStr, monoChains);
53
+ segStr, segChains);
54
+ for (auto & mc : segChains) {
55
+ if (envelope == nullptr || envelope->intersects (mc.getEnvelope ())) {
56
+ monoChains.push_back (mc);
57
+ }
58
+ }
52
59
}
53
60
54
61
@@ -89,7 +96,9 @@ MCIndexSegmentSetMutualIntersector::process(SegmentString::ConstVect* segStrings
89
96
{
90
97
if (!indexBuilt) {
91
98
for (auto & mc: indexChains) {
92
- index .insert (&(mc.getEnvelope (overlapTolerance)), &mc);
99
+ if (envelope == nullptr || envelope->intersects (mc.getEnvelope ())) {
100
+ index .insert (&(mc.getEnvelope (overlapTolerance)), &mc);
101
+ }
93
102
}
94
103
indexBuilt = true ;
95
104
}
You can’t perform that action at this time.
0 commit comments