File tree Expand file tree Collapse file tree 1 file changed +28
-6
lines changed Expand file tree Collapse file tree 1 file changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -306,19 +306,41 @@ bool QgsMemoryProvider::deleteAttributes(const QgsAttributeIds& attributes)
306
306
307
307
bool QgsMemoryProvider::changeAttributeValues (const QgsChangedAttributesMap & attr_map)
308
308
{
309
- // TODO: change attribute values
310
- return FALSE ;
309
+ for (QgsChangedAttributesMap::const_iterator it = attr_map.begin (); it != attr_map.end (); ++it)
310
+ {
311
+ QgsFeatureMap::iterator fit = mFeatures .find (it.key ());
312
+ if (fit == mFeatures .end ())
313
+ continue ;
314
+
315
+ const QgsAttributeMap& attrs = it.value ();
316
+ for (QgsAttributeMap::const_iterator it2 = attrs.begin (); it2 != attrs.end (); ++it2)
317
+ fit->changeAttribute (it2.key (), it2.value ());
318
+ }
319
+ return TRUE ;
311
320
}
312
321
313
322
bool QgsMemoryProvider::changeGeometryValues (QgsGeometryMap & geometry_map)
314
323
{
315
- // TODO: change geometries
316
-
317
- // TODO: update spatial index
324
+ for (QgsGeometryMap::const_iterator it = geometry_map.begin (); it != geometry_map.end (); ++it)
325
+ {
326
+ QgsFeatureMap::iterator fit = mFeatures .find (it.key ());
327
+ if (fit == mFeatures .end ())
328
+ continue ;
329
+
330
+ // update spatial index
331
+ if (mSpatialIndex )
332
+ mSpatialIndex ->deleteFeature (*fit);
333
+
334
+ fit->setGeometry (it.value ());
335
+
336
+ // update spatial index
337
+ if (mSpatialIndex )
338
+ mSpatialIndex ->insertFeature (*fit);
339
+ }
318
340
319
341
updateExtent ();
320
342
321
- return FALSE ;
343
+ return TRUE ;
322
344
}
323
345
324
346
bool QgsMemoryProvider::createSpatialIndex ()
You can’t perform that action at this time.
0 commit comments