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
maptooladdsubcatchment.h
Go to the documentation of this file.
1
8#ifndef MAPTOOLADDSUBCATCHMENT_H
9#define MAPTOOLADDSUBCATCHMENT_H
10
11#include "map/tools/maptool.h"
12#include "map/snapengine.h"
13
14#include <QPointF>
15#include <QString>
16#include <QVector>
17
18class SWMMModelLayer;
19
33{
34 Q_OBJECT
35
36public:
38 QObject *parent = nullptr);
39
40 [[nodiscard]] QCursor cursor() const override;
41
42 void activate() override;
43 void deactivate() override;
44
45 void mousePressEvent (QMouseEvent *event) override;
46 void mouseMoveEvent (QMouseEvent *event) override;
47 void mouseDoubleClickEvent(QMouseEvent *event) override;
48 void keyPressEvent (QKeyEvent *event) override;
49 void paint(QPainter *painter, const MapExtent &extent,
50 const SpatialReferenceSystem *srs) override;
51
52signals:
53 void subcatchmentAdded(const QString &name);
54
55private:
56 [[nodiscard]] SWMMModelLayer *activeModelLayer() const;
57 [[nodiscard]] QString nextAvailableName(SWMMModelLayer *layer) const;
58 void cancel();
59 void commit();
60
61 QVector<QPointF> m_vertices; // map coords of placed vertices
62 QPointF m_cursor; // current cursor in map coords (snapped)
63 bool m_drawing = false;
64 SnapEngine::Result m_snap; // last snap result for paint indicator
65};
66
67#endif // MAPTOOLADDSUBCATCHMENT_H
The central map display widget — QGIS-style hybrid rendering.
Definition mapcanvas.h:63
An axis-aligned bounding box in the coordinate space of a given CRS.
Definition mapextent.h:26
Click-to-place polygon vertices; double-click to close and commit.
Definition maptooladdsubcatchment.h:33
void keyPressEvent(QKeyEvent *event) override
Definition maptooladdsubcatchment.cpp:164
void activate() override
Called by the canvas when this tool becomes the active tool.
Definition maptooladdsubcatchment.cpp:33
QCursor cursor() const override
Returns the mouse cursor to display while this tool is active.
Definition maptooladdsubcatchment.cpp:28
void deactivate() override
Called by the canvas when another tool replaces this one.
Definition maptooladdsubcatchment.cpp:39
void paint(QPainter *painter, const MapExtent &extent, const SpatialReferenceSystem *srs) override
Called by the canvas in drawForeground() so the tool can draw transient overlay graphics (rubber-band...
Definition maptooladdsubcatchment.cpp:173
void mouseMoveEvent(QMouseEvent *event) override
Definition maptooladdsubcatchment.cpp:104
void subcatchmentAdded(const QString &name)
void mousePressEvent(QMouseEvent *event) override
Definition maptooladdsubcatchment.cpp:64
void mouseDoubleClickEvent(QMouseEvent *event) override
Definition maptooladdsubcatchment.cpp:123
Abstract base class for interactive map tools used in the MapCanvas.
Definition maptool.h:43
MapCanvas * canvas() const
Returns the MapCanvas this tool is attached to.
Definition maptool.cpp:29
Renders the SWMM network elements (nodes, links, subcatchments, rain gages) for one OpenSWMMEngine mo...
Definition swmmmodellayer.h:133
Represents a coordinate reference system backed by a GDAL OGRSpatialReference.
Definition spatialreferencesystem.h:28
Abstract base class for all interactive tools attached to a MapCanvas.
QVector< int > parent
union-find
Definition pslgminsize.cpp:176
QString name
Definition sectionmodelbuilders.cpp:474
Shared vertex-snapping helper for all drawing map tools.
Definition snapengine.h:38