GEOS 3.11.1
KdNode.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2020 Paul Ramsey <pramsey@cleverelephant.ca>
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 * Last port: index/kdtree/Node.java rev 1.8 (JTS-1.10)
16 *
17 **********************************************************************/
18
19#pragma once
20
21#include <geos/geom/Coordinate.h> // for composition
22
23namespace geos {
24namespace index { // geos::index
25namespace kdtree { // geos::index::kdtree
26
30class GEOS_DLL KdNode {
31
32private:
33
35 void* data;
36 KdNode* left;
37 KdNode* right;
38 std::size_t count;
39
40public:
41
42 KdNode(double p_x, double p_y, void* p_data);
43 KdNode(const geom::Coordinate& p_p, void* p_data);
44
45 double getX() { return p.x; }
46 double getY() { return p.y; }
47 const geom::Coordinate& getCoordinate() { return p; }
48 void* getData() { return data; }
49 KdNode* getLeft() { return left; }
50 KdNode* getRight() { return right; }
51 void increment() { count++; }
52 std::size_t getCount() { return count; }
53 bool isRepeated() { return count > 1; }
54 void setLeft(KdNode* p_left) { left = p_left; }
55 void setRight(KdNode* p_right) { right = p_right; }
56
57};
58
59} // namespace geos::index::kdtree
60} // namespace geos::index
61} // namespace geos
62
63
64
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:58
double y
y-coordinate
Definition: Coordinate.h:81
double x
x-coordinate
Definition: Coordinate.h:78
Definition: KdNode.h:30
Basic namespace for all GEOS functionalities.
Definition: geos.h:39