GEOS  3.9.1dev
MCIndexNoder.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  * Last port: noding/MCIndexNoder.java rev. 1.6 (JTS-1.9)
16  *
17  **********************************************************************/
18 
19 #ifndef GEOS_NODING_MCINDEXNODER_H
20 #define GEOS_NODING_MCINDEXNODER_H
21 
22 #include <geos/export.h>
23 
24 #include <geos/inline.h>
25 
26 #include <geos/index/chain/MonotoneChainOverlapAction.h> // for inheritance
27 #include <geos/noding/SinglePassNoder.h> // for inheritance
28 #include <geos/index/strtree/SimpleSTRtree.h> // for composition
29 #include <geos/util.h>
30 
31 #include <vector>
32 #include <iostream>
33 
34 #ifdef _MSC_VER
35 #pragma warning(push)
36 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
37 #endif
38 
39 // Forward declarations
40 namespace geos {
41 namespace geom {
42 class LineSegment;
43 class Envelope;
44 }
45 namespace noding {
46 class SegmentString;
47 class SegmentIntersector;
48 }
49 }
50 
51 namespace geos {
52 namespace noding { // geos.noding
53 
66 
67 private:
68  std::vector<index::chain::MonotoneChain*> monoChains;
70  int idCounter;
71  std::vector<SegmentString*>* nodedSegStrings;
72  // statistics
73  int nOverlaps;
75 
76  void intersectChains();
77 
78  void add(SegmentString* segStr);
79 
80 public:
81 
82  MCIndexNoder(SegmentIntersector* nSegInt = nullptr, double p_overlapTolerance = 0.0)
83  :
84  SinglePassNoder(nSegInt),
85  idCounter(0),
86  nodedSegStrings(nullptr),
87  nOverlaps(0),
88  overlapTolerance(p_overlapTolerance)
89  {}
90 
91  ~MCIndexNoder() override;
92 
94  std::vector<index::chain::MonotoneChain*>&
96  {
97  return monoChains;
98  }
99 
100  index::SpatialIndex& getIndex();
101 
102  std::vector<SegmentString*>* getNodedSubstrings() const override;
103 
104  void computeNodes(std::vector<SegmentString*>* inputSegmentStrings) override;
105 
107  public:
109  :
110  index::chain::MonotoneChainOverlapAction(),
111  si(newSi)
112  {}
113 
114  void overlap(index::chain::MonotoneChain& mc1, std::size_t start1,
115  index::chain::MonotoneChain& mc2, std::size_t start2) override;
116  private:
118 
119  // Declare type as noncopyable
120  SegmentOverlapAction(const SegmentOverlapAction& other) = delete;
121  SegmentOverlapAction& operator=(const SegmentOverlapAction& rhs) = delete;
122  };
123 
124 };
125 
126 } // namespace geos.noding
127 } // namespace geos
128 
129 #ifdef _MSC_VER
130 #pragma warning(pop)
131 #endif
132 
133 #ifdef GEOS_INLINE
134 # include <geos/noding/MCIndexNoder.inl>
135 #endif
136 
137 #endif // GEOS_NODING_MCINDEXNODER_H
#define GEOS_DLL
Definition: export.h:28
An interface for classes which represent a sequence of contiguous line segments.
Definition: SegmentString.h:46
A query-only R-tree created using the Sort-Tile-Recursive (STR) algorithm. For two-dimensional spatia...
Definition: SimpleSTRtree.h:65
MCIndexNoder(SegmentIntersector *nSegInt=nullptr, double p_overlapTolerance=0.0)
Definition: MCIndexNoder.h:82
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
SegmentOverlapAction(SegmentIntersector &newSi)
Definition: MCIndexNoder.h:108
Base class for Noders which make a single pass to find intersections.
Basic namespace for all GEOS functionalities.
Processes possible intersections detected by a Noder.
Monotone Chains are a way of partitioning the segments of a linestring to allow for fast searching of...
Nodes a set of SegmentString using a index based on MonotoneChain and a SpatialIndex.
Definition: MCIndexNoder.h:65
std::vector< index::chain::MonotoneChain * > monoChains
Definition: MCIndexNoder.h:68
index::strtree::SimpleSTRtree index
Definition: MCIndexNoder.h:69
std::vector< index::chain::MonotoneChain * > & getMonotoneChains()
Return a reference to this instance&#39;s std::vector of MonotoneChains.
Definition: MCIndexNoder.h:95
std::vector< SegmentString * > * nodedSegStrings
Definition: MCIndexNoder.h:71