[QGIS-Developer] New MapTools for Circle, ellipse, regular polygon

L.Bartoletti lbartoletti at tuxfamily.org
Wed May 24 22:07:32 PDT 2017


On 20 May 2017 at 04:16, L.Bartoletti <lbartoletti at tuxfamily.org> wrote:
>> Hello,
>>
>> I would like, if I have time, to add the GUI for the classes I recently
>> added (Circle, ellipse, regular polygon).
> Great news - I've long wanted a simple way to draw circles (and if I
> can add a feature request - rectangles too!). Thanks for all your
> recent work implementing the base components of this in the c++
> classes.
Thank you!
You can already do this via my plugin CADDigitize (rectangle too) or QAD 
(expect rectangle). Obviously, I can also add the rectangles. It will 
certainly be necessary to create a new class or modify QgsRectangle 
which today has no possibility of rotation (azimuth, inclination).
> Here's what I'd suggest:
>
> 1. QgsMapToolCapture needs refactoring. It's become quite messy and
> the interface is tied too heavily to the existing subclasses, making
> it difficult to add new capture tools. I think this should be
> refactored so that subclasses implement two virtual methods - one for
> returning the geometry for the temporary rubber band which is shown
> while moving the mouse during digitizing, and one for returning the
> actual created QgsGeometry corresponding to the current clicked
> points.
>
> 2. Create QgsMapToolAddFeature subclasses for each of the new "add
> shape" actions. Assuming that the QgsMapToolCapture API is cleaned,
> this should be quite simple to do for each shape type. I'd actually go
> crazy here - and add multiple tools for each shape type, so you could
> have tools for "add ellipse by center and radius", "add ellipse by
> bounding box", etc. Same for rectangles - we could have a "add
> rectangle by clicking two opposite corners tools", and an ArcGIS style
> "add rectangle by clicking one corner, clicking the other end of this
> side, and then clicking the opposite side tool" (see
> https://www.youtube.com/watch?v=YdeRhpDmf2s). This approach would
> automatically play very nicely with the existing advanced digitizing
> dock constraints + inbuilt snapping tools.
>
> 3. Expose these construction tools via a new toolbar. Group the
> similar tools together with the little down arrows to select between
> them + remember which was the last tool used and show that one by
> default (just like how the select tools are grouped and operate). So
> there'd be a group for rectangle construction, ellipse construction,
> regular polygon construction.
OK. I think it sounds like what I did with CADDigitize (for GUI part).
I think that it will also be necessary to modify classes for the snap if 
later we wish to realize ("CAD") modifications of entities (trim, 
extend, chamfer, bevel ...)
> (Incidentally - I really want to see this happen, and I'm happy to
> provide mentorship for these changes if you require.)
(Oh yeah, that would be great!)

Loïc.
> Nyall

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170525/b43058f8/attachment.html>


More information about the QGIS-Developer mailing list