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)
306306
307307bool QgsMemoryProvider::changeAttributeValues (const QgsChangedAttributesMap & attr_map)
308308{
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 ;
311320}
312321
313322bool QgsMemoryProvider::changeGeometryValues (QgsGeometryMap & geometry_map)
314323{
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+ }
318340
319341 updateExtent ();
320342
321- return FALSE ;
343+ return TRUE ;
322344}
323345
324346bool QgsMemoryProvider::createSpatialIndex ()
You can’t perform that action at this time.
0 commit comments