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

Dynamic water-quality species as themeable result attributes (GUI plan D-G1 / subplan Y2a). More...

#include <QSet>
#include <QString>
#include <QStringList>
Include dependency graph for speciesattributes.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  OpenSWMMVis::Species::SpeciesMissWarner
 D-G1 warn-on-miss (Y2b-3): a saved theme or series may name a species the currently-open run does not carry (saved against a 3-species run, reopened against 1). Resolution already degrades to "no theme" (−1); this class supplies the WORDS — once per token, so per-frame resolution cannot spam the log. One instance per results layer; reset() when the run changes (the new run may carry it). More...
 

Namespaces

namespace  OpenSWMMVis
 
namespace  OpenSWMMVis::Species
 

Functions

QString OpenSWMMVis::Species::speciesAttributeName (const QString &species)
 "TSS""qual:TSS" — the token persisted in .oswp.
 
bool OpenSWMMVis::Species::isSpeciesAttribute (const QString &attr)
 True if attr is a species attribute token.
 
QString OpenSWMMVis::Species::speciesFromAttribute (const QString &attr)
 "qual:TSS""TSS"; empty for a non-species attribute.
 
QString OpenSWMMVis::Species::speciesDisplayLabel (const QString &species)
 Picker label for a species: friendly text for the reserved pair, the bare name for an ordinary pollutant.
 
QString OpenSWMMVis::Species::speciesUnitLabel (const QString &species, const QString &concentrationUnit)
 Unit string for a species. The reserved pair carry fixed units the .out enum cannot express (hours / °C — engine A2b); an ordinary pollutant uses concentrationUnit as reported.
 
bool OpenSWMMVis::Species::isReservedSpecies (const QString &species)
 True for the reserved species (age / temperature).
 
int OpenSWMMVis::Species::speciesOutCode (const QString &attr, const QStringList &species, int pollutBase)
 Resolve attr to an engine output variable code.
 
QStringList OpenSWMMVis::Species::inflowConstituentNames (const QStringList &pollutants)
 Y4 (amendment D-Y4): constituent choices for an [INFLOWS] editor — FLOW, every pollutant, then the reserved AGE species (§3.3's exclusion lifted for age ONLY; temperature keeps the dedicated-page treatment until heat's round and must NOT appear). Engine NAMES — combo labels come from inflowConstituentLabel().
 
QString OpenSWMMVis::Species::inflowConstituentLabel (const QString &name)
 Combo label for an inflow constituent: the species display label for the reserved pair ("Water age (hours)" — the row's value column means HOURS, never mg/L), the bare name otherwise.
 
bool OpenSWMMVis::Species::inflowMassAllowed (const QString &name)
 MASS is a pollutant-only inflow type: meaningless for FLOW and for the age species (the engine takes a MASS-typed age row as hours WITH a warning — the editor must not author what warns).
 

Variables

constexpr const char * OpenSWMMVis::Species::kWaterAgeName = "__WATER_AGE__"
 
constexpr const char * OpenSWMMVis::Species::kTemperatureName = "__TEMPERATURE__"
 
constexpr const char * OpenSWMMVis::Species::kSpeciesAttrPrefix = "qual:"
 

Detailed Description

Dynamic water-quality species as themeable result attributes (GUI plan D-G1 / subplan Y2a).

A run carries N species — pollutants plus the reserved __WATER_AGE__ and __TEMPERATURE__ — and N is only known once an .out is open. The engine's output ABI already indexes them as SWMM_OUT_*_POLLUT_BASE + speciesIndex, so the transient lookup code is the engine's own convention.

What must NOT be an index is the persisted identity: D-G1 requires themes and plots to reference a species by NAME so a model edit that reorders species cannot silently repoint a saved theme. Hence the attribute string is "qual:<SpeciesName>" — the token that flows through FeatureSublayerStyle::attribute into .oswp — and the index is resolved against the loaded run every time it is needed. An unresolvable name yields −1, which every existing call site already skips cleanly (the "warn on miss" foundation).

These are free functions in their own translation unit on purpose: SWMMResultsLayer is too heavy to link into a test (the same closure problem tests/gui/CMakeLists.txt:1996 records for the options dialog), so the logic that can carry a defect lives where a test can reach it.

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License\n Apache-2.0