<div dir="ltr">OOPs forgot to send it to the list.<br><div><br><br><div class="gmail_quote"><div dir="ltr"><div><div>Hi Marco, <br><br></div>This is working for me, don't know if is the best option:<br><br></div>//_vector Layer is a point layer in memory<br>
<div> _vectorLayer->startEditing();<br> QgsGeometryMap m;<br>
</div><div>//Pass the feature id and the new x,y<br></div><div> m.insert(<a href="http://feature.id" target="_blank">feature.id</a>(),*QgsGeometry::fromPoint(QgsPoint(x,y)));<br> _vectorLayer->dataProvider()->changeGeometryValues(m);<br>
_contactLayer->updateExtents();<br> _contactLayer->commitChanges();<br></div><div> _contactLayer.triggerRepaint();<br><br></div><div>Hope it helps.<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
2013/6/14 Marco Gomes <span dir="ltr"><<a href="mailto:marco.gomes@edisoft.pt" target="_blank">marco.gomes@edisoft.pt</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5">
<div link="blue" vlink="purple" lang="PT"><div><p class="MsoNormal"><span lang="EN-US">I am trying to move features in a Qt timer without success. What it is missing?<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Below all my trials to make this work. <u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal" style="text-autospace:none">
<span style="font-size:9.5pt;font-family:Consolas" lang="EN-US"> <span style="color:green">//pointMarkersLayer->dataProvider()->changeGeometryValues(geomMap);</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas" lang="EN-US"> <span style="color:green">//pointMarkersLayer->updateFeature(featureRoute_p);</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas" lang="EN-US"> <u></u><u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas" lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas" lang="EN-US"> <span style="color:green">//pointMarkersLayer->changeGeometry(featureRoute_p.id(), geometry);</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas" lang="EN-US"> <span style="color:green">//pointMarkersLayer->moveVertex(finalPoint.x(), finalPoint.y(), featureRoute_p.id(), 0);</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas" lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas" lang="EN-US"> <span style="color:green">//pointMarkersLayer->changeGeometry(featureRoute_p.id(), geometry);<u></u><u></u></span></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas" lang="EN-US"> <span style="color:green">//pointMarkersLayer->updateFeature(featureRoute_p);</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas" lang="EN-US"> <span style="color:green">//categorizedSymbolRendererV2->renderFeature(featureRoute_p, QgsRenderContext(), pointMarkersLayer->id().toInt(), false, false);</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas" lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas" lang="EN-US"> <span style="color:green">//pointMarkersLayer->startEditing();</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas" lang="EN-US"> <span style="color:green">//pointMarkersLayer->select(featureRoute_p.id(), false);</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas" lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas" lang="EN-US"> <span style="color:green">//featureRoute_p.setGeometry(QgsGeometry::fromPoint(finalPoint));</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas" lang="EN-US"> <span style="color:green">//pointMarkersLayer->updateFeature(featureRoute_p);</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas" lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas" lang="EN-US"> <span style="color:green">//float dx = finalPoint.x() - featureRoute_p.geometry()->asPoint().x();</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas" lang="EN-US"> <span style="color:green">//float dy = finalPoint.y() - featureRoute_p.geometry()->asPoint().y();</span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas" lang="EN-US"><u></u> <u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas" lang="EN-US"> <span style="color:green">//pointMarkersLayer->translateFeature(featureRoute_p.id(), dx, dy);<u></u><u></u></span></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p></div></div><br></div></div>_______________________________________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
<br></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br><div dir="ltr">Jordi Torres<br><br><br></div>
</font></span></div>
</div><br><br clear="all"><br>-- <br><div dir="ltr">Jordi Torres<br><br><br></div>
</div></div>