GEOS 3.6.2
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 {
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;
40 }
41}
42
43//using namespace geos::index::strtree;
44
45namespace geos {
46namespace noding { // geos::noding
47
54class MCIndexSegmentSetMutualIntersector : public SegmentSetMutualIntersector
55{
56public:
57
58 MCIndexSegmentSetMutualIntersector();
59
60 ~MCIndexSegmentSetMutualIntersector();
61
62 /* Returns a reference to a vector of MonotoneChain objects owned
63 * by this class and destroyed on next call to ::process.
64 * Copy them if you need them alive for longer.
65 */
66 std::vector<index::chain::MonotoneChain *>& getMonotoneChains()
67 {
68 return monoChains;
69 }
70
71 index::SpatialIndex* getIndex()
72 {
73 return index;
74 }
75
76 void setBaseSegments(SegmentString::ConstVect* segStrings);
77
78 // NOTE: re-populates the MonotoneChain vector with newly created chains
79 void process(SegmentString::ConstVect* segStrings);
80
81 class SegmentOverlapAction : public index::chain::MonotoneChainOverlapAction
82 {
83 private:
85
86 // Declare type as noncopyable
87 SegmentOverlapAction(const SegmentOverlapAction& other);
88 SegmentOverlapAction& operator=(const SegmentOverlapAction& rhs);
89
90 public:
91 SegmentOverlapAction(SegmentIntersector & si) :
92 index::chain::MonotoneChainOverlapAction(), si(si)
93 {}
94
95 void overlap(index::chain::MonotoneChain& mc1, std::size_t start1,
96 index::chain::MonotoneChain& mc2, std::size_t start2);
97 };
98
99private:
100
101 typedef std::vector<index::chain::MonotoneChain *> MonoChains;
102 MonoChains monoChains;
103
104 /*
105 * The {@link SpatialIndex} used should be something that supports
106 * envelope (range) queries efficiently (such as a {@link Quadtree}
107 * or {@link STRtree}.
108 */
110 int indexCounter;
111 int processCounter;
112 // statistics
113 int nOverlaps;
114
115 /* memory management helper, holds MonotoneChain objects used
116 * in the SpatialIndex. It's cleared when the SpatialIndex is
117 */
118 MonoChains chainStore;
119
120 void addToIndex( SegmentString * segStr);
121
122 void intersectChains();
123
124 void addToMonoChains( SegmentString * segStr);
125
126};
127
128} // namespace geos::noding
129} // namespace geos
130
131#endif // GEOS_NODING_MCINDEXSEGMENTSETMUTUALINTERSECTOR_H
Abstract class defines basic insertion and query operations supported by classes implementing spatial...
Definition SpatialIndex.h:47
Definition MonotoneChainOverlapAction.h:44
Monotone Chains are a way of partitioning the segments of a linestring to allow for fast searching of...
Definition index/chain/MonotoneChain.h:86
void process(SegmentString::ConstVect *segStrings)
void setBaseSegments(SegmentString::ConstVect *segStrings)
Processes possible intersections detected by a Noder.
Definition noding/SegmentIntersector.h:47
An interface for classes which represent a sequence of contiguous line segments.
Definition SegmentString.h:46
Contains classes that implement Monotone Chains.
Definition MCPointInRing.h:41
Contains 2-D and 1-D versions of the Sort-Tile-Recursive (STR) tree, a query-only R-tree.
Definition SIRtreePointInRing.h:32
Provides classes for various kinds of spatial indexes.
Definition IndexedNestedRingTester.h:31
Classes to compute nodings for arrangements of line segments and line segment sequences.
Definition PreparedLineString.h:27
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25