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
pollutanteditordialog.h
Go to the documentation of this file.
1
27#ifndef OPENSWMMVIS_UI_DIALOGS_POLLUTANTEDITORDIALOG_H
28#define OPENSWMMVIS_UI_DIALOGS_POLLUTANTEDITORDIALOG_H
29
30#include <QDialog>
31#include <QPointer>
32
33class QCheckBox;
34class QComboBox;
35class QDoubleSpinBox;
36class QLineEdit;
37class QListView;
38class QPushButton;
39class QSplitter;
40
41class SWMMModelLayer;
42
43namespace openswmmvis::pollutant {
44class PollutantProvider;
45class PollutantRegistry;
46}
47
48namespace openswmmvis::ui {
49
50class PollutantListModel;
51
52class PollutantEditorDialog : public QDialog
53{
54 Q_OBJECT
55public:
56 enum class Mode { Edit, CreateNew };
57 Q_ENUM(Mode)
58
60 SWMMModelLayer *layer,
61 QWidget *parent = nullptr);
63
66 SWMMModelLayer *layer,
67 QWidget *parent = nullptr);
68
72 static QString pickPollutant(
74 SWMMModelLayer *layer,
75 const QString &initialName,
76 QWidget *parent = nullptr);
77
78 Mode mode() const noexcept { return m_mode; }
80
81 // ── Test hooks ──────────────────────────────────────────────────────────
82 QListView *listView() const noexcept { return m_listView; }
83 PollutantListModel *listModel() const noexcept { return m_listModel; }
84 QLineEdit *nameEdit() const noexcept { return m_nameEdit; }
85
86 void invokeNew();
87
88private slots:
89 void onListSelectionChanged_();
90 void onAddClicked_();
91 void onDeleteClicked_();
92 void onNameEdited_();
93 void onFieldEdited_();
94 void onProviderRenamed_(openswmmvis::pollutant::PollutantProvider *p,
95 const QString &prev, const QString &now);
96
97private:
98 void buildUi_();
100 void rebuildCoPollutantCombo_(openswmmvis::pollutant::PollutantProvider *current);
101 void selectProviderInList_(openswmmvis::pollutant::PollutantProvider *p);
102 QString suggestUniqueName_() const;
103
104 QPointer<openswmmvis::pollutant::PollutantRegistry> m_registry;
105 QPointer<SWMMModelLayer> m_layer;
106 QPointer<openswmmvis::pollutant::PollutantProvider> m_current;
107 Mode m_mode = Mode::Edit;
108
109 QSplitter *m_splitter = nullptr;
110
111 // Left pane.
112 QListView *m_listView = nullptr;
113 PollutantListModel *m_listModel = nullptr;
114 QPushButton *m_addBtn = nullptr;
115 QPushButton *m_delBtn = nullptr;
116
117 // Right pane (field form).
118 QLineEdit *m_nameEdit = nullptr;
119 QComboBox *m_unitsCombo = nullptr;
120 QDoubleSpinBox *m_rainSpin = nullptr;
121 QDoubleSpinBox *m_gwSpin = nullptr;
122 QDoubleSpinBox *m_rdiiSpin = nullptr;
123 QDoubleSpinBox *m_initSpin = nullptr;
124 QDoubleSpinBox *m_decaySpin = nullptr;
125 QDoubleSpinBox *m_mwtSpin = nullptr;
126 QCheckBox *m_snowOnlyCheck = nullptr;
127 QComboBox *m_coPollCombo = nullptr;
128 QDoubleSpinBox *m_coFracSpin = nullptr;
129
130 bool m_suppressFieldSync = false;
131};
132
133} // namespace openswmmvis::ui
134
135#endif // OPENSWMMVIS_UI_DIALOGS_POLLUTANTEDITORDIALOG_H
Renders the SWMM network elements (nodes, links, subcatchments, rain gages) for one OpenSWMMEngine mo...
Definition swmmmodellayer.h:133
Definition pollutantprovider.h:29
Definition pollutantregistry.h:24
Definition pollutanteditordialog.h:53
static PollutantEditorDialog * createNew(openswmmvis::pollutant::PollutantRegistry *registry, SWMMModelLayer *layer, QWidget *parent=nullptr)
Definition pollutanteditordialog.cpp:328
void invokeNew()
Definition pollutanteditordialog.cpp:319
QListView * listView() const noexcept
Definition pollutanteditordialog.h:82
QLineEdit * nameEdit() const noexcept
Definition pollutanteditordialog.h:84
static QString pickPollutant(openswmmvis::pollutant::PollutantRegistry *registry, SWMMModelLayer *layer, const QString &initialName, QWidget *parent=nullptr)
Definition pollutanteditordialog.cpp:339
openswmmvis::pollutant::PollutantProvider * currentProvider() const noexcept
Definition pollutanteditordialog.cpp:58
Mode
Definition pollutanteditordialog.h:56
Mode mode() const noexcept
Definition pollutanteditordialog.h:78
PollutantListModel * listModel() const noexcept
Definition pollutanteditordialog.h:83
Definition pollutantlistmodel.h:22
ArrowPlacement p
Definition linesymbollayer.cpp:27
Definition pollutantprovider.h:26
Definition openswmmvislayer.h:43
QVector< int > parent
union-find
Definition pslgminsize.cpp:176