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