GEOS 3.11.1
MCIndexSegmentSetMutualIntersector.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2006 Refractions Research Inc.
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 *
14 **********************************************************************
15 *
16 * Last port: noding/MCIndexSegmentSetMutualIntersector.java r388 (JTS-1.12)
17 *
18 **********************************************************************/
19
20#pragma once
21
22#include <geos/noding/SegmentSetMutualIntersector.h> // inherited
23#include <geos/index/chain/MonotoneChainOverlapAction.h> // inherited
24#include <geos/index/chain/MonotoneChain.h> // inherited
25#include <geos/index/strtree/TemplateSTRtree.h> // inherited
26
27namespace geos {
28namespace index {
29class SpatialIndex;
30
31namespace chain {
32}
33namespace strtree {
34//class STRtree;
35}
36}
37namespace noding {
38class SegmentString;
39class SegmentIntersector;
40}
41}
42
43//using namespace geos::index::strtree;
44
45namespace geos {
46namespace noding { // geos::noding
47
56public:
57
59 : monoChains()
60 , indexCounter(0)
61 , processCounter(0)
62 , nOverlaps(0)
63 , indexBuilt(false)
64 {}
65
67 {};
68
70 getIndex()
71 {
72 return &index;
73 }
74
75 void setBaseSegments(SegmentString::ConstVect* segStrings) override;
76
77 // NOTE: re-populates the MonotoneChain vector with newly created chains
78 void process(SegmentString::ConstVect* segStrings) override;
79
80 class SegmentOverlapAction : public index::chain::MonotoneChainOverlapAction {
81 private:
83
84 // Declare type as noncopyable
85 SegmentOverlapAction(const SegmentOverlapAction& other) = delete;
86 SegmentOverlapAction& operator=(const SegmentOverlapAction& rhs) = delete;
87
88 public:
89 SegmentOverlapAction(SegmentIntersector& p_si) :
90 index::chain::MonotoneChainOverlapAction(), si(p_si)
91 {}
92
93 void overlap(const index::chain::MonotoneChain& mc1, std::size_t start1,
94 const index::chain::MonotoneChain& mc2, std::size_t start2) override;
95 };
96
103
104private:
105
106 typedef std::vector<index::chain::MonotoneChain> MonoChains;
107 MonoChains monoChains;
108
109 /*
110 * The index::SpatialIndex used should be something that supports
111 * envelope (range) queries efficiently (such as a index::quadtree::Quadtree
112 * or index::strtree::STRtree).
113 */
114 index::strtree::TemplateSTRtree<const index::chain::MonotoneChain*> index;
115 int indexCounter;
116 int processCounter;
117 // statistics
118 int nOverlaps;
119
120 /* memory management helper, holds MonotoneChain objects used
121 * in the SpatialIndex. It's cleared when the SpatialIndex is
122 */
123 bool indexBuilt;
124 MonoChains indexChains;
125
126 void addToIndex(SegmentString* segStr);
127
128 void intersectChains();
129
130 void addToMonoChains(SegmentString* segStr);
131
132};
133
134} // namespace geos::noding
135} // namespace geos
136
Abstract class defines basic insertion and query operations supported by classes implementing spatial...
Definition: SpatialIndex.h:46
The action for the internal iterator for performing overlap queries on a MonotoneChain.
Definition: MonotoneChainOverlapAction.h:42
Monotone Chains are a way of partitioning the segments of a linestring to allow for fast searching of...
Definition: index/chain/MonotoneChain.h:85
Intersects two sets of SegmentStrings using a index based on MonotoneChains and a SpatialIndex.
Definition: MCIndexSegmentSetMutualIntersector.h:55
MCIndexSegmentSetMutualIntersector(const MCIndexSegmentSetMutualIntersector &)=delete
void setBaseSegments(SegmentString::ConstVect *segStrings) override
void process(SegmentString::ConstVect *segStrings) override
Processes possible intersections detected by a Noder.
Definition: noding/SegmentIntersector.h:45
An intersector for the red-blue intersection problem.
Definition: SegmentSetMutualIntersector.h:36
An interface for classes which represent a sequence of contiguous line segments.
Definition: SegmentString.h:45
Basic namespace for all GEOS functionalities.
Definition: geos.h:39