GEOS 3.11.1
quadtree/Key.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2009 Sandro Santilli <strk@kbt.io>
7 * Copyright (C) 2006 Refractions Research Inc.
8 * Copyright (C) 2001-2002 Vivid Solutions Inc.
9 *
10 * This is free software; you can redistribute and/or modify it under
11 * the terms of the GNU Lesser General Public Licence as published
12 * by the Free Software Foundation.
13 * See the COPYING file for more information.
14 *
15 **********************************************************************
16 *
17 * Last port: index/quadtree/Key.java rev 1.8 (JTS-1.10)
18 *
19 **********************************************************************/
20
21#pragma once
22
23#include <geos/export.h>
24#include <geos/geom/Coordinate.h> // for composition
25#include <geos/geom/Envelope.h> // for composition
26
27// Forward declarations
28// ...
29
30namespace geos {
31namespace index { // geos::index
32namespace quadtree { // geos::index::quadtree
33
41class GEOS_DLL Key {
42public:
43
44 // Doesn't touch the Envelope, might as well be const
45 static int computeQuadLevel(const geom::Envelope& env);
46
47 // Reference to argument won't be used after construction
48 Key(const geom::Envelope& itemEnv);
49
50 // used to be virtual, but I don't see subclasses...
51 ~Key() = default;
52
54 const geom::Coordinate& getPoint() const;
55
56 int getLevel() const;
57
60
63
68 void computeKey(const geom::Envelope& itemEnv);
69
70private:
71 // the fields which make up the key
72
73 // Owned by this class
75
76 int level;
77
78 // auxiliary data which is derived from the key for use in computation
80
81 void computeKey(int level, const geom::Envelope& itemEnv);
82};
83
84} // namespace geos::index::quadtree
85} // namespace geos::index
86} // namespace geos
87
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:58
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:58
A Key is a unique identifier for a node in a quadtree.
Definition: quadtree/Key.h:41
const geom::Envelope & getEnvelope() const
Returned object ownership retained by this class.
void computeKey(const geom::Envelope &itemEnv)
geom::Coordinate * getCentre() const
Returns newly allocated object (ownership transferred)
const geom::Coordinate & getPoint() const
Returned object ownership retained by this class.
Basic namespace for all GEOS functionalities.
Definition: geos.h:39