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 #ifdef _MSC_VER
00031 #pragma warning(push)
00032 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00033 #endif
00034
00035
00036 namespace geos {
00037 namespace geom {
00038 class Envelope;
00039 }
00040 namespace index {
00041 namespace quadtree {
00042
00043 }
00044 }
00045 }
00046
00047 namespace geos {
00048 namespace index {
00049 namespace quadtree {
00050
00073 class GEOS_DLL Quadtree: public SpatialIndex {
00074
00075 private:
00076
00077 std::vector<geom::Envelope *> newEnvelopes;
00078
00079 void collectStats(const geom::Envelope& itemEnv);
00080
00081 Root root;
00082
00094 double minExtent;
00095
00096 public:
00104 static geom::Envelope* ensureExtent(const geom::Envelope *itemEnv,
00105 double minExtent);
00106
00111 Quadtree()
00112 :
00113 root(),
00114 minExtent(1.0)
00115 {}
00116
00117 ~Quadtree();
00118
00120 int depth();
00121
00123 int size();
00124
00125 void insert(const geom::Envelope *itemEnv, void *item);
00126
00144 void query(const geom::Envelope *searchEnv, std::vector<void*>& ret);
00145
00146
00163 void query(const geom::Envelope *searchEnv, ItemVisitor& visitor)
00164 {
00165
00166
00167
00168
00169 root.visit(searchEnv, visitor);
00170 }
00171
00179 bool remove(const geom::Envelope* itemEnv, void* item);
00180
00182 std::vector<void*>* queryAll();
00183
00184 std::string toString() const;
00185
00186 };
00187
00188 }
00189 }
00190 }
00191
00192 #ifdef _MSC_VER
00193 #pragma warning(pop)
00194 #endif
00195
00196 #endif // GEOS_IDX_QUADTREE_QUADTREE_H
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207