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
meshassignmentsampling.h
Go to the documentation of this file.
1
10#ifndef OPENSWMMVIS_MESHASSIGNMENTSAMPLING_H
11#define OPENSWMMVIS_MESHASSIGNMENTSAMPLING_H
12#include "mesh/meshinfil.h"
14#include <QPointF>
15#include <QSet>
16#include <QStringList>
17#include <QVector>
18#include <QPromise>
19#include <functional>
21{
24 enum class Source { Raster, Vector };
25
33
42
44 enum class WriteTarget {
47 };
48
49 // -----------------------------------------------------------------------
50 // Data exchanged with the sampling worker.
51 //
52 // Both structs are plain data: no QObject, no layer pointer, no GDAL
53 // handle. collectJob() fills the Job on the GUI thread; the worker
54 // re-opens every source by path on its own thread.
55 // -----------------------------------------------------------------------
56
58 struct Job {
62
67 QVector<int> triangles;
68 QVector<QPointF> centroids;
69 QVector<QPointF> triVerts;
70
71 bool strictCrs = false; // Refuse missing CRS and any failed transform.
72 bool rejectOverlaps = false; // Groundwater refuses ambiguous coverage.
74 QString meshCrsWkt;
75
76 // ---- Raster source ----
77 QString rasterPath;
78 QVector<int> bands;
79 int keyBand1 = 1;
80 int keyBand2 = 0;
81 double scale = 1.0;
82 double offset = 0.0;
83
84 // ---- Vector source ----
85 QString vectorPath;
88 QStringList fields;
89 QString keyField1;
90 QString keyField2;
91 bool filterBySelection = false;
92 QSet<long long> selectedIds;
93
94 // ---- Numeric targets ----
95 QVector<QByteArray> targetKeys;
96 QVector<double> targetMin;
97 QVector<double> targetMax;
98
99 // ---- Classified infiltration ----
101
102 // ---- Natural neighbour ----
105 };
106
109 QVector<int> triangles;
112 QVector<QVector<double>> values;
114 QVector<mesh::InfilRow> rows;
117 QStringList keys;
118
121 int skippedRange = 0;
123 int scanned = 0;
124 bool cancelled = false;
129 QString error;
130 };
131};
132MeshAssignmentSampling::
133 SampleResult
143 std::function<bool()> cancelled = {},
144 std::function<void(int, int)> progress = {});
151void runMeshAssignmentSampling(QPromise<MeshAssignmentSampling::SampleResult> &promise,
152 MeshAssignmentSampling::Job job);
153}
154#endif
Variant
Definition naturalnbinterpolator.h:53
Per-cell 2D infiltration: value types, tag/override resolution and method↔parameter masks.
Definition groundwaterassignment.h:22
void runMeshAssignmentSampling(QPromise< MeshAssignmentSampling::SampleResult > &promise, MeshAssignmentSampling::Job job)
Adapt synchronous sampling to a Qt concurrent promise.
Definition meshassignmentsampling.cpp:1242
MeshAssignmentSampling::SampleResult sampleMeshAssignment(const MeshAssignmentSampling::Job &job, std::function< bool()> cancelled={}, std::function< void(int, int)> progress={})
Run a self-contained raster/vector sampling job on the calling thread.
Definition meshassignmentsampling.cpp:1235
Natural-neighbour interpolation over a sparse set of scattered seed points (x, y, z).
An editable, reusable classified lookup table. Saved/loaded as CSV so an agency's standard table trav...
Definition meshinfil.h:410
Everything one sampling pass needs.
Definition meshassignmentsampling.h:58
QString vectorFilterExpr
Definition meshassignmentsampling.h:87
QVector< QByteArray > targetKeys
Definition meshassignmentsampling.h:95
mesh::NaturalNeighbourInterpolator::Variant nnVariant
Definition meshassignmentsampling.h:103
int keyBand1
Classified mode: band supplying key 1.
Definition meshassignmentsampling.h:79
QSet< long long > selectedIds
Definition meshassignmentsampling.h:92
QString assignedSourceCrsWkt
Definition meshassignmentsampling.h:73
QVector< double > targetMax
Parallel to targetKeys.
Definition meshassignmentsampling.h:97
QString rasterPath
Definition meshassignmentsampling.h:77
Sampling sampling
Definition meshassignmentsampling.h:61
Source source
Definition meshassignmentsampling.h:60
mesh::InfilLookupTable table
Definition meshassignmentsampling.h:100
int keyBand2
Classified mode: 0 = single key.
Definition meshassignmentsampling.h:80
QVector< QPointF > centroids
Definition meshassignmentsampling.h:68
bool strictCrs
Definition meshassignmentsampling.h:71
bool rejectOverlaps
Definition meshassignmentsampling.h:72
QVector< double > targetMin
Parallel to targetKeys.
Definition meshassignmentsampling.h:96
QString vectorPath
Definition meshassignmentsampling.h:85
QString meshCrsWkt
Mesh layer CRS; "" = assume source CRS.
Definition meshassignmentsampling.h:74
Mode mode
Definition meshassignmentsampling.h:59
QString keyField1
Classified mode.
Definition meshassignmentsampling.h:89
QString keyField2
Classified mode; "" = single key.
Definition meshassignmentsampling.h:90
bool filterBySelection
Definition meshassignmentsampling.h:91
double offset
Definition meshassignmentsampling.h:82
QVector< QPointF > triVerts
Definition meshassignmentsampling.h:69
QStringList fields
Parallel to targetKeys (numeric modes).
Definition meshassignmentsampling.h:88
QVector< int > bands
Parallel to targetKeys (numeric modes).
Definition meshassignmentsampling.h:78
QVector< int > triangles
Definition meshassignmentsampling.h:67
double scale
Definition meshassignmentsampling.h:81
QString vectorLayerName
Definition meshassignmentsampling.h:86
Outcome of one sampling pass over the in-scope cells.
Definition meshassignmentsampling.h:108
int scanned
Cells considered.
Definition meshassignmentsampling.h:123
bool cancelled
Definition meshassignmentsampling.h:124
QStringList keys
Definition meshassignmentsampling.h:117
QString error
Non-empty aborts the pass.
Definition meshassignmentsampling.h:129
int skippedNoData
NoData / outside the source.
Definition meshassignmentsampling.h:119
int unmatchedKeys
Classified: fell through to the fallback row.
Definition meshassignmentsampling.h:122
int skippedNonNumeric
Field value not a number.
Definition meshassignmentsampling.h:120
QVector< int > triangles
Cells that received a value.
Definition meshassignmentsampling.h:109
int skippedRange
Outside the parameter's range.
Definition meshassignmentsampling.h:121
QString resolvedSampling
Definition meshassignmentsampling.h:128
QVector< QVector< double > > values
Definition meshassignmentsampling.h:112
QVector< mesh::InfilRow > rows
Definition meshassignmentsampling.h:114
Definition meshassignmentsampling.h:22
Sampling
How one cell's source value is obtained.
Definition meshassignmentsampling.h:35
@ NaturalNeighbour
Sibson / Laplace over scattered points.
@ OverlayAuto
Majority or area-weighted mean, by source type.
@ Centroid
Point sample at the cell centroid (original).
@ AreaWeightedMean
Mean over the cell's footprint (continuous).
@ Majority
Largest covering share wins (categorical).
Mode
What the assignment writes.
Definition meshassignmentsampling.h:27
@ ClassifiedInfil
Key (or key pair) → a whole mesh::InfilRow.
@ SingleNumeric
One source value → one numeric cell parameter.
@ MultiNumeric
N source values → N numeric cell parameters.
@ SingleCategory
One categorical key per cell (e.g. snowpack class).
WriteTarget
Where the assignment lands (GUI plan §3.4 "Write as", engine D-I3).
Definition meshassignmentsampling.h:44
@ RegionDefaults
One [2D_INFILTRATION_DEFAULTS] row per region tag.
@ CellOverrides
Per-cell [2D_INFILTRATION] override rows.
Source
Which source the dialog opens on.
Definition meshassignmentsampling.h:24
const ExportProgress * progress
Definition vectorexport.cpp:211
bool cancelled
Definition vectorexport.cpp:214