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
swmmsubcatchpropertyadapter.h
Go to the documentation of this file.
1
10#ifndef SWMMSUBCATCHPROPERTYADAPTER_H
11#define SWMMSUBCATCHPROPERTYADAPTER_H
12
13#include <QObject>
14#include <QString>
15#include <QUuid> // Stats-source identity (QA.2 mirror)
16
17#include <openswmm/engine/openswmm_engine.h>
18
19#include "ui/properties/userflagseditref.h" // USER_FLAGS Phase 4
20#include "ui/properties/dataobjectref.h" // Phase 3 — gage / outlet pickers
21#include "ui/properties/subcatchcompoundeditref.h" // Phase 3 — landuse/GW/LID
22
23class SWMMModelLayer;
24
25namespace openswmmvis { class OutputStatsRegistry; } // QA.2 mirror
26
27class SWMMSubcatchPropertyAdapter : public QObject
28{
29 Q_OBJECT
30 Q_PROPERTY(QString name READ name WRITE setName)
36 Q_PROPERTY(QString tag READ tag WRITE setTag NOTIFY changed)
37 Q_PROPERTY(double area READ area WRITE setArea NOTIFY changed)
38 Q_PROPERTY(double width READ width WRITE setWidth NOTIFY changed)
39 Q_PROPERTY(double slope READ slope WRITE setSlope NOTIFY changed)
40 Q_PROPERTY(double impervPct READ impervPct WRITE setImpervPct NOTIFY changed)
41 Q_PROPERTY(double pctZeroImperv READ pctZeroImperv WRITE setPctZeroImperv NOTIFY changed)
42 Q_PROPERTY(double nImperv READ nImperv WRITE setNImperv NOTIFY changed)
43 Q_PROPERTY(double nPerv READ nPerv WRITE setNPerv NOTIFY changed)
44 Q_PROPERTY(double dsImperv READ dsImperv WRITE setDsImperv NOTIFY changed)
45 Q_PROPERTY(double dsPerv READ dsPerv WRITE setDsPerv NOTIFY changed)
50 Q_PROPERTY(double rainScaleFactor READ rainScaleFactor WRITE setRainScaleFactor NOTIFY changed)
55 Q_PROPERTY(double snowScaleFactor READ snowScaleFactor WRITE setSnowScaleFactor NOTIFY changed)
56
57 // Phase 3 — Subcatchment gaps (docs/ATTRIBUTE_EDITOR_WIRING_PLAN_2026-06-04.md).
62 Q_PROPERTY(DataObjectRef outlet READ outletRef WRITE setOutletRef NOTIFY changed)
65 // Per-model parameter rows. Editability is gated by the live model in
66 // PropertiesPanel (mirror of the storage Functional/Tabular greying).
67 Q_PROPERTY(double hortonF0 READ hortonF0 WRITE setHortonF0 NOTIFY changed)
68 Q_PROPERTY(double hortonFmin READ hortonFmin WRITE setHortonFmin NOTIFY changed)
69 Q_PROPERTY(double hortonDecay READ hortonDecay WRITE setHortonDecay NOTIFY changed)
70 Q_PROPERTY(double hortonDryTime READ hortonDryTime WRITE setHortonDryTime NOTIFY changed)
71 Q_PROPERTY(double gaSuction READ gaSuction WRITE setGaSuction NOTIFY changed)
72 Q_PROPERTY(double gaConductivity READ gaConductivity WRITE setGaConductivity NOTIFY changed)
73 Q_PROPERTY(double gaInitDeficit READ gaInitDeficit WRITE setGaInitDeficit NOTIFY changed)
74 Q_PROPERTY(double cnNumber READ cnNumber WRITE setCnNumber NOTIFY changed)
75 Q_PROPERTY(double cnDryTime READ cnDryTime WRITE setCnDryTime NOTIFY changed)
76 // Compound cells (open SubcatchCompoundEditDialog tabs).
78 READ landUseRef WRITE setLandUseRef NOTIFY changed)
86 READ lidUsageRef WRITE setLidUsageRef NOTIFY changed)
88 READ loadingsRef WRITE setLoadingsRef NOTIFY changed)
89
93 READ userFlagsRef WRITE setUserFlagsRef NOTIFY changed)
94
95 // Read-only post-run summary (no WRITE → non-editable). Mirrors the
96 // Attribute Table's subcatchment dynamics columns; values follow the
97 // bound stats source (see setStatsSource below).
98 Q_PROPERTY(double statPrecip READ statPrecip NOTIFY changed)
99 Q_PROPERTY(double statRunoffVol READ statRunoffVol NOTIFY changed)
100 Q_PROPERTY(double statMaxRunoff READ statMaxRunoff NOTIFY changed)
101
102public:
104 enum InfilModel { Horton = 0, ModHorton = 1, GreenAmpt = 2,
106 Q_ENUM(InfilModel)
107
109 QObject *parent = nullptr);
110
114 void setModelLayer(SWMMModelLayer *layer) { m_layer = layer; }
115 [[nodiscard]] SWMMModelLayer *modelLayer() const { return m_layer; }
116
117 [[nodiscard]] UserFlagsEditRef userFlagsRef() const;
118
119 [[nodiscard]] QString name() const { return m_name; }
120 [[nodiscard]] QString tag() const;
121
122 [[nodiscard]] double area() const;
123 [[nodiscard]] double width() const;
124 [[nodiscard]] double slope() const;
125 [[nodiscard]] double impervPct() const;
126 [[nodiscard]] double pctZeroImperv() const;
127 [[nodiscard]] double nImperv() const;
128 [[nodiscard]] double nPerv() const;
129 [[nodiscard]] double dsImperv() const;
130 [[nodiscard]] double dsPerv() const;
131 [[nodiscard]] double rainScaleFactor() const;
132 [[nodiscard]] double snowScaleFactor() const;
133
134 // Phase 3 — picker / enum / infiltration param accessors.
135 [[nodiscard]] DataObjectRef rainGageRef() const;
136 [[nodiscard]] DataObjectRef outletRef() const;
137 [[nodiscard]] InfilModel infilModel() const;
138 [[nodiscard]] double hortonF0() const;
139 [[nodiscard]] double hortonFmin() const;
140 [[nodiscard]] double hortonDecay() const;
141 [[nodiscard]] double hortonDryTime() const;
142 [[nodiscard]] double gaSuction() const;
143 [[nodiscard]] double gaConductivity() const;
144 [[nodiscard]] double gaInitDeficit() const;
145 [[nodiscard]] double cnNumber() const;
146 [[nodiscard]] double cnDryTime() const;
147 [[nodiscard]] SubcatchCompoundEditRef landUseRef() const;
148 [[nodiscard]] DataObjectRef aquiferRef() const;
149 [[nodiscard]] SubcatchCompoundEditRef groundwaterRef() const;
150 [[nodiscard]] SubcatchCompoundEditRef lidUsageRef() const;
151 [[nodiscard]] SubcatchCompoundEditRef loadingsRef() const;
152
153 // Read-only post-run summary getters. Zero until a run's results are
154 // bound via setStatsSource (mirror of SWMMNodePropertyAdapter QA.2).
155 [[nodiscard]] double statPrecip() const;
156 [[nodiscard]] double statRunoffVol() const;
157 [[nodiscard]] double statMaxRunoff() const;
158
162 void setStatsSource(const QUuid &id);
163 [[nodiscard]] QUuid statsSourceId() const { return m_statsSourceId; }
164
166 Q_INVOKABLE QString displayLabelFor(const QString &property) const;
167
168public slots:
169 void setName(const QString &newName);
170 void setTag(const QString &t);
171 void setArea(double v);
172 void setWidth(double v);
173 void setSlope(double v);
174 void setImpervPct(double v);
175 void setPctZeroImperv(double v);
176 void setNImperv(double v);
177 void setNPerv(double v);
178 void setDsImperv(double v);
179 void setDsPerv(double v);
180 void setRainScaleFactor(double v);
181 void setSnowScaleFactor(double v);
182
183 // Phase 3 — picker / enum / infiltration param write slots.
184 void setRainGageRef(const DataObjectRef &r);
185 void setOutletRef(const DataObjectRef &r);
187 void setHortonF0(double v);
188 void setHortonFmin(double v);
189 void setHortonDecay(double v);
190 void setHortonDryTime(double v);
191 void setGaSuction(double v);
192 void setGaConductivity(double v);
193 void setGaInitDeficit(double v);
194 void setCnNumber(double v);
195 void setCnDryTime(double v);
196 void setAquiferRef(const DataObjectRef &r);
197 // Compound refs are coordinates only; the dialog performs the writes.
202
203 void setUserFlagsRef(const UserFlagsEditRef &) { emit changed(); }
204
206 void refresh() { emit changed(); }
207
209 void updateStoredName(const QString &newName) { m_name = newName; }
210
211signals:
212 void changed();
213 void renameRequested(const QString &oldName, const QString &newName);
216
217private:
218 [[nodiscard]] int idx() const;
221 void writeCurveNumber(double cn, double dryTime);
222 SWMM_Engine m_engine;
223 QString m_name;
224 SWMMModelLayer *m_layer = nullptr;
225
227 QUuid m_statsSourceId;
228 openswmmvis::OutputStatsRegistry *m_statsRegistry = nullptr;
229};
230
231#endif // SWMMSUBCATCHPROPERTYADAPTER_H
Renders the SWMM network elements (nodes, links, subcatchments, rain gages) for one OpenSWMMEngine mo...
Definition swmmmodellayer.h:133
Definition swmmsubcatchpropertyadapter.h:28
double pctZeroImperv() const
void setName(const QString &newName)
Definition swmmsubcatchpropertyadapter.cpp:148
void setModelLayer(SWMMModelLayer *layer)
Definition swmmsubcatchpropertyadapter.h:114
SubcatchCompoundEditRef landUse
Definition swmmsubcatchpropertyadapter.h:78
double statMaxRunoff
Definition swmmsubcatchpropertyadapter.h:100
void setRainGageRef(const DataObjectRef &r)
Definition swmmsubcatchpropertyadapter.cpp:272
void setGaConductivity(double v)
Definition swmmsubcatchpropertyadapter.cpp:456
double nImperv
Definition swmmsubcatchpropertyadapter.h:42
UserFlagsEditRef userFlagsRef() const
Definition swmmsubcatchpropertyadapter.cpp:179
double rainScaleFactor
Definition swmmsubcatchpropertyadapter.h:50
void setTag(const QString &t)
Definition swmmsubcatchpropertyadapter.cpp:170
void refresh()
Definition swmmsubcatchpropertyadapter.h:206
void setCnDryTime(double v)
Definition swmmsubcatchpropertyadapter.cpp:510
double impervPct
Definition swmmsubcatchpropertyadapter.h:40
void setOutletRef(const DataObjectRef &r)
Definition swmmsubcatchpropertyadapter.cpp:307
void setGroundwaterRef(const SubcatchCompoundEditRef &)
Definition swmmsubcatchpropertyadapter.h:199
double hortonDecay
Definition swmmsubcatchpropertyadapter.h:69
double hortonF0
Definition swmmsubcatchpropertyadapter.h:67
void setCnNumber(double v)
Definition swmmsubcatchpropertyadapter.cpp:506
void setLoadingsRef(const SubcatchCompoundEditRef &)
Definition swmmsubcatchpropertyadapter.h:201
InfilModel infilModel
Definition swmmsubcatchpropertyadapter.h:64
void setGaSuction(double v)
Definition swmmsubcatchpropertyadapter.cpp:445
void setRainScaleFactor(double v)
double statRunoffVol
Definition swmmsubcatchpropertyadapter.h:99
double gaInitDeficit
Definition swmmsubcatchpropertyadapter.h:73
double cnNumber
Definition swmmsubcatchpropertyadapter.h:74
SubcatchCompoundEditRef lidUsage
Definition swmmsubcatchpropertyadapter.h:86
SubcatchCompoundEditRef landUseRef() const
Definition swmmsubcatchpropertyadapter.cpp:516
void setStatsRegistry(openswmmvis::OutputStatsRegistry *registry)
DataObjectRef rainGageRef() const
Definition swmmsubcatchpropertyadapter.cpp:256
double dsImperv
Definition swmmsubcatchpropertyadapter.h:44
SubcatchCompoundEditRef loadings
Definition swmmsubcatchpropertyadapter.h:88
void setLidUsageRef(const SubcatchCompoundEditRef &)
Definition swmmsubcatchpropertyadapter.h:200
double width
Definition swmmsubcatchpropertyadapter.h:38
void setHortonDryTime(double v)
Definition swmmsubcatchpropertyadapter.cpp:411
double gaSuction
Definition swmmsubcatchpropertyadapter.h:71
void setUserFlagsRef(const UserFlagsEditRef &)
Definition swmmsubcatchpropertyadapter.h:203
void setPctZeroImperv(double v)
UserFlagsEditRef userFlags
Definition swmmsubcatchpropertyadapter.h:93
SubcatchCompoundEditRef groundwater
Definition swmmsubcatchpropertyadapter.h:84
void setLandUseRef(const SubcatchCompoundEditRef &)
Definition swmmsubcatchpropertyadapter.h:198
double statPrecip
Definition swmmsubcatchpropertyadapter.h:98
void setSnowScaleFactor(double v)
Definition swmmsubcatchpropertyadapter.cpp:242
double slope
Definition swmmsubcatchpropertyadapter.h:39
double statMaxRunoff() const
SubcatchCompoundEditRef lidUsageRef() const
Definition swmmsubcatchpropertyadapter.cpp:575
void setStatsSource(const QUuid &id)
Definition swmmsubcatchpropertyadapter.cpp:141
DataObjectRef outlet
Definition swmmsubcatchpropertyadapter.h:62
DataObjectRef outletRef() const
Definition swmmsubcatchpropertyadapter.cpp:283
InfilModel
Definition swmmsubcatchpropertyadapter.h:104
@ GreenAmpt
Definition swmmsubcatchpropertyadapter.h:104
@ Horton
Definition swmmsubcatchpropertyadapter.h:104
@ CurveNumber
Definition swmmsubcatchpropertyadapter.h:105
@ ModGreenAmpt
Definition swmmsubcatchpropertyadapter.h:105
@ ModHorton
Definition swmmsubcatchpropertyadapter.h:104
double pctZeroImperv
Definition swmmsubcatchpropertyadapter.h:41
DataObjectRef aquifer
Definition swmmsubcatchpropertyadapter.h:82
double cnDryTime
Definition swmmsubcatchpropertyadapter.h:75
double area
Definition swmmsubcatchpropertyadapter.h:37
Q_INVOKABLE QString displayLabelFor(const QString &property) const
Definition swmmsubcatchpropertyadapter.cpp:34
double rainScaleFactor() const
double hortonFmin
Definition swmmsubcatchpropertyadapter.h:68
QString name
Definition swmmsubcatchpropertyadapter.h:30
void setAquiferRef(const DataObjectRef &r)
Definition swmmsubcatchpropertyadapter.cpp:552
QString tag
Definition swmmsubcatchpropertyadapter.h:36
double statRunoffVol() const
double gaConductivity
Definition swmmsubcatchpropertyadapter.h:72
void setInfilModel(InfilModel m)
Definition swmmsubcatchpropertyadapter.cpp:337
DataObjectRef aquiferRef() const
Definition swmmsubcatchpropertyadapter.cpp:536
void setHortonFmin(double v)
Definition swmmsubcatchpropertyadapter.cpp:389
QUuid statsSourceId() const
Definition swmmsubcatchpropertyadapter.h:163
void setGaInitDeficit(double v)
Definition swmmsubcatchpropertyadapter.cpp:467
double dsPerv
Definition swmmsubcatchpropertyadapter.h:45
DataObjectRef rainGage
Definition swmmsubcatchpropertyadapter.h:59
QString name() const
Definition swmmsubcatchpropertyadapter.h:119
SWMMModelLayer * modelLayer() const
Definition swmmsubcatchpropertyadapter.h:115
double nPerv
Definition swmmsubcatchpropertyadapter.h:43
void renameRequested(const QString &oldName, const QString &newName)
void updateStoredName(const QString &newName)
Definition swmmsubcatchpropertyadapter.h:209
SubcatchCompoundEditRef loadingsRef() const
Definition swmmsubcatchpropertyadapter.cpp:596
void setHortonDecay(double v)
Definition swmmsubcatchpropertyadapter.cpp:400
SubcatchCompoundEditRef groundwaterRef() const
Definition swmmsubcatchpropertyadapter.cpp:566
double snowScaleFactor
Definition swmmsubcatchpropertyadapter.h:55
double hortonDryTime
Definition swmmsubcatchpropertyadapter.h:70
void setHortonF0(double v)
Definition swmmsubcatchpropertyadapter.cpp:378
Definition outputstatsregistry.h:70
DiagramType t
Definition diagramspec.cpp:20
MaskMode m
Definition maskspec.cpp:18
Definition aquiferprovider.h:21
void * SWMM_Engine
Definition objectdefaultsapplier.h:19
QVector< int > v
pool vertex indices
Definition pslgminsize.cpp:159
QVector< int > parent
union-find
Definition pslgminsize.cpp:176
Definition dataobjectref.h:34
Definition subcatchcompoundeditref.h:26
Definition userflagseditref.h:29