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
gageassignment.h File Reference

Spatial rules that bind rain gages to subcatchments. More...

#include <QPair>
#include <QPointF>
#include <QString>
#include <QVector>
Include dependency graph for gageassignment.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  GageAssignment::ClusterKey
 A canonical, integer-valued summary of one weight vector. More...
 

Namespaces

namespace  GageAssignment
 

Functions

QVector< QPointF > GageAssignment::clipHalfPlane (const QVector< QPointF > &ring, const QPointF &keep, const QPointF &drop)
 Clip an open ring by the half-plane of points at least as close to keep as to drop.
 
QVector< doubleGageAssignment::thiessenAreaShares (const QVector< QPointF > &ring, const QVector< QPointF > &gages)
 Area of ring intersected with each gage's Voronoi cell.
 
int GageAssignment::areaMajorityGage (const QVector< double > &shares, double *fractionOut=nullptr)
 Index of the largest share, ties broken toward the lowest index.
 
QVector< QPointF > GageAssignment::samplePolygon (const QVector< QPointF > &ring, int target=kDefaultSampleTarget)
 Interior sample points for area-averaging a field over a ring.
 
QVector< QPair< int, double > > GageAssignment::idwWeights (const QPointF &p, const QVector< QPointF > &sites)
 Inverse-distance weights (power 2), normalised to sum 1.
 
ClusterKey GageAssignment::quantizeWeights (const QVector< double > &w, double tol=kDefaultClusterTol, double wEps=kWeightEpsilon)
 Quantise a dense weight vector into a canonical cluster key.
 
QVector< doubleGageAssignment::dequantizeWeights (const ClusterKey &key, double tol, int nGages)
 Dense weights implied by a key — the blend actually synthesised.
 

Variables

constexpr double GageAssignment::kWeightEpsilon = 1e-4
 Weights below this magnitude are clamped to zero before clustering.
 
constexpr double GageAssignment::kDefaultClusterTol = 0.01
 Default weight-agreement tolerance for clustering (1%).
 
constexpr int GageAssignment::kDefaultSampleTarget = 200
 Default number of interior samples requested per ring.
 

Detailed Description

Spatial rules that bind rain gages to subcatchments.

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

Two rules live here:

     - Thiessen area-majority — the share of a subcatchment's area that
       falls inside each gage's Voronoi cell, and the winning gage. The
       Voronoi cell is never built explicitly; it is the intersection of
       the half-planes bounded by the perpendicular bisectors to every
       other gage, so the share is obtained by successive clipping.

     - Area-averaged interpolation support — interior sample points for a
       ring, inverse-distance weights for query points that fall outside
       the natural-neighbour hull, and the deterministic quantisation that
       groups subcatchments carrying effectively the same weight vector.

     Like EditGeometry, this is a leaf module with no Qt-GUI, OGR, or
     engine dependency so a lightweight QtTest binary can exercise it
     without the SWMMModelLayer / MapCanvas graph.

     Rings follow the SWMM `[POLYGONS]` convention: OPEN (no repeated
     closing vertex), as produced by EditGeometry::cleanPolygonRing.