[Qgis-developer] Remove editing functions from QgsVectorLayer
madmanwoo at gmail.com
Tue Apr 16 02:26:52 PDT 2013
Personally I'm not a fan of that.
Why don't we make startEditing() return a edit buffer/edit session. So you
could do this:
session = layer.editSession()
This would mean that everyone can keep their own edit buffers and can do
what they want. Means you could also doing this:
with layer.editSession() as session:
which will commit the features at the end.
On Tue, Apr 16, 2013 at 4:10 PM, Martin Dobias <wonder.sk at gmail.com> wrote:
> On Tue, Apr 16, 2013 at 12:53 AM, Nathan Woodrow <madmanwoo at gmail.com>
> > What would be the API calls in order to add a new feature to a layer and
> > commit the result?
> layer.editBuffer().addFeature( feature )
> Anyway if someone wants to add a new feature permanently, it should be
> rather done this way:
> layer.dataProvider().addFeatures( [feature] )
> It's more efficient and it does not mess with the editing state of the
> layer (imagine you are editing a layer and a plugin action will commit
> all your changes without asking!).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Qgis-developer