[Qgis-developer] Python: How to call snapToCurrentLayer in QgsMapCanvasSnapper for QGis2.8

luna luna.helios at googlemail.com
Tue Mar 17 05:46:46 PDT 2015


I have a polygon vector layer and I want to snap the vertex.

def canvasMoveEvent(self,event):
  x = event.pos().x()
  y = event.pos().y()
  startingPoint = QPoint(x,y)
  snapper = QgsMapCanvasSnapper(self.iface.mapCanvas())
 
(retval,result)=snapper.snapToCurrentLayer(startingPoint,QgsSnapper.SnapToVertex,
-1)
  point = result[0].snappedVertex
  pointnr = result[0].snappedVertexNr

It work's fine for QGis2.0.
But in Qgis2.8 the result is always empty. Can anyone help me?



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Python-How-to-call-snapToCurrentLayer-in-QgsMapCanvasSnapper-for-QGis2-8-tp5193879.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.


More information about the Qgis-developer mailing list