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
inletpropertybag.h
Go to the documentation of this file.
1
31#ifndef OPENSWMMVIS_UI_DIALOGS_INLETPROPERTYBAG_H
32#define OPENSWMMVIS_UI_DIALOGS_INLETPROPERTYBAG_H
33
34#include "inlet/inletprovider.h"
35
36#include <QObject>
37#include <QPointer>
38#include <QString>
39
40#include <functional>
41
42namespace openswmmvis::ui {
43
44class InletPropertyBag : public QObject
45{
46 Q_OBJECT
47
48 // ---- Grate -------------------------------------------------------------
50 Q_PROPERTY(double grateLength READ grateLength WRITE setGrateLength NOTIFY grateLengthChanged)
51 Q_PROPERTY(double grateWidth READ grateWidth WRITE setGrateWidth NOTIFY grateWidthChanged)
52 Q_PROPERTY(double openFraction READ openFraction WRITE setOpenFraction NOTIFY openFractionChanged)
54
55 // ---- Curb opening ------------------------------------------------------
56 Q_PROPERTY(double curbLength READ curbLength WRITE setCurbLength NOTIFY curbLengthChanged)
57 Q_PROPERTY(double curbHeight READ curbHeight WRITE setCurbHeight NOTIFY curbHeightChanged)
59
60 // ---- Slotted drain -----------------------------------------------------
61 Q_PROPERTY(double slotLength READ slotLength WRITE setSlotLength NOTIFY slotLengthChanged)
62 Q_PROPERTY(double slotWidth READ slotWidth WRITE setSlotWidth NOTIFY slotWidthChanged)
63
64 // ---- Custom ------------------------------------------------------------
66 Q_PROPERTY(QString curveId READ curveId WRITE setCurveId NOTIFY curveIdChanged)
67
68public:
73 enum class GrateTypeQ : int {
74 P_BAR_50 = static_cast<int>(inlet::GrateType::PBar50),
76 P_BAR_30 = static_cast<int>(inlet::GrateType::PBar30),
77 CURVED_VANE = static_cast<int>(inlet::GrateType::CurvedVane),
78 TILT_BAR_45 = static_cast<int>(inlet::GrateType::TiltBar45),
79 TILT_BAR_30 = static_cast<int>(inlet::GrateType::TiltBar30),
80 RETICULINE = static_cast<int>(inlet::GrateType::Reticuline),
81 GENERIC = static_cast<int>(inlet::GrateType::Generic),
82 };
83 Q_ENUM(GrateTypeQ)
84
85 enum class ThroatTypeQ : int {
86 HORIZONTAL = static_cast<int>(inlet::ThroatType::Horizontal),
87 INCLINED = static_cast<int>(inlet::ThroatType::Inclined),
88 VERTICAL = static_cast<int>(inlet::ThroatType::Vertical),
89 };
90 Q_ENUM(ThroatTypeQ)
91
92 enum class CurveKindQ : int {
93 NONE = static_cast<int>(inlet::InletCurveKind::None),
95 RATING = static_cast<int>(inlet::InletCurveKind::Rating),
96 };
97 Q_ENUM(CurveKindQ)
98
99
100 enum Group {
101 NoGroup = 0x0,
106 };
107 Q_DECLARE_FLAGS(Groups, Group)
108
109
112 using CommitFn = std::function<void(const inlet::InletDesignData &before,
113 const inlet::InletDesignData &after)>;
114
115 explicit InletPropertyBag(QObject *parent = nullptr);
116
117 void bind(inlet::InletProvider *p);
118 inlet::InletProvider *provider() const noexcept;
119
120 void setCommitHandler(CommitFn fn);
121
123 Groups visibleGroups() const;
124
126 static Groups groupsFor(inlet::InletType t);
127
129 static Group groupOf(const QString &property);
130
134 Q_INVOKABLE bool isPropertyVisible(const QString &property) const;
135
138 Q_INVOKABLE QString displayLabelFor(const QString &property) const;
139
140 GrateTypeQ grateType() const noexcept { return m_grateType; }
141 double grateLength() const noexcept { return m_grateLength; }
142 double grateWidth() const noexcept { return m_grateWidth; }
143 double openFraction() const noexcept { return m_openFraction; }
144 double splashVelocity() const noexcept { return m_splashVelocity; }
145 double curbLength() const noexcept { return m_curbLength; }
146 double curbHeight() const noexcept { return m_curbHeight; }
147 ThroatTypeQ throatAngle() const noexcept { return m_throatAngle; }
148 double slotLength() const noexcept { return m_slotLength; }
149 double slotWidth() const noexcept { return m_slotWidth; }
150 CurveKindQ curveKind() const noexcept { return m_curveKind; }
151 QString curveId() const { return m_curveId; }
152
153public slots:
155 void setGrateLength(double v);
156 void setGrateWidth(double v);
157 void setOpenFraction(double v);
158 void setSplashVelocity(double v);
159 void setCurbLength(double v);
160 void setCurbHeight(double v);
162 void setSlotLength(double v);
163 void setSlotWidth(double v);
165 void setCurveId(const QString &v);
166
167signals:
169 void grateLengthChanged(double);
170 void grateWidthChanged(double);
173 void curbLengthChanged(double);
174 void curbHeightChanged(double);
176 void slotLengthChanged(double);
177 void slotWidthChanged(double);
179 void curveIdChanged(const QString &);
180
181private slots:
182 void onProviderParamsChanged_();
183
184private:
185 void refreshFromProvider_();
186
190 void push_();
191
193 inlet::InletDesignData composed_() const;
194
195 QPointer<inlet::InletProvider> m_provider;
196 CommitFn m_commit;
197
198 GrateTypeQ m_grateType = GrateTypeQ::P_BAR_50;
199 double m_grateLength = 0.0;
200 double m_grateWidth = 0.0;
201 double m_openFraction = 0.0;
202 double m_splashVelocity = 0.0;
203 double m_curbLength = 0.0;
204 double m_curbHeight = 0.0;
205 ThroatTypeQ m_throatAngle = ThroatTypeQ::VERTICAL;
206 double m_slotLength = 0.0;
207 double m_slotWidth = 0.0;
208 CurveKindQ m_curveKind = CurveKindQ::NONE;
209 QString m_curveId;
210
211 bool m_suppressPush = false;
212};
213
214} // namespace openswmmvis::ui
215
216Q_DECLARE_OPERATORS_FOR_FLAGS(openswmmvis::ui::InletPropertyBag::Groups)
220
221#endif // OPENSWMMVIS_UI_DIALOGS_INLETPROPERTYBAG_H
Definition inletprovider.h:95
Definition inletpropertybag.h:45
double curbLength() const noexcept
Definition inletpropertybag.h:145
CurveKindQ curveKind() const noexcept
Definition inletpropertybag.h:150
double openFraction
Definition inletpropertybag.h:52
void bind(inlet::InletProvider *p)
Definition inletpropertybag.cpp:36
QString curveId
Definition inletpropertybag.h:66
void setCommitHandler(CommitFn fn)
Definition inletpropertybag.cpp:52
ThroatTypeQ throatAngle() const noexcept
Definition inletpropertybag.h:147
double curbLength
Definition inletpropertybag.h:56
double grateLength() const noexcept
Definition inletpropertybag.h:141
void setSplashVelocity(double v)
Definition inletpropertybag.cpp:258
QString curveId() const
Definition inletpropertybag.h:151
ThroatTypeQ throatAngle
Definition inletpropertybag.h:58
ThroatTypeQ
Definition inletpropertybag.h:85
void setOpenFraction(double v)
Definition inletpropertybag.cpp:250
void setSlotLength(double v)
Definition inletpropertybag.cpp:290
void setGrateWidth(double v)
Definition inletpropertybag.cpp:242
Q_INVOKABLE bool isPropertyVisible(const QString &property) const
Row-level visibility: group visibility plus the two legacy exceptions (open fraction / splash-over ve...
Definition inletpropertybag.cpp:104
void setGrateLength(double v)
Definition inletpropertybag.cpp:234
double splashVelocity
Definition inletpropertybag.h:53
CurveKindQ
Definition inletpropertybag.h:92
Group
Legacy tab-visibility groups (Dinlet.pas:241-298).
Definition inletpropertybag.h:100
@ CurbGroup
Definition inletpropertybag.h:103
@ SlottedGroup
Definition inletpropertybag.h:104
@ NoGroup
Definition inletpropertybag.h:101
@ CustomGroup
Definition inletpropertybag.h:105
@ GrateGroup
Definition inletpropertybag.h:102
void curveIdChanged(const QString &)
double slotLength() const noexcept
Definition inletpropertybag.h:148
Q_INVOKABLE QString displayLabelFor(const QString &property) const
Group-prefixed, unit-suffixed label for the QPropertyModel row. Empty for an unknown name so the gene...
Definition inletpropertybag.cpp:121
inlet::InletProvider * provider() const noexcept
Definition inletpropertybag.cpp:47
void throatAngleChanged(ThroatTypeQ)
double splashVelocity() const noexcept
Definition inletpropertybag.h:144
void setCurveId(const QString &v)
Definition inletpropertybag.cpp:314
static Groups groupsFor(inlet::InletType t)
Groups that apply to t. Pure — used by the tests.
Definition inletpropertybag.cpp:59
void setGrateType(GrateTypeQ v)
Definition inletpropertybag.cpp:226
GrateTypeQ
Q_ENUM mirrors of the openswmmvis::inlet design enums so QPropertyModel renders a combo-box for each....
Definition inletpropertybag.h:73
void setSlotWidth(double v)
Definition inletpropertybag.cpp:298
CurveKindQ curveKind
Definition inletpropertybag.h:65
double curbHeight() const noexcept
Definition inletpropertybag.h:146
void setThroatAngle(ThroatTypeQ v)
Definition inletpropertybag.cpp:282
double slotWidth
Definition inletpropertybag.h:62
void setCurbHeight(double v)
Definition inletpropertybag.cpp:274
double curbHeight
Definition inletpropertybag.h:57
GrateTypeQ grateType
Definition inletpropertybag.h:49
double grateLength
Definition inletpropertybag.h:50
double slotWidth() const noexcept
Definition inletpropertybag.h:149
std::function< void(const inlet::InletDesignData &before, const inlet::InletDesignData &after)> CommitFn
Commit hook. When installed, a bag edit is handed to the host (which wraps it in a SetInletParamsComm...
Definition inletpropertybag.h:113
static Group groupOf(const QString &property)
The group a raw Q_PROPERTY name belongs to.
Definition inletpropertybag.cpp:79
double grateWidth
Definition inletpropertybag.h:51
double openFraction() const noexcept
Definition inletpropertybag.h:143
double grateWidth() const noexcept
Definition inletpropertybag.h:142
Groups visibleGroups() const
Groups that apply to the bound design's type.
Definition inletpropertybag.cpp:73
double slotLength
Definition inletpropertybag.h:61
void setCurbLength(double v)
Definition inletpropertybag.cpp:266
void setCurveKind(CurveKindQ v)
Definition inletpropertybag.cpp:306
DiagramType t
Definition diagramspec.cpp:20
MVC model for a single SWMM inlet design ([INLETS]).
ArrowPlacement p
Definition linesymbollayer.cpp:27
@ Diversion
captured flow vs approach flow
@ Rating
captured flow vs water depth
Definition openswmmvislayer.h:43
QVector< int > v
pool vertex indices
Definition pslgminsize.cpp:159
QVector< int > parent
union-find
Definition pslgminsize.cpp:176
Every parameter of one inlet design, mirroring SWMM_InletDesign. Snapshot type for the undo commands ...
Definition inletprovider.h:70