00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef GEOS_IDX_QUADTREE_QUADTREE_H
00020 #define GEOS_IDX_QUADTREE_QUADTREE_H
00021
00022 #include <geos/export.h>
00023 #include <geos/index/SpatialIndex.h>
00024 #include <geos/index/quadtree/Root.h>
00025
00026 #include <vector>
00027 #include <string>
00028
00029 #ifdef _MSC_VER
00030 #pragma warning(push)
00031 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00032 #endif
00033
00034
00035 namespace geos {
00036 namespace geom {
00037 class Envelope;
00038 }
00039 namespace index {
00040 namespace quadtree {
00041
00042 }
00043 }
00044 }
00045
00046 namespace geos {
00047 namespace index {
00048 namespace quadtree {
00049
00072 class GEOS_DLL Quadtree: public SpatialIndex {
00073
00074 private:
00075
00076 std::vector<geom::Envelope *> newEnvelopes;
00077
00078 void collectStats(const geom::Envelope& itemEnv);
00079
00080 Root root;
00081
00093 double minExtent;
00094
00095 public:
00103 static geom::Envelope* ensureExtent(const geom::Envelope *itemEnv,
00104 double minExtent);
00105
00110 Quadtree()
00111 :
00112 root(),
00113 minExtent(1.0)
00114 {}
00115
00116 ~Quadtree();
00117
00119 int depth();
00120
00122 int size();
00123
00124 void insert(const geom::Envelope *itemEnv, void *item);
00125
00143 void query(const geom::Envelope *searchEnv, std::vector<void*>& ret);
00144
00145
00162 void query(const geom::Envelope *searchEnv, ItemVisitor& visitor)
00163 {
00164
00165
00166
00167
00168 root.visit(searchEnv, visitor);
00169 }
00170
00178 bool remove(const geom::Envelope* itemEnv, void* item);
00179
00181 std::vector<void*>* queryAll();
00182
00183 std::string toString() const;
00184
00185 };
00186
00187 }
00188 }
00189 }
00190
00191 #ifdef _MSC_VER
00192 #pragma warning(pop)
00193 #endif
00194
00195 #endif // GEOS_IDX_QUADTREE_QUADTREE_H