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