00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef GEOS_IDX_QUADTREE_QUADTREE_H
00021 #define GEOS_IDX_QUADTREE_QUADTREE_H
00022
00023 #include <geos/export.h>
00024 #include <geos/index/SpatialIndex.h>
00025 #include <geos/index/quadtree/Root.h>
00026
00027 #include <vector>
00028 #include <string>
00029
00030
00031 namespace geos {
00032 namespace geom {
00033 class Envelope;
00034 }
00035 namespace index {
00036 namespace quadtree {
00037
00038 }
00039 }
00040 }
00041
00042 namespace geos {
00043 namespace index {
00044 namespace quadtree {
00045
00068 class GEOS_DLL Quadtree: public SpatialIndex {
00069
00070 private:
00071
00072 std::vector<geom::Envelope *> newEnvelopes;
00073
00074 void collectStats(const geom::Envelope& itemEnv);
00075
00076 Root root;
00077
00089 double minExtent;
00090
00091 public:
00099 static geom::Envelope* ensureExtent(const geom::Envelope *itemEnv,
00100 double minExtent);
00101
00106 Quadtree()
00107 :
00108 root(),
00109 minExtent(1.0)
00110 {}
00111
00112 ~Quadtree();
00113
00115 int depth();
00116
00118 int size();
00119
00120 void insert(const geom::Envelope *itemEnv, void *item);
00121
00139 void query(const geom::Envelope *searchEnv, std::vector<void*>& ret);
00140
00141
00158 void query(const geom::Envelope *searchEnv, ItemVisitor& visitor)
00159 {
00160
00161
00162
00163
00164 root.visit(searchEnv, visitor);
00165 }
00166
00174 bool remove(const geom::Envelope* itemEnv, void* item);
00175
00177 std::vector<void*>* queryAll();
00178
00179 std::string toString() const;
00180
00181 };
00182
00183
00184 }
00185 }
00186 }
00187
00188 #endif // GEOS_IDX_QUADTREE_QUADTREE_H
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199