I'm working with QGis 2.8 and python.
I replaced my QgsMapCanvasSnapper to QgsSnappingUtils. The following code
works fine for me.
def canvasPressEvent(self,event):
x = event.pos().x()
y = event.pos().y()
startingPoint = QPoint(x,y)
utils = self.canvas.snappingUtils()
SegmentLocator = utils.snapToCurrentLayer(startingPoint, 2)
if SegmentLocator.isValid():
edge = SegmentLocator.edgePoints()
pt1 = edge[1]
pt2 = edge[0]
Now I try to set up the MatchFilter to get matches only from a particular
feature ID. But I don't know how to begin. The following code dosen't work.
fid = self.layer.selectedFeaturesIds()[0]
filter = QgsPointLocator.MatchFilter
match = QgsPointLocator.Match()
filter.acceptMatch(match.featureId() == fid)
SegmentLocator = utils.snapToCurrentLayer(startingPoint, 2, filter)
It would be nice if somebody can help me.
--
View this message in context:
http://osgeo-org.1560.x6.nabble.com/How-to-set-up-QgsPointLocator-MatchFilter-in-python-tp5195736.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
_______________________________________________
Qgis-developer mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-developer