mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
added missing implementations for changeAttributeValues, changeGeometryValues
git-svn-id: http://svn.osgeo.org/qgis/trunk@8737 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
4a28f76aa4
commit
5bbcd70c64
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user