GEOS 3.9.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#ifndef GEOS_IDX_QUADTREE_KEY_H
22#define GEOS_IDX_QUADTREE_KEY_H
23
24#include <geos/export.h>
25#include <geos/geom/Coordinate.h> // for composition
26#include <geos/geom/Envelope.h> // for composition
27
28// Forward declarations
29// ...
30
31namespace geos {
32namespace index { // geos::index
33namespace quadtree { // geos::index::quadtree
34
42class GEOS_DLL Key {
43public:
44
45 // Doesn't touch the Envelope, might as well be const
46 static int computeQuadLevel(const geom::Envelope& env);
47
48 // Reference to argument won't be used after construction
49 Key(const geom::Envelope& itemEnv);
50
51 // used to be virtual, but I don't see subclasses...
52 ~Key() = default;
53
55 const geom::Coordinate& getPoint() const;
56
57 int getLevel() const;
58
61
64
69 void computeKey(const geom::Envelope& itemEnv);
70
71private:
72 // the fields which make up the key
73
74 // Owned by this class
76
77 int level;
78
79 // auxiliary data which is derived from the key for use in computation
81
82 void computeKey(int level, const geom::Envelope& itemEnv);
83};
84
85} // namespace geos::index::quadtree
86} // namespace geos::index
87} // namespace geos
88
89#endif // GEOS_IDX_QUADTREE_KEY_H
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:60
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:42
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 IndexedNestedRingTester.h:26