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
maptoolpicknode.h
Go to the documentation of this file.
1
17#ifndef MAPTOOLPICKNODE_H
18#define MAPTOOLPICKNODE_H
19
20#include "map/tools/maptool.h"
21
22#include <QString>
23
24class SWMMModelLayer;
25
27{
28 Q_OBJECT
29
30public:
31 explicit OpenSWMMVisMapToolPickNode(MapCanvas *canvas, QObject *parent = nullptr);
32
33 [[nodiscard]] QCursor cursor() const override;
34
35 void activate() override;
36 void deactivate() override;
37
38 void mousePressEvent (QMouseEvent *event) override;
39 void mouseReleaseEvent(QMouseEvent *event) override;
40 void mouseMoveEvent (QMouseEvent *event) override;
41 void keyPressEvent (QKeyEvent *event) override;
42 void paint(QPainter *painter, const MapExtent &extent,
43 const SpatialReferenceSystem *srs) override;
44
45signals:
47 void nodePicked(SWMMModelLayer *layer, const QString &name, int nodeIdx);
49 void cancelled();
50
51private:
52 struct NodeHit {
53 SWMMModelLayer *layer = nullptr;
54 QString name;
55 int idx = -1;
56 [[nodiscard]] bool valid() const { return layer != nullptr && idx >= 0; }
57 };
59 [[nodiscard]] NodeHit hitNode(const QPoint &pixel) const;
60
61 NodeHit m_hover;
62 bool m_armed = false;
63};
64
65#endif // MAPTOOLPICKNODE_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
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
Definition maptoolpicknode.h:27
void deactivate() override
Called by the canvas when another tool replaces this one.
Definition maptoolpicknode.cpp:38
void mouseReleaseEvent(QMouseEvent *event) override
Definition maptoolpicknode.cpp:89
void mousePressEvent(QMouseEvent *event) override
Definition maptoolpicknode.cpp:84
void nodePicked(SWMMModelLayer *layer, const QString &name, int nodeIdx)
void mouseMoveEvent(QMouseEvent *event) override
Definition maptoolpicknode.cpp:77
void keyPressEvent(QKeyEvent *event) override
Definition maptoolpicknode.cpp:100
void activate() override
Called by the canvas when this tool becomes the active tool.
Definition maptoolpicknode.cpp:31
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 maptoolpicknode.cpp:110
QCursor cursor() const override
Returns the mouse cursor to display while this tool is active.
Definition maptoolpicknode.cpp:26
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