SnapToCurrentLayer in QGis2.8 with python programming

المشرف العام

Administrator
طاقم الإدارة
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 Qgis 2.8 there is no response. Can anyone help me with python programming?



أكثر...
 
أعلى