GEOS 3.8.1
MCIndexNoder.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 * 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/STRtree.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
40namespace geos {
41namespace geom {
42class LineSegment;
43}
44namespace noding {
45class SegmentString;
46class SegmentIntersector;
47}
48}
49
50namespace geos {
51namespace noding { // geos.noding
52
64class GEOS_DLL MCIndexNoder : public SinglePassNoder {
65
66private:
67 std::vector<index::chain::MonotoneChain*> monoChains;
69 int idCounter;
70 std::vector<SegmentString*>* nodedSegStrings;
71 // statistics
72 int nOverlaps;
73
74 void intersectChains();
75
76 void add(SegmentString* segStr);
77
78public:
79
80 MCIndexNoder(SegmentIntersector* nSegInt = nullptr)
81 :
82 SinglePassNoder(nSegInt),
83 idCounter(0),
84 nodedSegStrings(nullptr),
85 nOverlaps(0)
86 {}
87
88 ~MCIndexNoder() override;
89
91 std::vector<index::chain::MonotoneChain*>&
93 {
94 return monoChains;
95 }
96
97 index::SpatialIndex& getIndex();
98
99 std::vector<SegmentString*>* getNodedSubstrings() const override;
100
101 void computeNodes(std::vector<SegmentString*>* inputSegmentStrings) override;
102
103 class SegmentOverlapAction : public index::chain::MonotoneChainOverlapAction {
104 public:
105 SegmentOverlapAction(SegmentIntersector& newSi)
106 :
107 index::chain::MonotoneChainOverlapAction(),
108 si(newSi)
109 {}
110
111 void overlap(index::chain::MonotoneChain& mc1, std::size_t start1,
112 index::chain::MonotoneChain& mc2, std::size_t start2) override;
113 private:
115
116 // Declare type as noncopyable
117 SegmentOverlapAction(const SegmentOverlapAction& other) = delete;
118 SegmentOverlapAction& operator=(const SegmentOverlapAction& rhs) = delete;
119 };
120
121};
122
123} // namespace geos.noding
124} // namespace geos
125
126#ifdef _MSC_VER
127#pragma warning(pop)
128#endif
129
130#ifdef GEOS_INLINE
131# include <geos/noding/MCIndexNoder.inl>
132#endif
133
134#endif // GEOS_NODING_MCINDEXNODER_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
A query-only R-tree created using the Sort-Tile-Recursive (STR) algorithm. For two-dimensional spatia...
Definition: STRtree.h:64
Nodes a set of SegmentString using a index based on MonotoneChain and a SpatialIndex.
Definition: MCIndexNoder.h:64
void computeNodes(std::vector< SegmentString * > *inputSegmentStrings) override
Computes the noding for a collection of SegmentStrings.
std::vector< index::chain::MonotoneChain * > & getMonotoneChains()
Return a reference to this instance's std::vector of MonotoneChains.
Definition: MCIndexNoder.h:92
std::vector< SegmentString * > * getNodedSubstrings() const override
Returns a Collection of fully noded SegmentStrings.
Processes possible intersections detected by a Noder.
Definition: noding/SegmentIntersector.h:48
An interface for classes which represent a sequence of contiguous line segments.
Definition: SegmentString.h:46
Base class for Noders which make a single pass to find intersections.
Definition: SinglePassNoder.h:51
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25