Skip to content
Permalink
Browse files
clear the modified features after commit/roll back
git-svn-id: http://svn.osgeo.org/qgis/trunk@5390 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Apr 28, 2006
1 parent 127efa1 commit 70c9cb97e2d8b633b9dea5561a6bdab00b3ddabe
Showing with 2 additions and 34 deletions.
  1. +2 −34 src/gui/qgsvectorlayer.cpp
@@ -2357,23 +2357,8 @@ bool QgsVectorLayer::commitChanges()
{
if(dataProvider)
{
#ifdef QGISDEBUG
qWarning("in QgsVectorLayer::commitChanges");
#endif
bool returnvalue=true;

#ifdef QGISDEBUG
std::cout << "QgsVectorLayer::commitChanges: Committing new features"
<< "." << std::endl;

for(std::vector<QgsFeature*>::iterator it=mAddedFeatures.begin();it!=mAddedFeatures.end();++it)
{
std::cout << "QgsVectorLayer::commitChanges: Got: " << (*it)->geometry()->wkt().toLocal8Bit().data()
<< "." << std::endl;
}

#endif

// Commit new features
std::list<QgsFeature*> addedlist;
for(std::vector<QgsFeature*>::iterator it=mAddedFeatures.begin();it!=mAddedFeatures.end();++it)
@@ -2382,8 +2367,6 @@ bool QgsVectorLayer::commitChanges()
}

if(!dataProvider->addFeatures(addedlist))
// TODO: Make the Provider accept a pointer to vector instead of a list - more memory efficient
// if ( !(dataProvider->addFeatures(mAddedFeatures)) )
{
returnvalue=false;
}
@@ -2395,11 +2378,6 @@ bool QgsVectorLayer::commitChanges()
}
mAddedFeatures.clear();

#ifdef QGISDEBUG
std::cout << "QgsVectorLayer::commitChanges: Committing changed attributes"
<< "." << std::endl;
#endif

// Commit changed attributes
if( mChangedAttributes.size() > 0 )
{
@@ -2410,10 +2388,6 @@ bool QgsVectorLayer::commitChanges()
mChangedAttributes.clear();
}

#ifdef QGISDEBUG
std::cout << "QgsVectorLayer::commitChanges: Committing changed geometries"
<< "." << std::endl;
#endif
// Commit changed geometries
if( mChangedGeometries.size() > 0 )
{
@@ -2424,12 +2398,6 @@ bool QgsVectorLayer::commitChanges()
mChangedGeometries.clear();
}


#ifdef QGISDEBUG
std::cout << "QgsVectorLayer::commitChanges: Committing deleted features"
<< "." << std::endl;
#endif

// Commit deleted features
if(mDeleted.size()>0)
{
@@ -2455,8 +2423,8 @@ bool QgsVectorLayer::commitChanges()

bool QgsVectorLayer::rollBack()
{
// TODO: Roll back changed features

//Roll back changed features
mChangedGeometries.clear();
// Roll back added features
// Delete the features themselves before deleting the references to them.
for(std::vector<QgsFeature*>::iterator it=mAddedFeatures.begin();it!=mAddedFeatures.end();++it)

0 comments on commit 70c9cb9

Please sign in to comment.