@@ -40,6 +40,7 @@ class QgsPointXY;
40
40
41
41
#include " qgis_core.h"
42
42
#include " qgis_sip.h"
43
+ #include " qgsfeaturesink.h"
43
44
#include < QList>
44
45
#include < QSharedDataPointer>
45
46
@@ -63,7 +64,7 @@ class QgsFeatureSource;
63
64
*
64
65
* \see QgsSpatialIndexKDBush, which is an optimised non-mutable index for point geometries only.
65
66
*/
66
- class CORE_EXPORT QgsSpatialIndex
67
+ class CORE_EXPORT QgsSpatialIndex : public QgsFeatureSink
67
68
{
68
69
69
70
public:
@@ -104,7 +105,7 @@ class CORE_EXPORT QgsSpatialIndex
104
105
QgsSpatialIndex ( const QgsSpatialIndex &other );
105
106
106
107
// ! Destructor finalizes work with spatial index
107
- ~QgsSpatialIndex ();
108
+ ~QgsSpatialIndex () override ;
108
109
109
110
// ! Implement assignment operator
110
111
QgsSpatialIndex &operator =( const QgsSpatialIndex &other );
@@ -113,15 +114,41 @@ class CORE_EXPORT QgsSpatialIndex
113
114
114
115
/* *
115
116
* Adds a \a feature to the index.
117
+ * \deprecated Use addFeature() instead
116
118
*/
117
- bool insertFeature ( const QgsFeature &feature );
119
+ Q_DECL_DEPRECATED bool insertFeature ( const QgsFeature &feature ) SIP_DEPRECATED;
120
+
121
+ /* *
122
+ * Adds a \a feature to the index.
123
+ *
124
+ * The \a flags argument is ignored.
125
+ *
126
+ * \since QGIS 3.4
127
+ */
128
+ bool addFeature ( QgsFeature &feature, QgsFeatureSink::Flags flags = nullptr ) override ;
129
+
130
+ /* *
131
+ * Adds a list of \a features to the index.
132
+ *
133
+ * The \a flags argument is ignored.
134
+ *
135
+ * \see addFeature()
136
+ */
137
+ bool addFeatures ( QgsFeatureList &features, QgsFeatureSink::Flags flags = nullptr ) override ;
118
138
119
139
/* *
120
140
* Add a feature \a id to the index with a specified bounding box.
121
141
* \returns true if feature was successfully added to index.
122
- * \since QGIS 3.0
142
+ * \deprecated Use addFeature() instead
143
+ */
144
+ Q_DECL_DEPRECATED bool insertFeature ( QgsFeatureId id, const QgsRectangle &bounds ) SIP_DEPRECATED;
145
+
146
+ /* *
147
+ * Add a feature \a id to the index with a specified bounding box.
148
+ * \returns true if feature was successfully added to index.
149
+ * \since QGIS 3.4
123
150
*/
124
- bool insertFeature ( QgsFeatureId id, const QgsRectangle &bounds );
151
+ bool addFeature ( QgsFeatureId id, const QgsRectangle &bounds );
125
152
126
153
/* *
127
154
* Removes a \a feature from the index.
0 commit comments