SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
maptoolfeaturedraw.h File Reference
#include "map/tools/maptool.h"
#include "map/snapengine.h"
#include "feature/featuregeometry.h"
#include "feature/featuretypes.h"
#include <QPointF>
#include <QPointer>
#include <QVector>
Include dependency graph for maptoolfeaturedraw.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  OpenSWMMVisMapToolFeatureDrawBase
 Shared vertex accumulation, rubber band, snapping and commit. More...
 
class  OpenSWMMVisMapToolDrawPoint
 Click once to place a point feature. More...
 
class  OpenSWMMVisMapToolDrawLine
 Click to add vertices, double-click or Enter to finish a polyline. More...
 
class  OpenSWMMVisMapToolDrawPolygon
 Click to add vertices, double-click or Enter to close a polygon. More...
 

Detailed Description

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
Date
2026
License\n GPL-3.0-or-later

Digitising tools that draw into a FeatureLayer (workplans/MESH_DIALOG_TABS_AND_FEATURE_LAYERS_PLAN_2026-09-07.md §3.3).

The interaction contract is copied verbatim from OpenSWMMVisMapToolAddSubcatchment (maptooladdsubcatchment.h:23-29) so a user who can draw a subcatchment can draw a feature without learning anything:

left click append a vertex (snapped) right click remove the last vertex; cancel when only one remains double click commit, INCLUDING the double-clicked point as the final vertex (Qt sends only one press per double-click pair, so there is no duplicate to drop) Return / Enter commit Escape cancel

Vertices are accumulated in CANVAS CRS, because the rubber-band paint runs through toPixelCoords which expects canvas coordinates; commit() converts once. That is the same split the subcatchment tool documents at maptooladdsubcatchment.cpp:86-95 — the difference is that a FeatureLayer declares its own CRS, so the conversion goes through the layer's transform rather than SWMMModelLayer::transformCanvasToLayer.

The tools never write to the layer directly: every commit pushes an AddFeatureCommand onto the canvas undo stack (CLAUDE.md §5.1 — the tool is the controller, the layer is the model).