GEOS  3.8.0dev
SortedPackedIntervalRTree.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 
16 #ifndef GEOS_INDEX_INTERVALRTREE_SORTEDPACKEDINTERVALRTREE_H
17 #define GEOS_INDEX_INTERVALRTREE_SORTEDPACKEDINTERVALRTREE_H
18 
19 #include <geos/index/intervalrtree/IntervalRTreeNode.h>
20 #include <geos/index/intervalrtree/IntervalRTreeBranchNode.h>
21 #include <geos/index/intervalrtree/IntervalRTreeLeafNode.h>
22 
23 // forward declarations
24 namespace geos {
25 namespace index {
26 class ItemVisitor;
27 }
28 }
29 
30 namespace geos {
31 namespace index {
32 namespace intervalrtree {
33 
52 private:
53  std::vector<IntervalRTreeLeafNode> leaves;
54  std::vector<IntervalRTreeBranchNode> branches;
55  const IntervalRTreeNode* root = nullptr;
56  int level = 0;
57 
58  void init();
59  void buildLevel(IntervalRTreeNode::ConstVect& src, IntervalRTreeNode::ConstVect& dest);
60  const IntervalRTreeNode* buildTree();
61 
62 protected:
63 public:
65 
66  SortedPackedIntervalRTree(std::size_t initialCapacity)
67  {
68  leaves.reserve(initialCapacity);
69  }
70 
80  void insert(double min, double max, void* item);
81 
90  void query(double min, double max, index::ItemVisitor* visitor);
91 
92 };
93 
94 } // geos::intervalrtree
95 } // geos::index
96 } // geos
97 
98 #endif // GEOS_INDEX_INTERVALRTREE_SORTEDPACKEDINTERVALRTREE_H
99 
void insert(double min, double max, void *item)
A static index on a set of 1-dimensional intervals, using an R-Tree packed based on the order of the ...
Definition: SortedPackedIntervalRTree.h:51
void query(double min, double max, index::ItemVisitor *visitor)
A visitor for items in an index.
Definition: ItemVisitor.h:29
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25