[Qgis-developer] Where can I find "add feature" code?

Matthias Kuhn matthias.kuhn at gmx.ch
Mon May 20 04:55:53 PDT 2013


Hi Alexander,

You probably would want to create your own class which inherits 
QgsMapTool to receive the mouse events and manage the rubberband.

You'll find the code for the add feature tool in 
src/app/qgsmaptooladdfeature.{h|cpp} if you're looking for C++ code.

The attached link [1] points to a map tool I wrote (in python) which 
makes use of a line rubberband and some additional snapping stuff.

Regards,
Matthias

[1]:
https://github.com/qgep/QGEP/blob/master/qgepplugin/tools/qgepmaptools.py

On Mon 20 Mai 2013 12:30:22 CEST, Alexandre Neto wrote:
> Hello all,
>
> I'm looking for "add feature" code for inspiration for a plugin. But I
> can't seam to find it. My idea was to see the correct procedure to
> draw in canvas (respecting topology, avoid intersection, and so on).
>
> For what I have read, I think the procedure is something like:
>
> - Start a rubberBand;
> - On left-click add points to the rubberBand;
> - Update rubberband drawing as mouse moves;
> - On right-click finish rubberband;
> - Use finished rubberband somewhere (in my case use it to replace a
> feature geometry)
>
> Thanks,
>
> Alexandre Neto
>
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer




More information about the Qgis-developer mailing list