GEOS  3.14.0dev
SweepLineIndex.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 #pragma once
16 
17 #include <vector>
18 #include <geos/export.h>
19 
20 
21 #ifdef _MSC_VER
22 #pragma warning(push)
23 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
24 #endif
25 
26 // Forward declarations
27 namespace geos {
28 namespace index {
29 namespace sweepline {
30 class SweepLineInterval;
31 class SweepLineEvent;
32 class SweepLineOverlapAction;
33 }
34 }
35 }
36 
37 namespace geos {
38 namespace index { // geos.index
39 namespace sweepline { // geos:index:sweepline
40 
46 class GEOS_DLL SweepLineIndex {
47 
48 public:
49 
51 
52  ~SweepLineIndex();
53 
54  void add(SweepLineInterval* sweepInt);
55 
56  void computeOverlaps(SweepLineOverlapAction* action);
57 
58 private:
59 
60  // FIXME: make it a real vector rather then a pointer
61  std::vector<SweepLineEvent*> events;
62 
63  bool indexBuilt;
64 
65  // statistics information
66  int nOverlaps;
67 
73  void buildIndex();
74 
75  void processOverlaps(std::size_t start, std::size_t end,
76  SweepLineInterval* s0,
77  SweepLineOverlapAction* action);
78 };
79 
80 } // namespace geos:index:sweepline
81 } // namespace geos:index
82 } // namespace geos
83 
84 #ifdef _MSC_VER
85 #pragma warning(pop)
86 #endif
87 
A sweepline implements a sorted index on a set of intervals.
Definition: SweepLineIndex.h:46
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25