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