GEOS  3.6.2
Key.h
00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2009  Sandro Santilli <strk@keybit.net>
00007  * Copyright (C) 2006 Refractions Research Inc.
00008  * Copyright (C) 2001-2002 Vivid Solutions Inc.
00009  *
00010  * This is free software; you can redistribute and/or modify it under
00011  * the terms of the GNU Lesser General Public Licence as published
00012  * by the Free Software Foundation. 
00013  * See the COPYING file for more information.
00014  *
00015  **********************************************************************
00016  *
00017  * Last port: index/quadtree/Key.java rev 1.8 (JTS-1.10)
00018  *
00019  **********************************************************************/
00020 
00021 #ifndef GEOS_IDX_QUADTREE_KEY_H
00022 #define GEOS_IDX_QUADTREE_KEY_H
00023 
00024 #include <geos/export.h>
00025 #include <geos/geom/Coordinate.h> // for composition
00026 #include <geos/geom/Envelope.h> // for composition
00027 
00028 // Forward declarations
00029 // ...
00030 
00031 namespace geos {
00032 namespace index { // geos::index
00033 namespace quadtree { // geos::index::quadtree
00034 
00042 class GEOS_DLL Key {
00043 public:
00044 
00045         // Doesn't touch the Envelope, might as well be const
00046         static int computeQuadLevel(const geom::Envelope& env);
00047 
00048         // Reference to argument won't be used after construction
00049         Key(const geom::Envelope& itemEnv);
00050 
00051         // used to be virtual, but I don't see subclasses...
00052         ~Key();
00053 
00055         const geom::Coordinate& getPoint() const;
00056 
00057         int getLevel() const;
00058 
00060         const geom::Envelope& getEnvelope() const;
00061 
00063         geom::Coordinate* getCentre() const;
00064 
00069         void computeKey(const geom::Envelope& itemEnv);
00070 
00071 private:        
00072         // the fields which make up the key
00073 
00074         // Owned by this class
00075         geom::Coordinate pt;
00076 
00077         int level;
00078 
00079         // auxiliary data which is derived from the key for use in computation
00080         geom::Envelope env;
00081 
00082         void computeKey(int level, const geom::Envelope& itemEnv);
00083 };
00084 
00085 } // namespace geos::index::quadtree
00086 } // namespace geos::index
00087 } // namespace geos
00088 
00089 #endif // GEOS_IDX_QUADTREE_KEY_H