GEOS  3.14.0dev
Bintree.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 <geos/export.h>
18 #include <vector>
19 
20 #ifdef _MSC_VER
21 #pragma warning(push)
22 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
23 #endif
24 
25 // Forward declarations
26 namespace geos {
27 namespace index {
28 namespace bintree {
29 class Interval;
30 class Root;
31 }
32 }
33 }
34 
35 namespace geos {
36 namespace index { // geos::index
37 namespace bintree { // geos::index::bintree
38 
53 class GEOS_DLL Bintree {
54 
55 public:
56 
68  static Interval* ensureExtent(const Interval* itemInterval,
69  double minExtent);
70 
71  Bintree();
72 
73  ~Bintree();
74 
75  int depth();
76 
77  int size();
78 
79  int nodeSize();
80 
87  void insert(Interval* itemInterval, void* item);
88 
89  std::vector<void*>* iterator();
90 
91  std::vector<void*>* query(double x);
92 
93  std::vector<void*>* query(Interval* interval);
94 
95  void query(Interval* interval,
96  std::vector<void*>* foundItems);
97 
98 private:
99 
100  std::vector<Interval*>newIntervals;
101 
102  Root* root;
103 
114  double minExtent;
115 
116  void collectStats(Interval* interval);
117 
118  Bintree(const Bintree&) = delete;
119  Bintree& operator=(const Bintree&) = delete;
120 };
121 
122 } // namespace geos::index::bintree
123 } // namespace geos::index
124 } // namespace geos
125 
126 #ifdef _MSC_VER
127 #pragma warning(pop)
128 #endif
129 
A BinTree (or "Binary Interval Tree") is a 1-dimensional version of a quadtree.
Definition: Bintree.h:53
static Interval * ensureExtent(const Interval *itemInterval, double minExtent)
Ensure that the Interval for the inserted item has non-zero extents.
void insert(Interval *itemInterval, void *item)
Represents an (1-dimensional) closed interval on the Real number line.
Definition: bintree/Interval.h:24
The root node of a single Bintree.
Definition: bintree/Root.h:40
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25