GEOS 3.9.1
SimpleMCSweepLineIntersector.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2005-2006 Refractions Research Inc.
7 * Copyright (C) 2001-2002 Vivid Solutions Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************/
15
16#ifndef GEOS_GEOMGRAPH_INDEX_SIMPLEMCSWEEPLINEINTERSECTOR_H
17#define GEOS_GEOMGRAPH_INDEX_SIMPLEMCSWEEPLINEINTERSECTOR_H
18
19#include <geos/export.h>
20#include <memory>
21#include <vector>
22
23#include <geos/geomgraph/index/EdgeSetIntersector.h> // for inheritance
24#include <geos/geomgraph/index/SegmentIntersector.h>
25#include <geos/geomgraph/index/SweepLineEvent.h>
26#include <geos/geomgraph/index/MonotoneChain.h>
27
28#ifdef _MSC_VER
29#pragma warning(push)
30#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
31#endif
32
33// Forward declarations
34namespace geos {
35namespace geomgraph {
36class Edge;
37}
38}
39
40namespace geos {
41namespace geomgraph { // geos::geomgraph
42namespace index { // geos::geomgraph::index
43
54
55public:
56
58
59 ~SimpleMCSweepLineIntersector() override = default;
60
61 void computeIntersections(std::vector<Edge*>* edges,
62 SegmentIntersector* si, bool testAllSegments) override;
63
64 void computeIntersections(std::vector<Edge*>* edges0,
65 std::vector<Edge*>* edges1,
66 SegmentIntersector* si) override;
67
68protected:
69
70 // SweepLineEvents need to refer to each other, and to MonotoneChains.
71 // To avoid individually heap-allocating all of these, we store them
72 // in deques so that subsequent inserts preserve addresses. However,
73 // we also need to sort the SweepLineEvents after they have all been
74 // inserted, so we keep a pointer to each event in a separate vector,
75 // which can be freely reordered without breaking linkages.
76 std::vector<SweepLineEvent*> events;
77 std::deque<SweepLineEvent> eventStore;
78 std::deque<MonotoneChain> chains;
79
80 // statistics information
81 int nOverlaps;
82
83private:
84 void add(std::vector<Edge*>* edges);
85
86 void add(std::vector<Edge*>* edges, void* edgeSet);
87
88 void add(Edge* edge, void* edgeSet);
89
90 void prepareEvents();
91
92 void computeIntersections(SegmentIntersector* si);
93
94 void processOverlaps(size_t start, size_t end,
95 SweepLineEvent* ev0,
97 // Declare type as noncopyable
99 SimpleMCSweepLineIntersector& operator=(const SimpleMCSweepLineIntersector& rhs) = delete;
100};
101
102} // namespace geos.geomgraph.index
103} // namespace geos.geomgraph
104} // namespace geos
105
106#ifdef _MSC_VER
107#pragma warning(pop)
108#endif
109
110#endif // GEOS_GEOMGRAPH_INDEX_SIMPLEMCSWEEPLINEINTERSECTOR_H
111
Definition geomgraph/Edge.h:66
An EdgeSetIntersector computes all the intersections between the edges in the set.
Definition EdgeSetIntersector.h:41
Computes the intersection of line segments, and adds the intersection to the edges containing the seg...
Definition geomgraph/index/SegmentIntersector.h:47
Finds all intersections in one or two sets of edges, using an x-axis sweepline algorithm in conjuncti...
Definition SimpleMCSweepLineIntersector.h:53
void computeIntersections(std::vector< Edge * > *edges, SegmentIntersector *si, bool testAllSegments) override
Computes all self-intersections between edges in a set of edges, allowing client to choose whether se...
void computeIntersections(std::vector< Edge * > *edges0, std::vector< Edge * > *edges1, SegmentIntersector *si) override
Computes all mutual intersections between two sets of edges.
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:26