AW: [Qgis-developer] Vector Layer Translate Feature
Hugentobler Marco
marco.hugentobler at karto.baug.ethz.ch
Mon Apr 27 05:25:17 EDT 2009
Hi Pietro
This is probably a bug in the editing code of vector layer. I think it only checks the cached geometries (in view) and not the other ones. Please fill a bug into the tracker and assign it to me.
Regards,
Marco
-----Ursprüngliche Nachricht-----
Von: qgis-developer-bounces at lists.osgeo.org im Auftrag von Pietro Panzeri
Gesendet: Do 23.04.2009 16:25
An: qgis-developer at lists.osgeo.org
Betreff: [Qgis-developer] Vector Layer Translate Feature
Hi all,
I'm writing a Python plugin to allow the user to translate a whole vector
layer by a given shift.
I use the translateFeature() of the QgsVectorLayer class but if the layer is
zoomed the function translates only the visualized features.
I use the following code:
vlayer = iface.activeLayer()
provider = vlayer.dataProvider()
attrs = provider.attributeIndexes()
provider.select(attrs)
f = QgsFeature()
while provider.nextFeature(f):
error_code = vlayer.translateFeature(f.id(), delta_x, delta_y)
If the feature to translate is not one of the visualized features, the
error_code is 1 and the feature is not translated.
I already posted this question on the users mailing list and they pointed me
to this one.
Can someone point me a way to act on the whole layer regardless of the current
zoom?
Thank you very much.
Pietro
--
------------------------------------------------------------
Pietro Panzeri
Tele-Rilevamento Europa - T.R.E. s.r.l.
a POLIMI spin-off company
Via Vittoria Colonna, 7
20149 Milano - Italia
tel.: +39.02.4343.121
fax: +39.02.4343.1230
e-mail: pietro.panzeri at treuropa.com
web: www.treuropa.com
-------------------------------------------------------------
_______________________________________________
Qgis-developer mailing list
Qgis-developer at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer
More information about the Qgis-developer
mailing list