Skip to content

Commit fd0fba7

Browse files
committedDec 27, 2018
Add fast truncate implementation for memory provider
1 parent b0aae0b commit fd0fba7

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed
 

‎src/core/providers/memory/qgsmemoryprovider.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,9 +616,16 @@ QgsVectorDataProvider::Capabilities QgsMemoryProvider::capabilities() const
616616
{
617617
return AddFeatures | DeleteFeatures | ChangeGeometries |
618618
ChangeAttributeValues | AddAttributes | DeleteAttributes | RenameAttributes | CreateSpatialIndex |
619-
SelectAtId | CircularGeometries;
619+
SelectAtId | CircularGeometries | FastTruncate;
620620
}
621621

622+
bool QgsMemoryProvider::truncate()
623+
{
624+
mFeatures.clear();
625+
clearMinMaxCache();
626+
mExtent.setMinimal();
627+
return true;
628+
}
622629

623630
void QgsMemoryProvider::updateExtents()
624631
{

‎src/core/providers/memory/qgsmemoryprovider.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class QgsMemoryProvider : public QgsVectorDataProvider
6868
bool supportsSubsetString() const override { return true; }
6969
bool createSpatialIndex() override;
7070
QgsVectorDataProvider::Capabilities capabilities() const override;
71+
bool truncate() override;
7172

7273
/* Implementation of functions from QgsDataProvider */
7374

0 commit comments

Comments
 (0)
Please sign in to comment.