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