[prev in list] [next in list] [prev in thread] [next in thread] 

List:       qgis-developer
Subject:    [Qgis-developer] Remove Feature
From:       Alexandre Badez <alexandre.badez () gmail ! com>
Date:       2012-02-28 16:25:06
Message-ID: CALQBTK-F5UeiuWqYm_h5YAD5BP8QNOaZQP6uSNfiSiMapgHZgQ () mail ! gmail ! com
[Download RAW message or body]

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 features are not delete...

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;
    }

    bool QgsVectorDataProvider::deleteFeatures( const QgsFeatureIds &ids )
    {
       Q_UNUSED( ids );
       return false;
    }


Well... the data provider do not seems to do anything really useful...

So I get a look to the QgsVectorLayer:

Code: Select all
    bool QgsVectorLayer::addFeature( QgsFeature& f, bool alsoUpdateExtent )
    {
      // does a lot of things
    }


So here is my questions:

    * My python code hat use the data provider "work" as expected (it
display something) but if I do this:
        self._layer.addFeatures([v for v in self._object_map.itervalues()])
    it do not work (do not display anything).
    Why ??

    * The deleteFeature do not seems to work neither on the data
provider nor on the layer... why ? Is it a bug ?

    * What am I missing, or doing wrong ?

By the way, I also check the code on SVN, (qgsvectorlayer v15857 and
qgsvectordataprovider v15197) and the code is similar to the one on
doxygen.

-- 
Alex
_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic