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
inleteditordialog.h
Go to the documentation of this file.
1
32#ifndef OPENSWMMVIS_UI_DIALOGS_INLETEDITORDIALOG_H
33#define OPENSWMMVIS_UI_DIALOGS_INLETEDITORDIALOG_H
34
35#include "inlet/inletprovider.h"
36
37#include <QDialog>
38#include <QPointer>
39
40class QComboBox;
41class QLabel;
42class QLineEdit;
43class QListView;
44class QPropertyModel;
45class QPushButton;
46class QSplitter;
47class QStatusBar;
48class QTextEdit;
49class QToolBar;
50class QTreeView;
51class QUndoStack;
52
53class SWMMModelLayer;
54
55namespace openswmmvis::inlet {
56class InletProvider;
57class InletRegistry;
58}
59
60namespace openswmmvis::ui {
61
62class InletDrawingView;
63class InletListModel;
64class InletPropertyBag;
65
66class InletEditorDialog : public QDialog
67{
68 Q_OBJECT
69public:
70 enum class Mode { Edit, CreateNew };
71 Q_ENUM(Mode)
72
74 SWMMModelLayer *layer,
75 QUndoStack *undoStack,
76 QWidget *parent = nullptr);
78
81 SWMMModelLayer *layer,
82 QUndoStack *undoStack,
83 QWidget *parent = nullptr);
84
86 void openForInlet(const QString &name);
87
95 static QString pickInlet(openswmmvis::inlet::InletRegistry *registry,
96 SWMMModelLayer *layer,
97 QUndoStack *undoStack,
98 QWidget *parent,
99 int compatibleXsectShape = -1);
100
101 Mode mode() const noexcept { return m_mode; }
103
104 // ── Test hooks ──────────────────────────────────────────────────────────
105 QListView *listView() const noexcept { return m_listView; }
106 InletListModel *listModel() const noexcept { return m_listModel; }
107 QLineEdit *nameEdit() const noexcept { return m_nameEdit; }
108 QComboBox *typeCombo() const noexcept { return m_typeCombo; }
109 QTreeView *propertyTree() const noexcept { return m_propertyTree; }
110 InletDrawingView *drawingView() const noexcept { return m_drawing; }
111
112 void invokeNew();
114
115private slots:
116 void onListSelectionChanged_();
117 void onAddClicked_();
118 void onDeleteClicked_();
119 void onNameEdited_();
120 void onCommentsEdited_();
121 void onTypeComboChanged_(int index);
122 void onPickCurveClicked_();
123 void onCopyClicked_();
124 void onExportImageClicked_();
125 void onProviderRenamed_(openswmmvis::inlet::InletProvider *p,
126 const QString &prev, const QString &now);
127
128private:
129 void buildUi_();
130 void buildToolbar_();
131 void rebuildPropertyTree_();
132 void applyRowVisibility_();
133 void bindProvider_(openswmmvis::inlet::InletProvider *p);
134 void selectProviderInList_(openswmmvis::inlet::InletProvider *p);
135 void syncFromProvider_();
136 void refreshCustomCurve_();
137 void updateStatusBar_();
138 QString suggestUniqueName_() const;
139
144 void commitDesign_(const openswmmvis::inlet::InletDesignData &before,
146
149 bool passesShapeFilter_(openswmmvis::inlet::InletProvider *p) const;
150
151 QPointer<openswmmvis::inlet::InletRegistry> m_registry;
152 QPointer<SWMMModelLayer> m_layer;
153 QUndoStack *m_undoStack = nullptr;
154 QPointer<openswmmvis::inlet::InletProvider> m_current;
155 Mode m_mode = Mode::Edit;
156 int m_shapeFilter = -1;
157
158 QSplitter *m_splitter = nullptr;
159
160 // Left pane.
161 QListView *m_listView = nullptr;
162 InletListModel *m_listModel = nullptr;
163 QPushButton *m_addBtn = nullptr;
164 QPushButton *m_delBtn = nullptr;
165
166 // Middle pane.
167 QLineEdit *m_nameEdit = nullptr;
168 QTextEdit *m_commentsEdit = nullptr;
169 QComboBox *m_typeCombo = nullptr;
170 QTreeView *m_propertyTree = nullptr;
171 QPropertyModel *m_propertyModel = nullptr;
172 InletPropertyBag *m_propertyBag = nullptr;
173 QPushButton *m_pickCurveBtn = nullptr;
174
175 // Right pane.
176 QToolBar *m_toolBar = nullptr;
177 InletDrawingView *m_drawing = nullptr;
178
179 QStatusBar *m_status = nullptr;
180 QLabel *m_hintLabel = nullptr;
181
182 bool m_suppressSync = false;
183};
184
185} // namespace openswmmvis::ui
186
187#endif // OPENSWMMVIS_UI_DIALOGS_INLETEDITORDIALOG_H
Renders the SWMM network elements (nodes, links, subcatchments, rain gages) for one OpenSWMMEngine mo...
Definition swmmmodellayer.h:133
Definition inletprovider.h:95
Definition inletregistry.h:29
Definition inletdrawingview.h:92
Definition inleteditordialog.h:67
QComboBox * typeCombo() const noexcept
Definition inleteditordialog.h:108
void invokeNew()
Definition inleteditordialog.cpp:732
openswmmvis::inlet::InletProvider * currentProvider() const noexcept
Definition inleteditordialog.cpp:221
QListView * listView() const noexcept
Definition inleteditordialog.h:105
Mode mode() const noexcept
Definition inleteditordialog.h:101
void openForInlet(const QString &name)
Show (raising an already-open instance) and select name.
Definition inleteditordialog.cpp:212
InletListModel * listModel() const noexcept
Definition inleteditordialog.h:106
Mode
Definition inleteditordialog.h:70
InletDrawingView * drawingView() const noexcept
Definition inleteditordialog.h:110
QTreeView * propertyTree() const noexcept
Definition inleteditordialog.h:109
QLineEdit * nameEdit() const noexcept
Definition inleteditordialog.h:107
static InletEditorDialog * createNew(openswmmvis::inlet::InletRegistry *registry, SWMMModelLayer *layer, QUndoStack *undoStack, QWidget *parent=nullptr)
Definition inleteditordialog.cpp:200
static QString pickInlet(openswmmvis::inlet::InletRegistry *registry, SWMMModelLayer *layer, QUndoStack *undoStack, QWidget *parent, int compatibleXsectShape=-1)
Modal pick / create / edit entry point for the inlet-usage pickers. compatibleXsectShape is a SWMM_XS...
Definition inleteditordialog.cpp:226
void deleteCurrentSilently()
Definition inleteditordialog.cpp:772
Definition inletlistmodel.h:22
Definition inletpropertybag.h:45
MVC model for a single SWMM inlet design ([INLETS]).
ArrowPlacement p
Definition linesymbollayer.cpp:27
int index
Position in m_quadRegions / m_quadReports.
Definition meshgenerator.cpp:153
Definition inletprovider.h:27
Definition openswmmvislayer.h:43
QVector< int > parent
union-find
Definition pslgminsize.cpp:176
QString name
Definition sectionmodelbuilders.cpp:474
Every parameter of one inlet design, mirroring SWMM_InletDesign. Snapshot type for the undo commands ...
Definition inletprovider.h:70