Skip to content
Permalink
Browse files
added a method to cache the geometries before start editing. Not wire…
…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 ab75554ec060d092d3ffb87ef1ab11a77b791383
Showing with 20 additions and 0 deletions.
  1. +16 −0 src/gui/qgsvectorlayer.cpp
  2. +4 −0 src/gui/qgsvectorlayer.h
@@ -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()
{
@@ -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

0 comments on commit ab75554

Please sign in to comment.