@@ -69,7 +69,7 @@ QString QgsMemoryProvider::storageType() const
69
69
bool QgsMemoryProvider::nextFeature ( QgsFeature& feature )
70
70
{
71
71
feature.setValid ( false );
72
- bool hasFeature = FALSE ;
72
+ bool hasFeature = false ;
73
73
74
74
// option 1: using spatial index
75
75
if ( mSelectUsingSpatialIndex )
@@ -80,10 +80,10 @@ bool QgsMemoryProvider::nextFeature( QgsFeature& feature )
80
80
if ( mSelectUseIntersect )
81
81
{
82
82
if ( mFeatures [*mSelectSI_Iterator ].geometry ()->intersects ( mSelectRectGeom ) )
83
- hasFeature = TRUE ;
83
+ hasFeature = true ;
84
84
}
85
85
else
86
- hasFeature = TRUE ;
86
+ hasFeature = true ;
87
87
88
88
if ( hasFeature )
89
89
break ;
@@ -106,21 +106,21 @@ bool QgsMemoryProvider::nextFeature( QgsFeature& feature )
106
106
if ( mSelectRect .isEmpty () )
107
107
{
108
108
// selection rect empty => using all features
109
- hasFeature = TRUE ;
109
+ hasFeature = true ;
110
110
}
111
111
else
112
112
{
113
113
if ( mSelectUseIntersect )
114
114
{
115
115
// using exact test when checking for intersection
116
116
if ( mSelectIterator ->geometry ()->intersects ( mSelectRectGeom ) )
117
- hasFeature = TRUE ;
117
+ hasFeature = true ;
118
118
}
119
119
else
120
120
{
121
121
// check just bounding box against rect when not using intersection
122
122
if ( mSelectIterator ->geometry ()->boundingBox ().intersects ( mSelectRect ) )
123
- hasFeature = TRUE ;
123
+ hasFeature = true ;
124
124
}
125
125
}
126
126
@@ -147,13 +147,15 @@ bool QgsMemoryProvider::featureAtId( int featureId,
147
147
bool fetchGeometry,
148
148
QgsAttributeList fetchAttributes )
149
149
{
150
+ feature.setValid ( false );
150
151
QgsFeatureMap::iterator it = mFeatures .find ( featureId );
151
152
152
153
if ( it == mFeatures .end () )
153
- return FALSE ;
154
+ return false ;
154
155
155
156
feature = *it;
156
- return TRUE ;
157
+ feature.setValid ( true );
158
+ return true ;
157
159
}
158
160
159
161
@@ -173,13 +175,13 @@ void QgsMemoryProvider::select( QgsAttributeList fetchAttributes,
173
175
// (but don't use it when selection rect is not specified)
174
176
if ( mSpatialIndex && !mSelectRect .isEmpty () )
175
177
{
176
- mSelectUsingSpatialIndex = TRUE ;
178
+ mSelectUsingSpatialIndex = true ;
177
179
mSelectSI_Features = mSpatialIndex ->intersects ( rect );
178
180
QgsDebugMsg ( " Features returned by spatial index: " + QString::number ( mSelectSI_Features .count () ) );
179
181
}
180
182
else
181
183
{
182
- mSelectUsingSpatialIndex = FALSE ;
184
+ mSelectUsingSpatialIndex = false ;
183
185
mSelectSI_Features .clear ();
184
186
}
185
187
@@ -252,7 +254,7 @@ bool QgsMemoryProvider::addFeatures( QgsFeatureList & flist )
252
254
253
255
updateExtent ();
254
256
255
- return TRUE ;
257
+ return true ;
256
258
}
257
259
258
260
bool QgsMemoryProvider::deleteFeatures ( const QgsFeatureIds & id )
@@ -274,7 +276,7 @@ bool QgsMemoryProvider::deleteFeatures( const QgsFeatureIds & id )
274
276
275
277
updateExtent ();
276
278
277
- return TRUE ;
279
+ return true ;
278
280
}
279
281
280
282
bool QgsMemoryProvider::addAttributes ( const QList<QgsField> &attributes )
@@ -298,14 +300,14 @@ bool QgsMemoryProvider::addAttributes( const QList<QgsField> &attributes )
298
300
if ( it2.key () > nextId ) nextId = it2.key ();
299
301
mFields [nextId+1 ] = *it;
300
302
}
301
- return TRUE ;
303
+ return true ;
302
304
}
303
305
304
306
bool QgsMemoryProvider::deleteAttributes ( const QgsAttributeIds& attributes )
305
307
{
306
308
for ( QgsAttributeIds::const_iterator it = attributes.begin (); it != attributes.end (); ++it )
307
309
mFields .remove ( *it );
308
- return TRUE ;
310
+ return true ;
309
311
}
310
312
311
313
bool QgsMemoryProvider::changeAttributeValues ( const QgsChangedAttributesMap & attr_map )
@@ -320,7 +322,7 @@ bool QgsMemoryProvider::changeAttributeValues( const QgsChangedAttributesMap & a
320
322
for ( QgsAttributeMap::const_iterator it2 = attrs.begin (); it2 != attrs.end (); ++it2 )
321
323
fit->changeAttribute ( it2.key (), it2.value () );
322
324
}
323
- return TRUE ;
325
+ return true ;
324
326
}
325
327
326
328
bool QgsMemoryProvider::changeGeometryValues ( QgsGeometryMap & geometry_map )
@@ -344,7 +346,7 @@ bool QgsMemoryProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
344
346
345
347
updateExtent ();
346
348
347
- return TRUE ;
349
+ return true ;
348
350
}
349
351
350
352
bool QgsMemoryProvider::createSpatialIndex ()
@@ -359,7 +361,7 @@ bool QgsMemoryProvider::createSpatialIndex()
359
361
mSpatialIndex ->insertFeature ( *it );
360
362
}
361
363
}
362
- return TRUE ;
364
+ return true ;
363
365
}
364
366
365
367
int QgsMemoryProvider::capabilities () const
0 commit comments