GEOS 3.9.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#ifndef GEOS_NODING_MCINDEXSEGMENTSETMUTUALINTERSECTOR_H
21#define GEOS_NODING_MCINDEXSEGMENTSETMUTUALINTERSECTOR_H
22
23#include <geos/noding/SegmentSetMutualIntersector.h> // inherited
24#include <geos/index/chain/MonotoneChainOverlapAction.h> // inherited
25
26namespace geos {
27namespace index {
28class SpatialIndex;
29
30namespace chain {
31class MonotoneChain;
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
61
63 getIndex()
64 {
65 return index;
66 }
67
68 void setBaseSegments(SegmentString::ConstVect* segStrings) override;
69
70 // NOTE: re-populates the MonotoneChain vector with newly created chains
71 void process(SegmentString::ConstVect* segStrings) override;
72
73 class SegmentOverlapAction : public index::chain::MonotoneChainOverlapAction {
74 private:
76
77 // Declare type as noncopyable
78 SegmentOverlapAction(const SegmentOverlapAction& other) = delete;
79 SegmentOverlapAction& operator=(const SegmentOverlapAction& rhs) = delete;
80
81 public:
82 SegmentOverlapAction(SegmentIntersector& p_si) :
83 index::chain::MonotoneChainOverlapAction(), si(p_si)
84 {}
85
86 void overlap(index::chain::MonotoneChain& mc1, std::size_t start1,
87 index::chain::MonotoneChain& mc2, std::size_t start2) override;
88 };
89
96
97private:
98
99 typedef std::vector<std::unique_ptr<index::chain::MonotoneChain>> MonoChains;
100 MonoChains monoChains;
101
102 /*
103 * The index::SpatialIndex used should be something that supports
104 * envelope (range) queries efficiently (such as a index::quadtree::Quadtree
105 * or index::strtree::STRtree).
106 */
107 index::SpatialIndex* index;
108 int indexCounter;
109 int processCounter;
110 // statistics
111 int nOverlaps;
112
113 /* memory management helper, holds MonotoneChain objects used
114 * in the SpatialIndex. It's cleared when the SpatialIndex is
115 */
116 MonoChains chainStore;
117
118 void addToIndex(SegmentString* segStr);
119
120 void intersectChains();
121
122 void addToMonoChains(SegmentString* segStr);
123
124};
125
126} // namespace geos::noding
127} // namespace geos
128
129#endif // GEOS_NODING_MCINDEXSEGMENTSETMUTUALINTERSECTOR_H
Abstract class defines basic insertion and query operations supported by classes implementing spatial...
Definition SpatialIndex.h:47
The action for the internal iterator for performing overlap queries on a MonotoneChain.
Definition MonotoneChainOverlapAction.h:43
Monotone Chains are a way of partitioning the segments of a linestring to allow for fast searching of...
Definition index/chain/MonotoneChain.h:84
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:48
An intersector for the red-blue intersection problem.
Definition SegmentSetMutualIntersector.h:37
An interface for classes which represent a sequence of contiguous line segments.
Definition SegmentString.h:46
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:26