|
QGIS API Documentation
master-3f58142
|
00001 /*************************************************************************** 00002 qgsspatialindex.h - wrapper class for spatial index library 00003 ---------------------- 00004 begin : December 2006 00005 copyright : (C) 2006 by Martin Dobias 00006 email : wonder.sk at gmail dot com 00007 *************************************************************************** 00008 * * 00009 * This program is free software; you can redistribute it and/or modify * 00010 * it under the terms of the GNU General Public License as published by * 00011 * the Free Software Foundation; either version 2 of the License, or * 00012 * (at your option) any later version. * 00013 * * 00014 ***************************************************************************/ 00015 00016 #ifndef QGSSPATIALINDEX_H 00017 #define QGSSPATIALINDEX_H 00018 00019 // forward declaration 00020 namespace SpatialIndex 00021 { 00022 class IStorageManager; 00023 class ISpatialIndex; 00024 class Region; 00025 class Point; 00026 00027 namespace StorageManager 00028 { 00029 class IBuffer; 00030 } 00031 } 00032 00033 class QgsFeature; 00034 class QgsRectangle; 00035 class QgsPoint; 00036 00037 #include <QList> 00038 00039 #include "qgsfeature.h" 00040 00041 class CORE_EXPORT QgsSpatialIndex 00042 { 00043 00044 public: 00045 00046 /* creation of spatial index */ 00047 00049 QgsSpatialIndex(); 00050 00052 ~QgsSpatialIndex(); 00053 00054 00055 /* operations */ 00056 00058 bool insertFeature( QgsFeature& f ); 00059 00061 bool deleteFeature( QgsFeature& f ); 00062 00063 00064 /* queries */ 00065 00067 QList<QgsFeatureId> intersects( QgsRectangle rect ); 00068 00070 QList<QgsFeatureId> nearestNeighbor( QgsPoint point, int neighbors ); 00071 00072 00073 protected: 00074 // @note not available in python bindings 00075 SpatialIndex::Region rectToRegion( QgsRectangle rect ); 00076 // @note not available in python bindings 00077 bool featureInfo( QgsFeature& f, SpatialIndex::Region& r, QgsFeatureId &id ); 00078 00079 private: 00080 00082 SpatialIndex::IStorageManager* mStorageManager; 00083 00085 SpatialIndex::StorageManager::IBuffer* mStorage; 00086 00088 SpatialIndex::ISpatialIndex* mRTree; 00089 00090 }; 00091 00092 #endif 00093