Skip to content

Commit

Permalink
added a method to cache the geometries before start editing. Not wire…
Browse files Browse the repository at this point in the history
…d in yet

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5377 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Apr 25, 2006
1 parent 380adbd commit ab75554
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/gui/qgsvectorlayer.cpp
Expand Up @@ -942,6 +942,22 @@ QgsVectorLayer::endian_t QgsVectorLayer::endian()
return (htonl(1) == 1) ? QgsVectorLayer::XDR : QgsVectorLayer::NDR ;
}

void QgsVectorLayer::cacheGeometries()
{
for(std::map<int, QgsGeometry*>::iterator it = mCachedGeometries.begin(); it != mCachedGeometries.end(); ++it)
{
delete it->second;
}
mCachedGeometries.clear();
if(dataProvider)
{
QgsFeature* f = 0;
while(f = dataProvider->getNextFeature(false))
{
mCachedGeometries.insert(std::make_pair(f->featureId(), f->geometryAndOwnership()));
}
}
}

void QgsVectorLayer::table()
{
Expand Down
4 changes: 4 additions & 0 deletions src/gui/qgsvectorlayer.h
Expand Up @@ -557,6 +557,10 @@ protected slots:
};
private: // Private methods
endian_t endian();

/**Caches all the (commited) geometries to mCachedFeatures, e.g. when entering editing mode*/
void cacheGeometries();

// pointer for loading the provider library
QLibrary *myLib;
//! Update threshold for drawing features as they are read. A value of zero indicates
Expand Down

0 comments on commit ab75554

Please sign in to comment.