![]() |
SWMMVis
6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
|
Edit OPTIONS for the active SWMM project. More...
#include <simulationoptionsdialog.h>
Public Member Functions | |
| SimulationOptionsDialog (SWMM_Engine engine, SWMMModelLayer *layer=nullptr, const QString &engineVersion=QStringLiteral("6.0.0"), SWMMVisProjectWindow *projectWindow=nullptr, QWidget *parent=nullptr) | |
| ~SimulationOptionsDialog () override=default | |
| bool | wroteAnyChanges () const |
| True after a successful Apply / OK that wrote at least one key. | |
| QStringList | lastWriteKeys () const |
| Every option key offered to writeIfChanged during the last write pass — whether or not the value actually changed. | |
Static Public Member Functions | |
| static int | parseEngineBool (const QString &s) |
| Map an engine boolean string ("YES"/"NO"/"TRUE"/"FALSE"/"1"/"0") to a Qt::CheckState. Unknown values → Qt::PartiallyChecked. | |
| static QString | engineBoolString (bool on) |
| Render a checkbox state as the canonical engine string. | |
| static void | fastPresetValues (int &out_threads, double &out_min_step_sec) |
| Canonical "fast preset" recipe for 1D/2D-coupled runs: all worker threads on, and the adaptive routing step floored so the 2D coupling can't collapse it. Benchmarked ~4x faster with a ~4–5% peak-depth trade on the Bellinge model (see FAST_RUN_RECIPE.md). Kept as a static so the recipe values are locked by a unit test. | |
| static int | fastPresetThreads () |
| THREADS the fast preset uses: the machine's performance-core count (macOS), else its logical-CPU count, else 8. | |
| static QString | threadLimitsSummary (const SWMM_ThreadInfo &ti) |
| Human-readable summary of the machine / OpenMP thread limits (from swmm_get_thread_info) for tooltips. | |
| static void | formatEngineDateTime (const QDateTime &dt, QString &out_date, QString &out_time) |
Format a Qt date+time as the engine's expected MM/DD/YYYY + HH:MM:SS pair (returned as out_date and out_time). | |
| static QDateTime | parseEngineDateTime (const QString &date, const QString &time) |
| Inverse of formatEngineDateTime. Returns an invalid QDateTime if either string is malformed. | |
| static double | oaDateFromQDateTime (const QDateTime &dt) |
| Convert a QDateTime to SWMM's OLE Automation Date (decimal days since 1899-12-30 00:00). Used by the [EVENTS] section editor to round-trip through the swmm_events_* C API which speaks OADate directly. Returns 0.0 for invalid input. | |
| static QDateTime | qDateTimeFromOaDate (double oa) |
| Inverse of oaDateFromQDateTime. | |
| static qint64 | parseStepSeconds (const QString &s, qint64 fallback) |
Parse a step value as returned by swmm_options_get() into whole seconds. The engine round-trip is loose: a step comes back as plain seconds ("900"), decimal seconds ("900.000000" — the std::to_string(double) form used for REPORT_STEP / ROUTING_STEP) or as HH:MM:SS ("00:15:00", "48:00:00"). Returns fallback when s matches none of those. | |
| static bool | optionValueEquals (const QString &a, const QString &b) |
Compare an option value from swmm_options_get() against a freshly formatted one, tolerating formatting differences. The engine renders numerics as std::to_string(double) ("0.000000") while the dialog formats with 'f'/'g' variants ("0.00"), so a plain string compare treats every unchanged numeric as an edit. Exact string equality → true; else if both sides parse as doubles they compare with a relative tolerance; else false. | |
| static QList< int > | selectedRowsDescending (const QTableWidget *table) |
| Distinct selected row indices of table, sorted descending (safe order for removeRow()). Reads the selection MODEL first — the [EVENTS] table populates cells exclusively with setCellWidget() editors, so item-based queries like selectedItems() see an always-empty selection — then falls back to selectedItems() for plain cell selections. | |
Edit OPTIONS for the active SWMM project.
Round-trip layout:
swmm_options_get and populate the controls.swmm_options_set. Marks the project dirty if any key was written.
|
explicit |
| engine | Open SWMM engine handle (required). |
| layer | Optional model layer — gives Tab 5 access to the layer CRS + extent for the Detect from coordinates helper and the read-only extent summary. |
| engineVersion | Version string of the engine that will run the simulation (e.g. "6.0.0" or "5.2.4"). Controls which tabs and controls are enabled — options that the selected engine does not support are disabled with an explanatory tooltip. |
| projectWindow | Optional MDI window — provides .oswp-persisted rich HTML notes for the new "Title/Notes" tab. When omitted, the tab still works but only round-trips plain text through the engine. |
| parent | Qt parent. |
|
overridedefault |
|
static |
Render a checkbox state as the canonical engine string.
|
static |
THREADS the fast preset uses: the machine's performance-core count (macOS), else its logical-CPU count, else 8.
|
static |
Canonical "fast preset" recipe for 1D/2D-coupled runs: all worker threads on, and the adaptive routing step floored so the 2D coupling can't collapse it. Benchmarked ~4x faster with a ~4–5% peak-depth trade on the Bellinge model (see FAST_RUN_RECIPE.md). Kept as a static so the recipe values are locked by a unit test.
|
static |
Format a Qt date+time as the engine's expected MM/DD/YYYY + HH:MM:SS pair (returned as out_date and out_time).
| QStringList SimulationOptionsDialog::lastWriteKeys | ( | ) | const |
Every option key offered to writeIfChanged during the last write pass — whether or not the value actually changed.
The reachability seam for the dialog restructure (OPTIONS_DIALOG_TABBED_RESTRUCTURE_PLAN_2026-09-07.md §6 test 6): a key recorded here with no widget carrying a matching optionKey property means some editor was orphaned by a page move. Every page writes through the shared context, so the record lives in one place.
|
static |
Convert a QDateTime to SWMM's OLE Automation Date (decimal days since 1899-12-30 00:00). Used by the [EVENTS] section editor to round-trip through the swmm_events_* C API which speaks OADate directly. Returns 0.0 for invalid input.
|
static |
Compare an option value from swmm_options_get() against a freshly formatted one, tolerating formatting differences. The engine renders numerics as std::to_string(double) ("0.000000") while the dialog formats with 'f'/'g' variants ("0.00"), so a plain string compare treats every unchanged numeric as an edit. Exact string equality → true; else if both sides parse as doubles they compare with a relative tolerance; else false.
|
static |
Map an engine boolean string ("YES"/"NO"/"TRUE"/"FALSE"/"1"/"0") to a Qt::CheckState. Unknown values → Qt::PartiallyChecked.
|
static |
Inverse of formatEngineDateTime. Returns an invalid QDateTime if either string is malformed.
|
static |
Parse a step value as returned by swmm_options_get() into whole seconds. The engine round-trip is loose: a step comes back as plain seconds ("900"), decimal seconds ("900.000000" — the std::to_string(double) form used for REPORT_STEP / ROUTING_STEP) or as HH:MM:SS ("00:15:00", "48:00:00"). Returns fallback when s matches none of those.
|
static |
Inverse of oaDateFromQDateTime.
|
static |
Distinct selected row indices of table, sorted descending (safe order for removeRow()). Reads the selection MODEL first — the [EVENTS] table populates cells exclusively with setCellWidget() editors, so item-based queries like selectedItems() see an always-empty selection — then falls back to selectedItems() for plain cell selections.
|
static |
Human-readable summary of the machine / OpenMP thread limits (from swmm_get_thread_info) for tooltips.
|
inline |
True after a successful Apply / OK that wrote at least one key.