GEOS  3.3.3
quadtree/Key.h
1 /**********************************************************************
2  * $Id: Key.h 2556 2009-06-06 22:22:28Z strk $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2009 Sandro Santilli <strk@keybit.net>
8  * Copyright (C) 2006 Refractions Research Inc.
9  * Copyright (C) 2001-2002 Vivid Solutions Inc.
10  *
11  * This is free software; you can redistribute and/or modify it under
12  * the terms of the GNU Lesser General Public Licence as published
13  * by the Free Software Foundation.
14  * See the COPYING file for more information.
15  *
16  **********************************************************************
17  *
18  * Last port: index/quadtree/Key.java rev 1.8 (JTS-1.10)
19  *
20  **********************************************************************/
21 
22 #ifndef GEOS_IDX_QUADTREE_KEY_H
23 #define GEOS_IDX_QUADTREE_KEY_H
24 
25 #include <geos/export.h>
26 #include <geos/geom/Coordinate.h> // for composition
27 #include <geos/geom/Envelope.h> // for composition
28 
29 // Forward declarations
30 // ...
31 
32 namespace geos {
33 namespace index { // geos::index
34 namespace quadtree { // geos::index::quadtree
35 
43 class GEOS_DLL Key {
44 public:
45 
46  // Doesn't touch the Envelope, might as well be const
47  static int computeQuadLevel(const geom::Envelope& env);
48 
49  // Reference to argument won't be used after construction
50  Key(const geom::Envelope& itemEnv);
51 
52  // used to be virtual, but I don't see subclasses...
53  ~Key();
54 
56  const geom::Coordinate& getPoint() const;
57 
58  int getLevel() const;
59 
61  const geom::Envelope& getEnvelope() const;
62 
64  geom::Coordinate* getCentre() const;
65 
70  void computeKey(const geom::Envelope& itemEnv);
71 
72 private:
73  // the fields which make up the key
74 
75  // Owned by this class
77 
78  int level;
79 
80  // auxiliary data which is derived from the key for use in computation
81  geom::Envelope env;
82 
83  void computeKey(int level, const geom::Envelope& itemEnv);
84 };
85 
86 } // namespace geos::index::quadtree
87 } // namespace geos::index
88 } // namespace geos
89 
90 #endif // GEOS_IDX_QUADTREE_KEY_H
91 
92 /**********************************************************************
93  * $Log$
94  * Revision 1.1 2006/03/22 12:22:50 strk
95  * indexQuadtree.h split
96  *
97  **********************************************************************/
98