GEOS
3.6.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2006 Refractions Research Inc. 00007 * 00008 * This is free software; you can redistribute and/or modify it under 00009 * the terms of the GNU Lesser General Public Licence as published 00010 * by the Free Software Foundation. 00011 * See the COPYING file for more information. 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> // for inheritance 00021 #include <geos/index/strtree/Interval.h> // for inline 00022 00023 #include <vector> 00024 #include <memory> 00025 00026 namespace geos { 00027 namespace index { // geos::index 00028 namespace strtree { // geos::index::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 } // namespace geos::index::strtree 00107 } // namespace geos::index 00108 } // namespace geos 00109 00110 #endif // GEOS_INDEX_STRTREE_SIRTREE_H