Skip to content

Commit ab75554

Browse files

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
 

‎src/gui/qgsvectorlayer.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,22 @@ QgsVectorLayer::endian_t QgsVectorLayer::endian()
942942
return (htonl(1) == 1) ? QgsVectorLayer::XDR : QgsVectorLayer::NDR ;
943943
}
944944

945+
void QgsVectorLayer::cacheGeometries()
946+
{
947+
for(std::map<int, QgsGeometry*>::iterator it = mCachedGeometries.begin(); it != mCachedGeometries.end(); ++it)
948+
{
949+
delete it->second;
950+
}
951+
mCachedGeometries.clear();
952+
if(dataProvider)
953+
{
954+
QgsFeature* f = 0;
955+
while(f = dataProvider->getNextFeature(false))
956+
{
957+
mCachedGeometries.insert(std::make_pair(f->featureId(), f->geometryAndOwnership()));
958+
}
959+
}
960+
}
945961

946962
void QgsVectorLayer::table()
947963
{

‎src/gui/qgsvectorlayer.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,10 @@ protected slots:
557557
};
558558
private: // Private methods
559559
endian_t endian();
560+
561+
/**Caches all the (commited) geometries to mCachedFeatures, e.g. when entering editing mode*/
562+
void cacheGeometries();
563+
560564
// pointer for loading the provider library
561565
QLibrary *myLib;
562566
//! Update threshold for drawing features as they are read. A value of zero indicates

0 commit comments

Comments
 (0)
Please sign in to comment.