Hi all!
I'm trying to snap a vertex with my python plugin. (Many thanks to Martin for
the quick work with the bindings!)
My code looks like this:
def canvasReleaseEvent(self,event):
x = event.pos().x()
y = event.pos().y()
startingPoint = QPoint(x,y)
result = []
excludePoints = []
snapper = QgsMapCanvasSnapper(self.canvas)
snapper.snapToCurrentLayer (startingPoint,result,QgsSnapper.SnapToVertex,
10000, excludePoints)
print "result: ",result
The problem is, whatever I do, the result keeps empty. I tried to play with
tolerance and scale and I'm quite sure it has to find a vertex but without any
success (the layer unit is meter).
So I thought about using QgsSnapper directly. But I'm not able to set it up
properly. Doing the following snippet always leads to a attribut error on the
snapLayer struct.
snapLayer = QgsSnapper.SnapLayer
snapLayer.mLayer = self.iface.mapCanvas().currentLayer()
snapLayer.mTolerance = 1000
snapLayer.mSnapTo = QgsSnapper.SnapToVertex
So, if anyone has a hint why the QgsMapCanvasSnapper doesn't want to give me a
result or how I set up the struct correctly, it would be wonderful to share it
with me :-)
Best regards and kudos to all the helping people here on the list!
Cédric
mit freundlichen Grüssen
Cédric Möri
GIS-Informatiker
--
Kanton Solothurn
Bau- und Justizdepartement
Amt für Geoinformation
Rötistrasse 4
4501 Solothurn
Telefon: +41 (0)32 627 24 75
Telefax: +41 (0)32 627 22 14
mailto:[EMAIL PROTECTED]
http://www.agi.so.ch
_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/qgis-user