[Qgis-developer] delete selected features slow (because of featurecount/events)??
Matthias Kuhn
matthias at opengis.ch
Fri Nov 18 03:39:00 PST 2016
Hi Richard,
An edit session and an edit command are not the same thing.
An edit session corresponds to clicking the pencil button (or im python
startEditing() / commitChanges()).
During an edit session, multiple edit commands can made. They appear as
"one action" in the undo stack and some parts of the application use it
for batch processing (postpone expensive processing like updating the
feature count to the end of an edit command).
As such they should be used to group logical units - usually what is
triggered by a single click of the user.
Bests
Matthias
On 11/18/2016 12:31 PM, Richard Duivenvoorde wrote:
> On 2016-11-16 10:46, Matthias Kuhn wrote:
>> Hi Richard,
>>
>> What the trash button does is
>>
>> vl.beginEditCommand( "Delete Selected Features" )
>> vl.deleteSelectedFeatures()
>> vl.endEditCommand()
>>
>> This makes me think, that the "with edit" construct could actually wrap
>> things into a single edit command as well.
>
> Ah cool. Thanks, this helps and is indeed as fast as the 'red basket' :-)
>
> Not sure what the difference is though when I do NOT open the
> beginEditCommand in python but make the layer editable in QGIS?
>
> Or is QGIS then (just like with 'with edit') opening and closing the
> edit-session then?
>
> Because having a point layer with >20000 points here, it takes >20
> minutes to remove them when I do not use the construct like you show above.
>
> Thanks & Regards,
>
> Richard
More information about the Qgis-developer
mailing list