Skip to content

Commit

Permalink
clear the modified features after commit/roll back
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5390 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Apr 28, 2006
1 parent 07422b0 commit ae4e603
Showing 1 changed file with 2 additions and 34 deletions.
36 changes: 2 additions & 34 deletions src/gui/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
}
Expand All @@ -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 )
{
Expand All @@ -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 )
{
Expand All @@ -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)
{
Expand All @@ -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)
Expand Down

0 comments on commit ae4e603

Please sign in to comment.