<div dir="ltr">Can't you use the the snapped point (<span style="font-size:12.8000001907349px">QgsSnappingResult.snappedVertex</span>) to replace the original vertex position?<div><br></div><div>giovanni</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-04-22 11:01 GMT+02:00 <a href="mailto:francescoboccacci@libero.it">francescoboccacci@libero.it</a> <span dir="ltr"><<a href="mailto:francescoboccacci@libero.it" target="_blank">francescoboccacci@libero.it</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div></div>Hi all,<br>i have a question for you. I'd like to have a new function in my plugin that makes an autime snapping if a start point or end point of a new feature inserted is closed to a vertex or segment base on a values setted ina configuration file.<br>From plugin console:<br><br>l = iface.activeLayer()  --activeLayer<br>f = l.selectedFeatures()[0] -- new fetaure inserted<br>start = f.geometry().asPolyline()[0] -- get the start point (the point that i would like to snap to a segment)<br>result = l.snapWithContext(start,10,QgsSnapper.SnapToVertexAndSegment) -- i use<br>result<br>(0, {0.0: [<qgis._core.QgsSnappingResult object at 0x0000000018B9C400>], 0.09699529788394015: [<qgis._core.QgsSnappingResult object at 0x0000000018B9C620>]})<br><br>I notice that the key 0.09699529788394015 is the effective distance between my start point and the segment.<br>My question is:<br>How can i modify the feature geometry to snap to the segment according to result?<br><br>Thanks<br><br>Francesco<br><br>_______________________________________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org">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></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr">Giovanni Allegri<br><a href="http://about.me/giovanniallegri" target="_blank">http://about.me/giovanniallegri</a></div><div dir="ltr">Gis3W - <a href="http://gis3w.it" target="_blank">http://gis3w.it</a></div><div dir="ltr">Ikare - <a href="http://ikare.it" target="_blank">http://ikare.it</a><br><div>Twitter: <a href="https://twitter.com/_giohappy_" target="_blank">https://twitter.com/_giohappy_</a></div><div>blog: <a href="http://blog.spaziogis.it" target="_blank">http://blog.spaziogis.it</a><br>GEO+ geomatica in Italia <a href="http://bit.ly/GEOplus" target="_blank">http://bit.ly/GEOplus</a></div></div></div></div></div>
</div>