GEOS 3.4.2

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

quadtree/Key.h
1 /**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2009 Sandro Santilli <strk@keybit.net>
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
31 namespace geos {
32 namespace index { // geos::index
33 namespace quadtree { // geos::index::quadtree
34
42 class GEOS_DLL Key {
43 public:
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();
53
55 const geom::Coordinate& getPoint() const;
56
57 int getLevel() const;
58
60 const geom::Envelope& getEnvelope() const;
61
63 geom::Coordinate* getCentre() const;
64
69 void computeKey(const geom::Envelope& itemEnv);
70
71 private:
72 // the fields which make up the key
73
74 // Owned by this class
75 geom::Coordinate pt;
76
77 int level;
78
79 // auxiliary data which is derived from the key for use in computation
80 geom::Envelope env;
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