One more thing: It should be _vectorLayer instead of _contactLayer in the last three lines.
Cheers. 2013/6/14 Jordi Torres <[email protected]> > OOPs forgot to send it to the list. > > > Hi Marco, > > This is working for me, don't know if is the best option: > > //_vector Layer is a point layer in memory > _vectorLayer->startEditing(); > QgsGeometryMap m; > //Pass the feature id and the new x,y > m.insert(feature.id(),*QgsGeometry::fromPoint(QgsPoint(x,y))); > _vectorLayer->dataProvider()->changeGeometryValues(m); > _contactLayer->updateExtents(); > _contactLayer->commitChanges(); > _contactLayer.triggerRepaint(); > > Hope it helps. > > > 2013/6/14 Marco Gomes <[email protected]> > >> I am trying to move features in a Qt timer without success. What it is >> missing?**** >> >> ** ** >> >> Below all my trials to make this work. **** >> >> ** ** >> >> >> //pointMarkersLayer->dataProvider()->changeGeometryValues(geomMap);**** >> >> //pointMarkersLayer->updateFeature(featureRoute_p);**** >> >> **** >> >> ** ** >> >> //pointMarkersLayer->changeGeometry(featureRoute_p.id(), >> geometry);**** >> >> //pointMarkersLayer->moveVertex(finalPoint.x(), finalPoint.y(), >> featureRoute_p.id(), 0);**** >> >> ** ** >> >> //pointMarkersLayer->changeGeometry(featureRoute_p.id(), >> geometry);**** >> >> //pointMarkersLayer->updateFeature(featureRoute_p);**** >> >> //categorizedSymbolRendererV2->renderFeature(featureRoute_p, >> QgsRenderContext(), pointMarkersLayer->id().toInt(), false, false);**** >> >> ** ** >> >> //pointMarkersLayer->startEditing();**** >> >> //pointMarkersLayer->select(featureRoute_p.id(), false);**** >> >> ** ** >> >> //featureRoute_p.setGeometry(QgsGeometry::fromPoint(finalPoint));* >> *** >> >> //pointMarkersLayer->updateFeature(featureRoute_p);**** >> >> ** ** >> >> //float dx = finalPoint.x() - >> featureRoute_p.geometry()->asPoint().x();**** >> >> //float dy = finalPoint.y() - >> featureRoute_p.geometry()->asPoint().y();**** >> >> ** ** >> >> //pointMarkersLayer->translateFeature(featureRoute_p.id(), dx, >> dy);**** >> >> ** ** >> >> _______________________________________________ >> Qgis-developer mailing list >> [email protected] >> http://lists.osgeo.org/mailman/listinfo/qgis-developer >> >> > > > -- > Jordi Torres > > > > > > -- > Jordi Torres > > > -- Jordi Torres
_______________________________________________ Qgis-developer mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-developer
