00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef GEOS_INDEX_STRTREE_SIRTREE_H
00017 #define GEOS_INDEX_STRTREE_SIRTREE_H
00018
00019 #include <geos/index/strtree/AbstractSTRtree.h>
00020 #include <geos/index/strtree/Interval.h>
00021
00022 #include <vector>
00023 #include <memory>
00024
00025 namespace geos {
00026 namespace index {
00027 namespace strtree {
00028
00040 class SIRtree: public AbstractSTRtree {
00041 using AbstractSTRtree::insert;
00042 using AbstractSTRtree::query;
00043
00044 public:
00045
00049 SIRtree();
00050
00055 SIRtree(size_t nodeCapacity);
00056
00057 virtual ~SIRtree();
00058
00059 void insert(double x1, double x2, void* item);
00060
00065 std::vector<void*>* query(double x1, double x2)
00066 {
00067 std::vector<void*>* results = new std::vector<void*>();
00068 Interval interval(std::min(x1, x2), std::max(x1, x2));
00069 AbstractSTRtree::query(&interval, *results);
00070 return results;
00071 }
00072
00076 std::vector<void*>* query(double x) { return query(x,x); }
00077
00078
00079 protected:
00080
00081 class SIRIntersectsOp:public AbstractSTRtree::IntersectsOp {
00082 public:
00083 bool intersects(const void* aBounds, const void* bBounds);
00084 };
00085
00090 std::auto_ptr<BoundableList> createParentBoundables(
00091 BoundableList* childBoundables, int newLevel);
00092
00093 AbstractNode* createNode(int level);
00094
00095 IntersectsOp* getIntersectsOp() {return intersectsOp;};
00096
00097 std::auto_ptr<BoundableList> sortBoundables(const BoundableList* input);
00098
00099 private:
00100
00101 IntersectsOp* intersectsOp;
00102 };
00103
00104
00105 }
00106 }
00107 }
00108
00109 #endif // GEOS_INDEX_STRTREE_SIRTREE_H
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120