GEOS  3.9.1dev
MCIndexSegmentSetMutualIntersector.h
Go to the documentation of this file.
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
25 
26 namespace geos {
27 namespace index {
28 class SpatialIndex;
29 
30 namespace chain {
31 class MonotoneChain;
32 }
33 namespace strtree {
34 //class STRtree;
35 }
36 }
37 namespace noding {
38 class SegmentString;
39 class SegmentIntersector;
40 }
41 }
42 
43 //using namespace geos::index::strtree;
44 
45 namespace geos {
46 namespace noding { // geos::noding
47 
56 public:
57 
59 
61 
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 
74  private:
76 
77  // Declare type as noncopyable
78  SegmentOverlapAction(const SegmentOverlapAction& other) = delete;
79  SegmentOverlapAction& operator=(const SegmentOverlapAction& rhs) = delete;
80 
81  public:
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 
97 private:
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  */
110  // statistics
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
An interface for classes which represent a sequence of contiguous line segments.
Definition: SegmentString.h:46
The action for the internal iterator for performing overlap queries on a MonotoneChain.
Abstract class defines basic insertion and query operations supported by classes implementing spatial...
Definition: SpatialIndex.h:47
std::vector< const SegmentString * > ConstVect
Definition: SegmentString.h:48
Intersects two sets of SegmentStrings using a index based on MonotoneChains and a SpatialIndex...
std::vector< std::unique_ptr< index::chain::MonotoneChain > > MonoChains
Basic namespace for all GEOS functionalities.
Processes possible intersections detected by a Noder.
An intersector for the red-blue intersection problem.
Monotone Chains are a way of partitioning the segments of a linestring to allow for fast searching of...