GEOS  3.8.0dev
index/bintree/Node.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 #ifndef GEOS_IDX_BINTREE_NODE_H
16 #define GEOS_IDX_BINTREE_NODE_H
17 
18 #include <geos/export.h>
19 #include <geos/index/bintree/NodeBase.h> // for inheritance
20 
21 // Forward declarations
22 namespace geos {
23 namespace index {
24 namespace bintree {
25 class Interval;
26 }
27 }
28 }
29 
30 namespace geos {
31 namespace index { // geos::index
32 namespace bintree { // geos::index::bintree
33 
35 class GEOS_DLL Node: public NodeBase {
36 
37 public:
38 
39  static Node* createNode(Interval* itemInterval);
40 
41  static Node* createExpanded(Node* node, Interval* addInterval);
42 
43  Node(Interval* newInterval, int newLevel);
44 
45  ~Node() override;
46 
47  Interval* getInterval();
48 
49  Node* getNode(Interval* searchInterval);
50 
51  NodeBase* find(Interval* searchInterval);
52 
53  void insert(Node* node);
54 
55 private:
56 
57  Interval* interval;
58 
59  double centre;
60 
61  int level;
62 
63  Node* getSubnode(int index);
64 
65  Node* createSubnode(int index);
66 
67 protected:
68 
69  bool isSearchMatch(Interval* itemInterval) override;
70 };
71 
72 } // namespace geos::index::bintree
73 } // namespace geos::index
74 } // namespace geos
75 
76 #endif // GEOS_IDX_BINTREE_NODE_H
77 
Represents an (1-dimensional) closed interval on the Real number line.
Definition: bintree/Interval.h:25
The base class for nodes in a Bintree.
Definition: bintree/NodeBase.h:36
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
A node of a Bintree.
Definition: index/bintree/Node.h:35