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
openswmmvis::sectionview::XsectSampler Class Reference

Owning handle on one standalone SWMM cross-section. More...

#include <xsectsampler.h>

Collaboration diagram for openswmmvis::sectionview::XsectSampler:

Public Member Functions

 XsectSampler ()=default
 
 ~XsectSampler ()
 
 XsectSampler (XsectSampler &&other) noexcept
 
XsectSampleroperator= (XsectSampler &&other) noexcept
 
 XsectSampler (const XsectSampler &)=delete
 
XsectSampleroperator= (const XsectSampler &)=delete
 
bool isValid () const noexcept
 
int shape () const
 
XsectFullProps fullProps () const
 
QVector< doublewidthsAtDepths (const QVector< double > &depths) const
 
QPolygonF outline (int samples=240) const
 Closed outline polygon of the section, in section coordinates.
 

Static Public Member Functions

static XsectSampler fromShape (int shape, double geom1, double geom2, double geom3, double geom4, bool si)
 
static XsectSampler fromLink (SWMM_Engine engine, int linkIdx)
 
static XsectSampler fromTransect (const QVector< double > &stations, const QVector< double > &elevations, double xLeftBank, double xRightBank, double nLeft, double nChannel, double nRight, double lengthFactor, bool si)
 
static XsectSampler fromStreet (double width, double curbHeight, double slope, double roughness, double gutterDepression, double gutterWidth, int sides, double backWidth, double backSlope, double backRoughness, bool si)
 
static XsectSampler fromCurve (double yFull, const QVector< double > &normDepths, const QVector< double > &normWidths, bool si)
 

Detailed Description

Owning handle on one standalone SWMM cross-section.

Move-only (the engine handle is not refcounted). A default-constructed or failed sampler is !isValid() and every query returns a zeroed result, so callers can build one unconditionally and let the empty state fall through to the widget's "no geometry" message.

Constructor & Destructor Documentation

◆ XsectSampler() [1/3]

openswmmvis::sectionview::XsectSampler::XsectSampler ( )
default
Here is the caller graph for this function:

◆ ~XsectSampler()

openswmmvis::sectionview::XsectSampler::~XsectSampler ( )

◆ XsectSampler() [2/3]

openswmmvis::sectionview::XsectSampler::XsectSampler ( XsectSampler &&  other)
noexcept

◆ XsectSampler() [3/3]

openswmmvis::sectionview::XsectSampler::XsectSampler ( const XsectSampler )
delete

Member Function Documentation

◆ fromCurve()

XsectSampler openswmmvis::sectionview::XsectSampler::fromCurve ( double  yFull,
const QVector< double > &  normDepths,
const QVector< double > &  normWidths,
bool  si 
)
static

Custom section from a normalized SHAPE curve (depths and widths are y/yFull and w/wMax in [0,1]).

Here is the call graph for this function:

◆ fromLink()

XsectSampler openswmmvis::sectionview::XsectSampler::fromLink ( SWMM_Engine  engine,
int  linkIdx 
)
static

Deep-copies the geometry the engine actually built for a link, including transect / shape-curve / street tables — the only way to get IRREGULAR / CUSTOM / STREET geometry without re-supplying the tables.

Note
The engine returns SWMM_ERR_LIFECYCLE while the model is still in the BUILDING state (geometry not resolved yet), so this yields an invalid sampler during programmatic model construction. Callers that have the tables to hand should prefer fromTransect() / fromStreet(), which work in every lifecycle state.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fromShape()

XsectSampler openswmmvis::sectionview::XsectSampler::fromShape ( int  shape,
double  geom1,
double  geom2,
double  geom3,
double  geom4,
bool  si 
)
static

Self-contained shapes (everything except IRREGULAR / CUSTOM / STREET).

Parameters
shapeA SWMM_XSectShape code.
sitrue → metres/CMS, false → feet/CFS.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ fromStreet()

XsectSampler openswmmvis::sectionview::XsectSampler::fromStreet ( double  width,
double  curbHeight,
double  slope,
double  roughness,
double  gutterDepression,
double  gutterWidth,
int  sides,
double  backWidth,
double  backSlope,
double  backRoughness,
bool  si 
)
static

Street section from [STREETS] parameters (slopes in percent).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fromTransect()

XsectSampler openswmmvis::sectionview::XsectSampler::fromTransect ( const QVector< double > &  stations,
const QVector< double > &  elevations,
double  xLeftBank,
double  xRightBank,
double  nLeft,
double  nChannel,
double  nRight,
double  lengthFactor,
bool  si 
)
static

Irregular (natural channel) section from raw transect data. Roughness values are load-bearing: the hydraulic-radius table is conveyance-weighted across the overbank / channel subsections.

Here is the call graph for this function:

◆ fullProps()

XsectFullProps openswmmvis::sectionview::XsectSampler::fullProps ( ) const

Bank-full properties; all zeros when invalid.

Here is the caller graph for this function:

◆ isValid()

bool openswmmvis::sectionview::XsectSampler::isValid ( ) const
inlinenoexcept
Here is the caller graph for this function:

◆ operator=() [1/2]

XsectSampler & openswmmvis::sectionview::XsectSampler::operator= ( const XsectSampler )
delete

◆ operator=() [2/2]

XsectSampler & openswmmvis::sectionview::XsectSampler::operator= ( XsectSampler &&  other)
noexcept

◆ outline()

QPolygonF openswmmvis::sectionview::XsectSampler::outline ( int  samples = 240) const

Closed outline polygon of the section, in section coordinates.

The polygon is centred on x = 0 with y measured UP from the invert (y = 0 at the invert, y = yFull at the crown / top of bank), i.e. the natural coordinate system for a section drawing — the painter flips Y.

Built by sampling half-width over samples + 1 depths and mirroring, so it reproduces the engine's own geometry for every shape, including the tabulated ones. The ladder is cosine-spaced, not uniform: width changes fastest at the invert and the crown, so that is where the points need to be (a uniform ladder makes circular pipes look faceted top and bottom).

Parameters
samplesDepth intervals; more samples smooth curved crowns. Clamped to [8, 512]. The default is generous because a section is drawn once per selection, not per frame.
Returns
An empty polygon when the sampler is invalid or the section has no geometry (SWMM_XSECT_DUMMY, or a degenerate depth).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ shape()

int openswmmvis::sectionview::XsectSampler::shape ( ) const

SWMM_XSectShape code, or -1 when invalid.

Here is the caller graph for this function:

◆ widthsAtDepths()

QVector< double > openswmmvis::sectionview::XsectSampler::widthsAtDepths ( const QVector< double > &  depths) const

Width at each depth (one output per input). Empty on failure.

Here is the caller graph for this function:

The documentation for this class was generated from the following files: