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 Namespace Reference

Classes

struct  AquiferDiagramInput
 
struct  DiagramArrow
 
struct  DiagramCircle
 
struct  DiagramDim
 
struct  DiagramGround
 
struct  DiagramLeader
 
struct  DiagramPoly
 
struct  DiagramPolyline
 
struct  DiagramSymbol
 
struct  DiagramUnits
 
struct  DiagramVegetation
 
struct  DiagramViewport
 User zoom / pan applied on top of the automatic fit. More...
 
struct  LidDiagramInput
 
struct  PlanInset
 
struct  PlanSpoke
 
struct  SectionDiagramModel
 Everything one preview pane draws, in model units. More...
 
class  SectionPreviewWidget
 
struct  XsectFullProps
 
class  XsectSampler
 Owning handle on one standalone SWMM cross-section. More...
 

Enumerations

enum class  LidLayer {
  Surface ,
  Pavement ,
  Soil ,
  Storage ,
  Drainmat
}
 
enum class  LidType {
  BioCell = 0 ,
  RainGarden = 1 ,
  GreenRoof = 2 ,
  InfilTrench = 3 ,
  PermPavement = 4 ,
  RainBarrel = 5 ,
  RooftopDisconn = 6 ,
  VegSwale = 7
}
 
enum class  DiagramRole {
  Conduit ,
  Structure ,
  Storage ,
  Soil ,
  Media ,
  Gravel ,
  Vegetation ,
  Water ,
  Muted ,
  Accent
}
 
enum class  DiagramTexture {
  None ,
  Stipple ,
  Gravel ,
  Aggregate ,
  Sand ,
  Hatch ,
  Lattice ,
  Brick
}
 
enum class  DiagramSymbolKind {
  Pump ,
  FlapGate ,
  ManholeCover ,
  RatingBox
}
 

Functions

QString aquiferActiveCalloutPrefix ()
 
QString aquiferWarningCalloutPrefix ()
 
SectionDiagramModel buildAquiferDiagram (const AquiferDiagramInput &in)
 Build the two-zone groundwater illustration for one aquifer.
 
QVector< LidLayerlidLayersFor (LidType type)
 
bool lidHasDrain (LidType type)
 
QString lidLayerName (LidLayer layer)
 
SectionDiagramModel buildLidLayerDiagram (const LidDiagramInput &in)
 Build the layer-stack diagram for one LID control.
 
void paintSectionDiagram (QPainter &painter, const QRectF &target, const SectionDiagramModel &model, const QPalette &palette, const DiagramViewport &viewport={}, QRectF *fitRectOut=nullptr, double *achievedExaggerationOut=nullptr)
 Paint model into target using palette for all colours.
 
QColor diagramFillColor (DiagramRole role, const QPalette &palette)
 
QColor diagramStrokeColor (DiagramRole role, const QPalette &palette)
 
double profileMaxExaggeration () noexcept
 
SectionDiagramModel buildLinkSection (SWMM_Engine engine, int linkIdx, const DiagramUnits &units)
 True-shape cross-section of a link, with dimensions + elevations.
 
SectionDiagramModel buildLinkProfile (SWMM_Engine engine, int linkIdx, const DiagramUnits &units)
 Longitudinal profile of a conduit between its two nodes.
 
SectionDiagramModel buildNodeProfile (SWMM_Engine engine, int nodeIdx, const DiagramUnits &units, int maxLinks=8)
 Node profile: structure, rim, invert, and every connecting link drawn at its own invert offset, plus a plan-view inset of link headings.
 
SectionDiagramModel buildXsectEditorPreview (int shape, double geom1, double geom2, double geom3, double geom4, const DiagramUnits &units, int highlightOrdinal=0)
 Live preview for the cross-section editor, built from uncommitted dialog values rather than from the engine's stored link.
 
SectionDiagramModel buildSamplerPreview (const XsectSampler &sampler, const QString &title, const QString &subtitle, const DiagramUnits &units)
 Preview for an already-constructed sampler (tabulated shapes).
 
QIcon xsectShapeIcon (int shape, const QSize &size, const QPalette &palette)
 Icon for a SWMM_XSectShape, rendered from engine geometry.
 
void nominalGeomsFor (int shape, double &geom1, double &geom2, double &geom3, double &geom4)
 Representative geom1..geom4 used to draw shape at unit depth.
 
XsectSampler samplerFromStreetIndex (SWMM_Engine engine, int streetIdx, bool si)
 Sampler for the street at streetIdx, built from [STREETS].
 
XsectSampler samplerForLink (SWMM_Engine engine, int linkIdx, int shape, double g1, double g2, double g3, double g4, bool si)
 Sampler for a link's cross-section, given the values swmm_link_get_xsect reported for it.
 
double linkFullDepth (SWMM_Engine engine, int linkIdx, int shape, double g1, double g2, double g3, double g4, bool si, bool *outOpenTop=nullptr)
 A link's true full depth (crown height above the invert).
 

Enumeration Type Documentation

◆ DiagramRole

Semantic fill/stroke roles. Resolved against the palette at paint time so the same model renders correctly in light and dark themes.

Enumerator
Conduit 

Pipe / channel interior.

Structure 

Manhole, chamber, vault walls.

Storage 

Storage-unit shell — brown, and stroked heavier than a manhole so a tank never reads as a junction.

Soil 

Native soil below / around a structure.

Media 

Engineered media (LID soil layer).

Gravel 

Void storage (LID storage layer, gravel bed).

Vegetation 

Planting / turf.

Water 

Ponded or flowing water.

Muted 

De-emphasised (unknown / not-yet-entered values).

Accent 

Highlighted item (e.g. the geom being edited).

◆ DiagramSymbolKind

A schematic device glyph — the P&ID convention, where a pump is a symbol rather than a scaled machine.

These exist because the things they stand for have no drawable geometry in the model: a SWMM pump carries a curve and two depths, not a casing size, so anything drawn to scale would be invented. A fixed-size glyph says "pump here" without claiming a dimension.

Enumerator
Pump 

Casing circle + impeller, with a discharge nozzle.

FlapGate 

Hinged flap hanging on a pipe end / outfall face.

ManholeCover 

Frame and cover, sat on a junction rim.

RatingBox 

Flow-vs-head outlet: a box holding a rating curve.

◆ DiagramTexture

Material pattern drawn INSIDE a filled polygon, on top of its flat colour.

This is what makes a LID layer stack read as engineered materials rather than as coloured bands: a soil layer that is stippled and a storage layer full of gravel outlines are distinguishable at a glance and in greyscale, which flat fills separated only by hue are not.

Patterns are generated procedurally from a fixed seed, so a given layer looks identical on every repaint — a texture that reshuffles as the panel resizes reads as noise, not as material.

Enumerator
None 
Stipple 

Fine speckle — engineered soil / planting media.

Gravel 

Loose rounded outlines — void storage, drainage stone.

Aggregate 

Angular chips — porous pavement, base course.

Sand 

Dense fine dots — sand / choking layer.

Hatch 

45° lines — native soil, and unknown-value layers.

Lattice 

Cross-hatched grid — drainage mat / geocomposite.

Brick 

Staggered joints — paver blocks.

◆ LidLayer

Which physical layer a row of the stack represents.

Enumerator
Surface 
Pavement 
Soil 
Storage 
Drainmat 

◆ LidType

LID type codes, matching [LID_CONTROLS] / LidControlProvider::type().

Enumerator
BioCell 
RainGarden 
GreenRoof 
InfilTrench 
PermPavement 
RainBarrel 
RooftopDisconn 
VegSwale 

Function Documentation

◆ aquiferActiveCalloutPrefix()

QString openswmmvis::sectionview::aquiferActiveCalloutPrefix ( )

Prefix put on the emphasised callout's text (the leader model carries no accent flag; dimension lines use their own accent).

Here is the caller graph for this function:

◆ aquiferWarningCalloutPrefix()

QString openswmmvis::sectionview::aquiferWarningCalloutPrefix ( )

Prefix put on each warning callout's text.

Here is the caller graph for this function:

◆ buildAquiferDiagram()

SectionDiagramModel openswmmvis::sectionview::buildAquiferDiagram ( const AquiferDiagramInput in)

Build the two-zone groundwater illustration for one aquifer.

The saturated zone is drawn to the thickness Egw − Ebot when Egw > Ebot; otherwise it collapses to a hatched "unknown" slab at the bottom. The unsaturated zone above it has no engine-known thickness (the surface is a subcatchment property), so it is drawn tall enough to hold the lower evaporation depth ETs and never thinner than a fraction of the saturated zone.

Here is the call graph for this function:

◆ buildLidLayerDiagram()

SectionDiagramModel openswmmvis::sectionview::buildLidLayerDiagram ( const LidDiagramInput in)

Build the layer-stack diagram for one LID control.

Layer boxes are proportional to their thickness where known, with a floor so a thin layer stays visible and an unknown layer still occupies a row.

Here is the call graph for this function:

◆ buildLinkProfile()

SectionDiagramModel openswmmvis::sectionview::buildLinkProfile ( SWMM_Engine  engine,
int  linkIdx,
const DiagramUnits units 
)

Longitudinal profile of a conduit between its two nodes.

Shows both structures (rim → invert), the ground line, the sloping barrel drawn at its true crown/invert elevations including offsets, the upstream offset dimension, and length / slope along the barrel axis.

Uses independent axis scaling (uniformScale = false) — a 120 m reach at a 0.25 % slope is unreadable at true aspect.

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

◆ buildLinkSection()

SectionDiagramModel openswmmvis::sectionview::buildLinkSection ( SWMM_Engine  engine,
int  linkIdx,
const DiagramUnits units 
)

True-shape cross-section of a link, with dimensions + elevations.

Draws the section outline sampled from the engine, dimensions the full depth and max width, and leaders the invert / crown elevations taken from each end node's invert plus the link's offset at that end. A sloping run reports both ends ("100.00 / 98.00 ft"); a flat one collapses to a single value.

Returns
A model whose emptyText explains the gap (pump, DUMMY section, unresolvable tabulated geometry) when there is nothing to draw.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ buildNodeProfile()

SectionDiagramModel openswmmvis::sectionview::buildNodeProfile ( SWMM_Engine  engine,
int  nodeIdx,
const DiagramUnits units,
int  maxLinks = 8 
)

Node profile: structure, rim, invert, and every connecting link drawn at its own invert offset, plus a plan-view inset of link headings.

Inbound links (the node is their to node) are stubbed to the left, outbound to the right. Links are ordered by invert so the drawing reads like a real manhole schedule.

Parameters
maxLinksCap on drawn connections; the footer notes any remainder.

Half-width of the VOID at an elevation; the shell face is this + wall.

Ring following the silhouette between two elevations, padded outward by pad (0 for the void / the water body, wall for the shell). Emitted right side bottom→top then left side top→bottom, so the first and last points are the two bottom corners.

Sampled AT the silhouette's own breakpoints rather than on a uniform ladder: a fixed ladder rounded a manhole's corbel into a bottle neck and smeared a storage curve's knee, because it interpolates across the very vertices that carry the shape.

Half-width of the VOID at an elevation; the shell face is this + wall.

Ring following the silhouette between two elevations, padded outward by pad (0 for the void / the water body, wall for the shell). Emitted right side bottom→top then left side top→bottom, so the first and last points are the two bottom corners.

Sampled AT the silhouette's own breakpoints rather than on a uniform ladder: a fixed ladder rounded a manhole's corbel into a bottle neck and smeared a storage curve's knee, because it interpolates across the very vertices that carry the shape.

Here is the caller graph for this function:

◆ buildSamplerPreview()

SectionDiagramModel openswmmvis::sectionview::buildSamplerPreview ( const XsectSampler sampler,
const QString &  title,
const QString &  subtitle,
const DiagramUnits units 
)

Preview for an already-constructed sampler (tabulated shapes).

Same drawing as buildXsectEditorPreview() minus the per-geom dimensions, which are meaningless for a transect / street / shape-curve section.

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

◆ buildXsectEditorPreview()

SectionDiagramModel openswmmvis::sectionview::buildXsectEditorPreview ( int  shape,
double  geom1,
double  geom2,
double  geom3,
double  geom4,
const DiagramUnits units,
int  highlightOrdinal = 0 
)

Live preview for the cross-section editor, built from uncommitted dialog values rather than from the engine's stored link.

Parameters
shapeSWMM_XSectShape code.
geom1..geom4Current spin-box values.
unitsUnit context.
highlightOrdinal1..4 to accent that geom's dimension line, 0 for none.

IRREGULAR / STREET / CUSTOM carry an index in geom1 rather than a dimension; pass the resolved sampler through buildSamplerPreview() instead.

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

◆ diagramFillColor()

QColor openswmmvis::sectionview::diagramFillColor ( DiagramRole  role,
const QPalette &  palette 
)

Resolve a role to its fill colour (exposed for tests + the icon renderer).

Here is the caller graph for this function:

◆ diagramStrokeColor()

QColor openswmmvis::sectionview::diagramStrokeColor ( DiagramRole  role,
const QPalette &  palette 
)

Resolve a role to its stroke colour.

Here is the caller graph for this function:

◆ lidHasDrain()

bool openswmmvis::sectionview::lidHasDrain ( LidType  type)

True when type drains through an underdrain the user can configure.

Here is the caller graph for this function:

◆ lidLayerName()

QString openswmmvis::sectionview::lidLayerName ( LidLayer  layer)

Display name for a layer ("Surface", "Soil", …).

Here is the caller graph for this function:

◆ lidLayersFor()

QVector< LidLayer > openswmmvis::sectionview::lidLayersFor ( LidType  type)

Layer stack for type, top to bottom.

Here is the caller graph for this function:

◆ linkFullDepth()

double openswmmvis::sectionview::linkFullDepth ( SWMM_Engine  engine,
int  linkIdx,
int  shape,
double  g1,
double  g2,
double  g3,
double  g4,
bool  si,
bool *  outOpenTop = nullptr 
)

A link's true full depth (crown height above the invert).

Returns g1 directly for the shapes that report a depth there, and falls back to the sampler only for STREET / IRREGULAR / CUSTOM — so the common closed-pipe path costs nothing. Returns 0 when the geometry cannot be resolved (the caller then has no crown to draw).

Parameters
[out]outOpenTopWhen non-null, receives whether the section should be DRAWN with an open top. This is a presentation predicate, not the engine's hydraulic one: it is swmm_xsect_is_open() || shape == STREET. The engine deliberately classifies a street as closed (its isOpen whitelist omits STREET_XSECT), but a street drawn with a soffit line reads as a box culvert, which it is not.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ nominalGeomsFor()

void openswmmvis::sectionview::nominalGeomsFor ( int  shape,
double geom1,
double geom2,
double geom3,
double geom4 
)

Representative geom1..geom4 used to draw shape at unit depth.

Exposed so tests can assert every surfaced shape produces a valid engine handle — a shape whose nominal geoms are rejected would silently fall back to the placeholder tile.

Here is the caller graph for this function:

◆ paintSectionDiagram()

void openswmmvis::sectionview::paintSectionDiagram ( QPainter &  painter,
const QRectF &  target,
const SectionDiagramModel model,
const QPalette &  palette,
const DiagramViewport viewport = {},
QRectF *  fitRectOut = nullptr,
double achievedExaggerationOut = nullptr 
)

Paint model into target using palette for all colours.

Reserves margins for the title / footer and for leader landings, fits the model bounds into what remains, and declutters progressively as the target shrinks: leaders drop out first, then dimensions, then the footer — so a narrow dock still shows a correct (if bare) drawing rather than a pile of overlapping text.

The painter's state is saved and restored; no transform leaks out.

Parameters
fitRectOutOptionally receives the pixel rect the model bounds were fitted into, BEFORE zoom/pan. A zooming host needs it to keep the point under the cursor stationary; reporting it beats recomputing it, because the fit reserves adaptive margins for leader and dimension text and a second copy of that logic would silently drift. Left untouched when the model is empty or too small to draw.
achievedExaggerationOutOptionally receives the V:H ratio actually used (1.0 for a true-scale or uniform-scale drawing). Reporting it beats inferring it from rendered pixels — which is what tests would otherwise have to do, and what a zoom readout would need.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ profileMaxExaggeration()

double openswmmvis::sectionview::profileMaxExaggeration ( )
noexcept

Cap on the automatic vertical exaggeration of a link profile.

Exposed so the Section View dock can state it without hard-coding a second copy in its tooltip.

◆ samplerForLink()

XsectSampler openswmmvis::sectionview::samplerForLink ( SWMM_Engine  engine,
int  linkIdx,
int  shape,
double  g1,
double  g2,
double  g3,
double  g4,
bool  si 
)

Sampler for a link's cross-section, given the values swmm_link_get_xsect reported for it.

Warning
For STREET and IRREGULAR, geom1 is a TABLE INDEX, not a depth — the engine resolves the retained name back to an index for both (openswmm_links_impl.cpp, swmm_link_get_xsect). Callers must never use geom1 as a dimension for those two shapes; take the depth from fullProps().yFull instead, which is what linkFullDepth() does. Every other shape reports a real depth in geom1.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ samplerFromStreetIndex()

XsectSampler openswmmvis::sectionview::samplerFromStreetIndex ( SWMM_Engine  engine,
int  streetIdx,
bool  si 
)

Sampler for the street at streetIdx, built from [STREETS].

Preferred over the link-derived handle because swmm_street_get_params reads stored input and therefore works in EVERY lifecycle state, whereas swmm_link_create_xsect needs resolved geometry and returns SWMM_ERR_LIFECYCLE while the model is still being edited.

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

◆ xsectShapeIcon()

QIcon openswmmvis::sectionview::xsectShapeIcon ( int  shape,
const QSize &  size,
const QPalette &  palette 
)

Icon for a SWMM_XSectShape, rendered from engine geometry.

Results are cached per (shape, size, palette-foreground) in QPixmapCache, so repopulating the palette on every dialog open is cheap.

Returns
A generic placeholder icon for shapes with no drawable geometry (SWMM_XSECT_DUMMY) or when the engine declines the nominal geoms — never a null icon, so the list always has something to draw.
Here is the call graph for this function: