Hi Martin Thanks a lot! It works for me now.
Regards, Marco On Wednesday 19 November 2008 21:12:39 Martin Dobias wrote: > Hi, > > On Tue, Nov 18, 2008 at 11:00 PM, Hugentobler Marco > > <[EMAIL PROTECTED]> wrote: > > Hi Cedric > > > > I used your code lines and started the debugger. It seems that the > > QgsMapCanvasSnapper works correctly. I think the problem has to do with > > the QList reference in the binding: > > > > int snapToCurrentLayer( const QPoint& p, QList<QgsSnappingResult>& > > results, QgsSnapper::SnappingType snap_to, double snappingTol = -1, const > > QList<QgsPoint>& excludePoints = QList<QgsPoint>() ); > > > > I tried to change that to: > > > > int snapToCurrentLayer( const QPoint& p, QList<QgsSnappingResult>& > > results /Out/, QgsSnapper::SnappingType snap_to, double snappingTol = -1, > > const QList<QgsPoint>& excludePoints = QList<QgsPoint>() ); > > you're right, this is the correct binding. I've fixed that in r9671. > Now in python one will call snapToCurrentLayer like this: > > (retval, results) = mcs.snapToCurrentLayer(pnt, > QgsSnapper.SnapToVertex, 0.002, [] ) > > The last two parameters are optional also in Python. > > > But then Python complains about a wrong type of the results parameter > > with your code. I tried to use a 'QList' instead of '[]', but it seems > > there is no QList in PyQt? > > > > Python experts: How can we deal with QList in PyQGIS? > > As Carson noted already, you can use python array for QList (and > python dictionary for QMap). > Python doesn't support C++-style templates, so SIP allows developers > to implement conversion between templates and python objects, this > mechanism is used in PyQt for these conversions. > > Martin -- Dr. Marco Hugentobler Institute of Cartography ETH Zurich Technical Advisor QGIS Project Steering Committee _______________________________________________ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user