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
meshattributeassigndialog.h File Reference
#include "mesh/meshinfil.h"
#include "mesh/naturalnbinterpolator.h"
#include <QByteArray>
#include <QDialog>
#include <QFutureWatcher>
#include <QPointF>
#include <QPointer>
#include <QSet>
#include <QString>
#include <QStringList>
#include <QVector>
Include dependency graph for meshattributeassigndialog.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  openswmmvis::ui::MeshAttributeAssignDialog
 
struct  openswmmvis::ui::MeshAttributeAssignDialog::Job
 Everything one sampling pass needs. More...
 
struct  openswmmvis::ui::MeshAttributeAssignDialog::SampleResult
 Outcome of one sampling pass over the in-scope cells. More...
 

Namespaces

namespace  openswmmvis
 
namespace  openswmmvis::ui
 

Detailed Description

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
Date
2026
License\n GPL-3.0-or-later

Assign per-cell 2D mesh parameters from a GIS source: a raster band or a vector layer's attribute field, mapped onto the mesh cells in one undoable step.

Complements the mesh-editing toolbar's cell editor — that prescribes one value to a hand-picked selection; this prescribes a spatially varying field to the whole mesh (or the current selection).

Four mapping modes (GUI plan §3.4, phase GG0e):

  • Single numeric target — the original behaviour: one band / one field → one mesh::cellParamSpecs() target, sampled at the cell centroid.
  • Multiple numeric targets — N bands / N fields → N parameters in one pass (Horton's f0 / fmin / decay together), still one undo entry.
  • Classified infiltration lookup — a categorical key field (landuse code, hydrologic soil group), optionally a second key (Curve Number is assigned by landuse × HSG), mapped through an editable, CSV-round-tripped mesh::InfilLookupTable to a whole mesh::InfilRow.
  • Natural-neighbour interpolation — for scattered point sources rather than coverages; a sampling choice rather than a target choice, so it composes with the numeric modes. Same mesh::NaturalNeighbourInterpolator and the same wording the mesh generation dialog uses for elevation.

Sampling is orthogonal to the mode: cell centroid (point sample), area-weighted mean, majority (largest covering share), or natural neighbour. Overlay sampling is bound to the source's declared type — majority for categorical, area-weighted mean for continuous — with an explicit user override, because offering the wrong one silently produces plausible nonsense.

Numeric writes go through mesh::pushCellParamEdits and infiltration writes through mesh::pushCellInfilEdit, so the result lands on the same undo stack as every other cell edit and every view refreshes through the layer's attributeChanged signal. Multi-target and multi-row assignments are wrapped in a single QUndoStack macro so a whole assignment is one Ctrl+Z.

Sampling runs on a QtConcurrent worker guarded by a QFutureWatcher, exactly as MeshGenerationDialog does: the Job carries plain data only (no widgets, no layers, no GDAL handles) and the worker RE-OPENS every raster / vector source by path on its own thread, because GDAL/OGR handles must not cross threads. Nothing is written to the mesh until the worker has finished successfully, so cancelling mid-run leaves the mesh untouched.