[Qgis-developer] How can i move a point marker?

Marco Gomes marco.gomes at edisoft.pt
Tue Jun 11 09:13:33 PDT 2013


 

Hi!

 

I am trying to implement a way to move a point, starting at X,Y
coordinates till reaches X,Y final point.

 

The code that I implemented to move the feature is:

       pointMarkersLayer->startEditing();

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

       pointMarkersLayer->commitChanges();

       pointMarkersLayer->reload();

But the point marker do not move! Can someone give me some example, on
how to move markers in a point layer.

 

Thanks in advance,

Marco Gomes

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20130611/80bdcece/attachment.html>


More information about the Qgis-developer mailing list