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
maptooladdnode.h
Go to the documentation of this file.
1
9#ifndef MAPTOOLADDNODE_H
10#define MAPTOOLADDNODE_H
11
13#include "map/tools/maptool.h"
14#include "map/snapengine.h"
15
16#include <QColor>
17#include <QString>
18
19class GISRasterLayer;
20class SWMMModelLayer;
21
50{
51 Q_OBJECT
52
53public:
63 const QString &elementKind,
64 QObject *parent = nullptr);
65
66 [[nodiscard]] QCursor cursor() const override;
67
68 void activate() override;
69 void deactivate() override;
70
71 void mousePressEvent (QMouseEvent *event) override;
72 void mouseReleaseEvent(QMouseEvent *event) override;
73 void mouseMoveEvent (QMouseEvent *event) override;
74 void paint(QPainter *painter, const MapExtent &extent,
75 const SpatialReferenceSystem *srs) override;
76
87 void setTerrain(GISRasterLayer *layer, double offset, double factor = 1.0);
88
91 [[nodiscard]] bool kindCanSplitConduit() const;
92
93 [[nodiscard]] int nodeType() const { return m_nodeType; }
94
95signals:
96 void nodeAdded(const QString &name, int nodeType, double x, double y);
98 void nodeInsertedOnConduit(const QString &nodeName,
99 const QString &splitLinkName,
100 const QString &newLinkName);
101 void statusMessageChanged(const QString &message);
102
103private:
104 [[nodiscard]] SWMMModelLayer *activeModelLayer() const;
105
110 [[nodiscard]] QString nextAvailableName(SWMMModelLayer *layer) const;
111
113 [[nodiscard]] QString kindLabel() const;
115 [[nodiscard]] QColor markerColor(const SWMMModelLayer *layer) const;
116
117 void commitFreePlacement(SWMMModelLayer *layer, double mapX, double mapY);
118 void commitSplit(const ConduitSplitPick::ConduitHit &hit);
119
120 int m_nodeType;
121 QString m_elementKind;
122 SnapEngine::Result m_snap;
124 bool m_armed = false;
125
126 GISRasterLayer *m_terrainLayer = nullptr;
127 double m_terrainOffset = 0.0;
128 double m_terrainFactor = 1.0; // raster → model vertical unit
129};
130
131#endif // MAPTOOLADDNODE_H
A map layer backed by a GDAL raster dataset.
Definition gisrasterlayer.h:61
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
Left-click on the canvas to place a new SWMM node.
Definition maptooladdnode.h:50
int nodeType() const
Definition maptooladdnode.h:93
void deactivate() override
Called by the canvas when another tool replaces this one.
Definition maptooladdnode.cpp:71
void mouseReleaseEvent(QMouseEvent *event) override
Definition maptooladdnode.cpp:125
QCursor cursor() const override
Returns the mouse cursor to display while this tool is active.
Definition maptooladdnode.cpp:35
bool kindCanSplitConduit() const
Whether this tool's node kind may be inserted mid-conduit — every kind but OUTFALL.
Definition maptooladdnode.cpp:40
void statusMessageChanged(const QString &message)
void setTerrain(GISRasterLayer *layer, double offset, double factor=1.0)
Sets the active terrain layer and node offset used to auto-fill InvertElev when a node is placed free...
Definition maptooladdnode.cpp:111
void activate() override
Called by the canvas when this tool becomes the active tool.
Definition maptooladdnode.cpp:55
void nodeAdded(const QString &name, int nodeType, double x, double y)
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 maptooladdnode.cpp:252
void nodeInsertedOnConduit(const QString &nodeName, const QString &splitLinkName, const QString &newLinkName)
void mouseMoveEvent(QMouseEvent *event) override
Definition maptooladdnode.cpp:96
void mousePressEvent(QMouseEvent *event) override
Definition maptooladdnode.cpp:118
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
Shared "which conduit is under the cursor, and where along it" hit-test used by every tool that inser...
QString nodeName
Definition importplanning.cpp:95
Abstract base class for all interactive tools attached to a MapCanvas.
QVector< int > parent
union-find
Definition pslgminsize.cpp:176
QString message
Definition queryparser.cpp:150
QString name
Definition sectionmodelbuilders.cpp:474
Shared vertex-snapping helper for all drawing map tools.
Definition conduitsplitpick.h:31
Definition snapengine.h:38