Skip to content
Permalink
Browse files
added missing implementations for changeAttributeValues, changeGeomet…
…ryValues

git-svn-id: http://svn.osgeo.org/qgis/trunk@8737 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Jul 8, 2008
1 parent 4a28f76 commit 5bbcd70
Showing 1 changed file with 28 additions and 6 deletions.
@@ -306,19 +306,41 @@ bool QgsMemoryProvider::deleteAttributes(const QgsAttributeIds& attributes)

bool QgsMemoryProvider::changeAttributeValues(const QgsChangedAttributesMap & attr_map)
{
// TODO: change attribute values
return FALSE;
for (QgsChangedAttributesMap::const_iterator it = attr_map.begin(); it != attr_map.end(); ++it)
{
QgsFeatureMap::iterator fit = mFeatures.find(it.key());
if (fit == mFeatures.end())
continue;

const QgsAttributeMap& attrs = it.value();
for (QgsAttributeMap::const_iterator it2 = attrs.begin(); it2 != attrs.end(); ++it2)
fit->changeAttribute(it2.key(), it2.value());
}
return TRUE;
}

bool QgsMemoryProvider::changeGeometryValues(QgsGeometryMap & geometry_map)
{
// TODO: change geometries

// TODO: update spatial index
for (QgsGeometryMap::const_iterator it = geometry_map.begin(); it != geometry_map.end(); ++it)
{
QgsFeatureMap::iterator fit = mFeatures.find(it.key());
if (fit == mFeatures.end())
continue;

// update spatial index
if (mSpatialIndex)
mSpatialIndex->deleteFeature(*fit);

fit->setGeometry(it.value());

// update spatial index
if (mSpatialIndex)
mSpatialIndex->insertFeature(*fit);
}

updateExtent();

return FALSE;
return TRUE;
}

bool QgsMemoryProvider::createSpatialIndex()

0 comments on commit 5bbcd70

Please sign in to comment.