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
mesh2dresultsexport.h
Go to the documentation of this file.
1
34#ifndef OPENSWMMVIS_IO_MESH2DRESULTSEXPORT_H
35#define OPENSWMMVIS_IO_MESH2DRESULTSEXPORT_H
36
37#include <QString>
38#include <QStringList>
39
40#include <functional>
41#include <vector>
42
43class IMesh2DSource;
44
45namespace openswmmvis::io {
46
49{
50 Shapefile,
52 GeoTiff
53};
54
56enum class Mesh2DInterp
57{
59 Idw,
61};
62
64enum Mesh2DVariable : unsigned
65{
66 Mesh2DDepth = 1u << 0,
67 Mesh2DHead = 1u << 1,
68 Mesh2DVx = 1u << 2,
69 Mesh2DVy = 1u << 3,
70 Mesh2DVmag = 1u << 4
71};
72
74constexpr float kMesh2DNoData = -9999.0f;
75
79
82{
86 QString basePath;
87
89
92
94 std::vector<int> timeSteps;
95
99 bool includeMax = true;
100
101 // ── Raster only ────────────────────────────────────────────────────
103 double cellSize = 0.0;
108 double idwPower = 2.0;
111 bool maskDry = true;
112};
113
116{
120 double unitFactor = 1.0;
122 double dryDepthM = 1e-4;
124 QString srsWkt;
125};
126
129{
130 QStringList files;
131 QString error;
132 QStringList warnings;
133};
134
138 std::function<bool(int done, int total, const QString &what)>;
139
147bool exportMesh2DResults(const Mesh2DExportInputs &inputs,
148 const Mesh2DExportOptions &options,
149 const Mesh2DExportProgress &progress,
150 Mesh2DExportReport *report);
151
154{
155 double extentWidth = 0.0;
156 double extentHeight = 0.0;
160 double suggestedCellSize = 0.0;
161
162 bool isValid() const
163 {
164 return extentWidth > 0.0 && extentHeight > 0.0 && suggestedCellSize > 0.0;
165 }
166};
167
174Mesh2DGridHint mesh2DGridHint(IMesh2DSource *source, double unitFactor);
175
178QString mesh2DVariableKey(Mesh2DVariable variable);
179
181QString mesh2DVariableLabel(Mesh2DVariable variable);
182
183} // namespace openswmmvis::io
184
185#endif // OPENSWMMVIS_IO_MESH2DRESULTSEXPORT_H
Abstract source of mesh geometry + per-triangle depth time series.
Definition swmm2dresultslayer.h:81
int e
Definition inpmeshreader.cpp:41
QPointer< OpenSWMMVisLayer > source
Definition maskclipresolver.cpp:30
Definition gdaldrivers.h:22
constexpr unsigned kMesh2DMaxVariables
Maximum fields exist only for these variables (see Mesh2DExportOptions::includeMax)....
Definition mesh2dresultsexport.h:78
QString mesh2DVariableLabel(Mesh2DVariable variable)
Human label for variable, e.g. "Water surface elevation".
Definition mesh2dresultsexport.cpp:906
constexpr float kMesh2DNoData
NoData written into every raster band (dry / outside the mesh).
Definition mesh2dresultsexport.h:74
std::function< bool(int done, int total, const QString &what)> Mesh2DExportProgress
Progress sink. Return false to cancel — every file written so far is then deleted,...
Definition mesh2dresultsexport.h:138
Mesh2DInterp
How cell-centred values are carried to raster pixels.
Definition mesh2dresultsexport.h:57
@ NaturalNeighbour
Sibson weights over the cell-centroid Delaunay.
@ GreenGauss
containing cell + its Green–Gauss gradient (fastest)
@ Idw
Shepard over the k nearest centroids.
Mesh2DExportFormat
Output container. Vector formats share one OGR code path.
Definition mesh2dresultsexport.h:49
@ GeoPackage
one .gpkg, one layer per variable ("GPKG")
@ GeoTiff
one .tif per variable, one band per step ("GTiff")
@ Shapefile
one .shp set per variable ("ESRI Shapefile")
bool exportMesh2DResults(const Mesh2DExportInputs &inputs, const Mesh2DExportOptions &options, const Mesh2DExportProgress &progress, Mesh2DExportReport *report)
Run the export described by options against inputs.
Definition mesh2dresultsexport.cpp:937
Mesh2DVariable
Exportable fields, as a bitmask.
Definition mesh2dresultsexport.h:65
@ Mesh2DVmag
speed |v|
Definition mesh2dresultsexport.h:70
@ Mesh2DDepth
overland flow depth
Definition mesh2dresultsexport.h:66
@ Mesh2DHead
water-surface elevation
Definition mesh2dresultsexport.h:67
@ Mesh2DVx
velocity, x component
Definition mesh2dresultsexport.h:68
@ Mesh2DVy
velocity, y component
Definition mesh2dresultsexport.h:69
QString mesh2DVariableKey(Mesh2DVariable variable)
Lower-case single-word name of variable ("depth", "vmag", …), used for file suffixes,...
Definition mesh2dresultsexport.cpp:894
Mesh2DGridHint mesh2DGridHint(IMesh2DSource *source, double unitFactor)
Mesh extent and a default pixel size for source, so a dialog can show the resulting raster's dimensio...
Definition mesh2dresultsexport.cpp:918
The run to export plus the unit / CRS context the source cannot state.
Definition mesh2dresultsexport.h:116
double dryDepthM
Definition mesh2dresultsexport.h:122
QString srsWkt
Definition mesh2dresultsexport.h:124
double unitFactor
Definition mesh2dresultsexport.h:120
IMesh2DSource * source
not owned; must outlive the call
Definition mesh2dresultsexport.h:117
What to export. Collected by the dialog, consumed by exportMesh2DResults.
Definition mesh2dresultsexport.h:82
bool maskDry
Definition mesh2dresultsexport.h:111
int idwNeighbours
Definition mesh2dresultsexport.h:106
QString basePath
Definition mesh2dresultsexport.h:86
unsigned variables
Definition mesh2dresultsexport.h:91
Mesh2DInterp interp
Definition mesh2dresultsexport.h:104
double idwPower
Definition mesh2dresultsexport.h:108
std::vector< int > timeSteps
Definition mesh2dresultsexport.h:94
bool includeMax
Definition mesh2dresultsexport.h:99
double cellSize
Definition mesh2dresultsexport.h:103
Mesh2DExportFormat format
Definition mesh2dresultsexport.h:88
What was written, or why nothing was.
Definition mesh2dresultsexport.h:129
QStringList files
every path created (in creation order)
Definition mesh2dresultsexport.h:130
QString error
empty on success; "Cancelled" when the caller stopped it
Definition mesh2dresultsexport.h:131
QStringList warnings
non-fatal, e.g. natural neighbour fell back to IDW
Definition mesh2dresultsexport.h:132
What a caller needs to size a raster before running the export.
Definition mesh2dresultsexport.h:154
double extentHeight
Definition mesh2dresultsexport.h:156
bool isValid() const
Definition mesh2dresultsexport.h:162
double suggestedCellSize
Definition mesh2dresultsexport.h:160
double extentWidth
mesh bounding box, model units
Definition mesh2dresultsexport.h:155