[Qgis-developer] Remove Feature

2012-02-28 Thread Alexandre Badez
Hi everyone, I'm coding a plugin in python and I would like to understand what append during this: self._layer.dataProvider().deleteFeatures([v.id() for v in self._object_map.itervalues()]) and self._layer.dataProvider().addFeatures([v for v in self._object_map.itervalues()]) because featu

[Qgis-developer] Remove Feature

2012-03-01 Thread Alexandre Badez
Hi everyone, I would like to remove feature in a vector layer, but the deleteFeatures do not seems to work. Is it a bug ? How can I do this ? How should I handle features ids ? Thanks. -- Alex ___ Qgis-developer mailing list Qgis-developer@lists.osg

Re: [Qgis-developer] Remove Feature

2012-03-01 Thread Denis Rouzaud
Hi, Did you try deleteFeatures from dataProvider or deleteFeature from vectorLayer ? On 03/01/2012 10:54 AM, Alexandre Badez wrote: Hi everyone, I would like to remove feature in a vector layer, but the deleteFeatures do not seems to work. Is it a bug ? How can I do this ? How should I han

Re: [Qgis-developer] Remove Feature

2012-03-01 Thread Alexandre Badez
Hi, Yep, I did, and it did not work.. I post a longer message here: http://forum.qgis.org/viewtopic.php?f=5&t=10121&sid=e816f9d2b714e6959b4cdf4074839b97 On Thu, Mar 1, 2012 at 11:37, Denis Rouzaud wrote: > Hi, > > Did you try deleteFeatures from dataProvider or deleteFeature from > vectorLayer ?

Re: [Qgis-developer] Remove Feature

2012-03-01 Thread Denis Rouzaud
This is strange, I have successfully use the deleteFeatures from the dataProvider here at line 103 https://github.com/3nids/Triangulation/blob/2b90973a34f835ac3564204dcbccc573bcff274a/triangulation.py same for addFeatures. Which version of Qgis are you using? On 03/01/2012 11:38 AM, Alexan

Re: [Qgis-developer] Remove Feature

2012-03-01 Thread Alexandre Badez
I'm using OSGeo4W with Qgis 1.7.3 (from version 4296e12 of code) with Qt 4.7.1 and python 2.7.2 On Thu, Mar 1, 2012 at 11:50, Denis Rouzaud wrote: > This is strange, I have successfully use the deleteFeatures from the > dataProvider > > here at line 103 > https://github.com/3nids/Triangulation/bl

Re: [Qgis-developer] Remove Feature

2012-03-01 Thread Denis Rouzaud
No idea what is the problem. I don't have 1.7 installed, you could try installing the dev version (1.9.90) with the osgeo4w installer. Maybe something changed. I experienced a few problems with addFeatures that have been fixed in the master. Otherwise, someone else has to confirm it is ok in

Re: [Qgis-developer] Remove Feature

2012-03-01 Thread Martin Dobias
On Tue, Feb 28, 2012 at 5:25 PM, Alexandre Badez wrote: > > So... I get a look in the C++ code.. here is what I've found in > src/core/qgsvectordataprovider.cpp. >    bool QgsVectorDataProvider::addFeatures( QgsFeatureList &flist ) >    { >       Q_UNUSED( flist ); >       return false; >    } > >

Re: [Qgis-developer] Remove Feature

2012-03-02 Thread Alexandre Badez
Thanks Martin for your help. On Thu, Mar 1, 2012 at 21:28, Martin Dobias wrote: > The actual implementation is in classes derived from > QgsVectorDataProvider. Each data provider that allows adding/deleting > features has its own logic. Ok... I'm using the memory data provider (I'm creating my l

Re: [Qgis-developer] Remove Feature

2012-03-02 Thread Martin Dobias
On Fri, Mar 2, 2012 at 10:14 AM, Alexandre Badez wrote: > So I try do delete features as this: >            f = core.QgsFeature() >            fids = [] >            while dp.nextFeature(f): >                fids.append(f.id()) >            logger.debug("deleting feature: %s", fids) >            i

Re: [Qgis-developer] Remove Feature

2012-03-02 Thread Alexandre Badez
THANKS IT WORKS ! \o/ On Fri, Mar 2, 2012 at 10:25, Martin Dobias wrote: > On Fri, Mar 2, 2012 at 10:14 AM, Alexandre Badez > wrote: >> So I try do delete features as this: >>            f = core.QgsFeature() >>            fids = [] >>            while dp.nextFeature(f): >>