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
SWMMResultsLayer Class Reference

Overlays time-stepped simulation results on the SWMM network geometry. More...

#include <swmmresultslayer.h>

Inheritance diagram for SWMMResultsLayer:
Collaboration diagram for SWMMResultsLayer:

Signals

void resultsFilePathChanged (const QString &path)
 
void scenarioNameChanged (const QString &name)
 
void profileLineColorChanged (const QColor &color)
 
void profileStyleChanged ()
 
void currentTimeStepChanged (int step)
 
void currentDateTimeChanged (const QDateTime &dt)
 
void totalTimeStepsChanged (int count)
 
void periodsAppended (int firstNew, int count)
 
void resultsFinalized ()
 
void variableChanged (SWMMResultVariable var)
 
void showLegendChanged (bool show)
 
void resultsOpened ()
 
void resultsError (const QString &message)
 
void resultsOpenFinished (bool ok)
 Emitted on the GUI thread when openResultsAsync() completes.
 
void rendererChanged ()
 Emitted when setRenderer() swaps the renderer pointer.
 
- Signals inherited from OpenSWMMVisLayer
void nameChanged (const QString &newName)
 
void layerTypeChanged (OpenSWMMVisLayerType newType)
 
void visibilityChanged (bool visible)
 
void opacityChanged (double opacity)
 
void srsChanged (SpatialReferenceSystem *newSRS)
 
void extentChanged (const MapExtent &newExtent)
 
void childrenChanged ()
 
void repaintRequested ()
 
void temporalSpecChanged (const OpenSWMM::Render::TemporalSpec &spec)
 
void maskSpecChanged (const OpenSWMM::Render::MaskSpec &spec)
 
void auxStorageSpecChanged (const OpenSWMM::Render::AuxiliaryStorageSpec &spec)
 
void joinsChanged (const QVector< OpenSWMM::Render::JoinSpec > &joins)
 
void diagramSpecChanged (const OpenSWMM::Render::DiagramSpec &spec)
 
void labelConfigChanged ()
 

Public Member Functions

 SWMMResultsLayer (const QString &resultsFilePath, class SWMMModelLayer *modelLayer, OpenSWMMVisWorkspace *parent=nullptr)
 
 ~SWMMResultsLayer () override
 
class SWMMModelLayermodelLayer () const
 
QString resultsFilePath () const
 
QString reportFilePath () const
 Path of the .rpt summary report written by the run that produced this layer's .out file (empty when unknown).
 
void setReportFilePath (const QString &path)
 
QString sourceDescription () const override
 Human-readable source of this layer: a file path, a service URL, or a description for in-memory / derived layers.
 
QVector< QPair< QString, QString > > extendedMetadata () const override
 Ordered key→value pairs of TYPE-SPECIFIC metadata, rendered by the Metadata tab below the common block the dialog builds itself.
 
QString scenarioName () const
 User-visible name for this run/scenario (editable, persisted in .oswp).
 
void setScenarioName (const QString &name)
 
QColor profileLineColor () const
 Per-layer line/fill color used by Slice BC's profile plot.
 
void setProfileLineColor (const QColor &color)
 
QPen profileHglLinePen () const
 
QBrush profileHglFillBrush () const
 
QPen profileEglLinePen () const
 
QPen profileMaxHglLinePen () const
 
QBrush profileMaxHglFillBrush () const
 
QPen profileMaxEglLinePen () const
 
void setProfileHglLinePen (const QPen &pen)
 
void setProfileHglFillBrush (const QBrush &brush)
 
void setProfileEglLinePen (const QPen &pen)
 
void setProfileMaxHglLinePen (const QPen &pen)
 
void setProfileMaxHglFillBrush (const QBrush &brush)
 
void setProfileMaxEglLinePen (const QPen &pen)
 
void writeProfileStyle (class QSettings &settings) const
 Writes this layer's per-source profile pens & brushes to the current QSettings position. Called from the dialogs' source persistence loops while QSettings is already positioned at the matching array index.
 
void readProfileStyle (class QSettings &settings)
 Companion of writeProfileStyle. Reads any of the six keys present at the current QSettings position and pushes them through the per-setter, so missing keys leave the layer's defaults untouched.
 
bool openResults (QList< QString > &warnings, QList< QString > &errors)
 Opens the binary results file.
 
void openResultsAsync ()
 Asynchronous counterpart to openResults. Runs the blocking swmm_output_open (file + header/index parse) on a worker thread; the renderer install + period-0 fetch + emits run on the GUI thread, and resultsOpenFinished(bool) fires on completion.
 
bool openResultsLive (QList< QString > &errors)
 Open a results file the engine is still writing (live tail).
 
int refreshLive ()
 Re-count periods on a live file. Grows totalTimeSteps(), extends endDateTime(), drops whole-file aggregate caches, and emits totalTimeStepsChanged + periodsAppended when new periods appeared. When the writer's closing records have landed the layer leaves live mode and emits resultsFinalized.
 
bool isLive () const noexcept
 True between openResultsLive() and the footer's arrival.
 
void closeResults ()
 
double nodeStatMaxDepth (const QString &nodeName) const
 
double nodeStatMaxOverflow (const QString &nodeName) const
 
double nodeStatVolFlooded (const QString &nodeName) const
 
double nodeStatTimeFlooded (const QString &nodeName) const
 
double linkStatMaxFlow (const QString &linkName) const
 
double linkStatMaxVelocity (const QString &linkName) const
 
double linkStatMaxFilling (const QString &linkName) const
 
double linkStatVolFlow (const QString &linkName) const
 
double linkStatSurchargeTime (const QString &linkName) const
 
double linkStatPumpCycles (const QString &linkName) const
 
double linkStatPumpOnTime (const QString &linkName) const
 
double linkStatPumpVolume (const QString &linkName) const
 
double subcatchStatPrecip (const QString &subName) const
 
double subcatchStatRunoffVol (const QString &subName) const
 
double subcatchStatMaxRunoff (const QString &subName) const
 
int currentTimeStep () const
 
QDateTime currentDateTime () const
 
int totalTimeSteps () const
 
QDateTime startDateTime () const
 
QDateTime endDateTime () const
 
QDateTime reportedStartDateTime () const
 
int reportStepSeconds () const
 
void setCurrentTimeStep (int step)
 Seeks to the given 0-based time step.
 
int periodIndexForDateTime (const QDateTime &dt) const
 Returns the period index closest to dt on this layer's time grid.
 
int periodIndexForDateTimeAsOf (const QDateTime &dt) const
 Causal peer of periodIndexForDateTime: the latest period at or before dt (floor instead of nearest), clamped to [0, totalTimeSteps-1]. Used by AnimationController so a secondary output never displays a frame ahead of the animation cursor.
 
void stepForward (bool loop=false)
 Advances to the next time step (wraps at end if loop is true).
 
void stepBackward (bool loop=false)
 Goes back one time step (wraps at start if loop is true).
 
SWMMResultVariable variable () const
 
void setVariable (SWMMResultVariable var)
 
RasterColorRamp colorRamp () const
 
void setColorRamp (const RasterColorRamp &ramp)
 
void autoStretchColorRamp ()
 Automatically sets the colour ramp range from the data min/max across all time steps for the current variable.
 
OpenSWMM::Render::IFeatureRendererrenderer () const
 The IFeatureRenderer that will drive this layer's paint pass.
 
void setRenderer (std::unique_ptr< OpenSWMM::Render::IFeatureRenderer > r)
 Replaces the current renderer.
 
OpenSWMM::Render::IFeatureRendererkindRenderer (SWMMModelLayer::Category c) const
 Returns the per-kind renderer for category c, or nullptr when none has been installed yet (callers should fall back to the layer-level renderer()).
 
void setKindRenderer (SWMMModelLayer::Category c, std::unique_ptr< OpenSWMM::Render::IFeatureRenderer > r)
 Installs (or replaces) the per-kind renderer for category c. The layer takes ownership. A null pointer clears the slot (paint reverts to the layer-level renderer). Emits rendererChanged() when the slot pointer changes.
 
void resetKindRendererToDefaults (SWMMModelLayer::Category c)
 Restores the per-kind slot for c to its compile-time default (GraduatedRenderer keyed to the scope's primary result variable, Viridis ramp, EqualInterval 5-bin).
 
bool kindRendererIsDefault (SWMMModelLayer::Category c) const
 True when the installed kind renderer for c is semantically identical to the compile-time default — ignoring derived state (classification breaks, sampled ramp range). Gap A2.1 installs defaults eagerly on openResults(); the project serializer uses this to elide untouched slots so .oswp files stay minimal.
 
void refreshRuleMirror (SWMMModelLayer::Category c)
 Re-clones the live kind renderer for c into the Rule mirror (no-op when the rule list hasn't been built). Dialog editors read the mirror; call this before mounting one so it reflects in-place mutations (variable retargeting, re-classification, per-frame rebin) the setKindRenderer sync hook cannot observe.
 
QList< OpenSWMM::Render::LegendSymbolItemlegendSymbolItems ()
 
bool supportsClassEdit (OpenSWMM::Render::ClassEditKind kind) const
 
QColor colorForClass (const QString &classKey) const
 
void setColorForClass (const QString &classKey, const QColor &color)
 
qreal sizeForClass (const QString &classKey) const
 
OpenSWMM::Render::RuleListruleList () override
 
const OpenSWMM::Render::RuleListruleList () const override
 
QVector< OpenSWMM::Render::AttributeFieldavailableAttributes (OpenSWMMVis::SwmmCategory cat) const override
 
QStringList speciesNames () const
 Y2a — the loaded run's species names, in .out order (pollutants plus the reserved age/temperature columns).
 
bool showLegend () const
 
void setShowLegend (bool show)
 
SWMM_Output outputHandle () const
 Raw SWMM_Output handle to the open .out file, or nullptr when results aren't open yet. Exposed so Slice BC's profile plot can call swmm_output_get_node_series / swmm_output_get_link_series for bulk time-series fetches without a per-period round-trip.
 
int nodeOutputIndex (const QString &name) const
 Output-file index for the named node, or -1 if not found. The output file uses its own indexing scheme (a name-keyed order) that may differ from the engine's node index, so callers must resolve via name.
 
int linkOutputIndex (const QString &name) const
 Output-file index for the named link, or -1.
 
int subcatchOutputIndex (const QString &name) const
 Output-file index for the named subcatchment, or -1. Mirrors nodeOutputIndex / linkOutputIndex; added in Slice BL so the Comparison Plot Dialog can read subcatchment series.
 
int flowUnits () const
 Engine-reported flow units (0=CFS, 1=GPM, 2=MGD, 3=CMS, 4=LPS, 5=MLD). -1 when results aren't open. Used by the Comparison Plot Dialog to label axes in US vs SI.
 
void populateScene (QGraphicsScene *scene, const MapExtent &canvasExtent, const SpatialReferenceSystem *canvasSRS) override
 Creates / updates QGraphicsItems representing this layer in the scene.
 
void depopulateScene (QGraphicsScene *scene) override
 Removes all QGraphicsItems belonging to this layer from the scene.
 
void setLabelConfig (const OpenSWMM::Render::LabelConfig &cfg) override
 
void onCanvasCRSChanged (const SpatialReferenceSystem *newCanvasSRS) override
 Called when the user changes the canvas CRS so layers can pre-compute any CRS-dependent transform caches.
 
QList< OpenSWMM::Render::ISublayer * > sublayers () const override
 The ordered list of sublayers owned by this layer.
 
void dispatchAnimationTick (int period) override
 Hook invoked by AnimationController on every time-step change.
 
bool moveSublayer (int from, int to) override
 
OpenSWMM::Render::FeatureSublayerfeatureSublayer (SWMMModelLayer::Category c) const
 
QList< OpenSWMM::Render::LegendSymbolItemsublayerLegendItems ()
 Phase 8 (2026-05-25) — ramp-aware legend rows.
 
std::vector< std::unique_ptr< openswmmvis::ui::ILayerStyleSubject > > styleSubjects () override
 
void refreshScene (QGraphicsScene *scene, const MapExtent &canvasExtent, const SpatialReferenceSystem *canvasSRS) override
 Slice §Y.2 — incremental scene refresh.
 
- Public Member Functions inherited from OpenSWMMVisLayer
 OpenSWMMVisLayer (OpenSWMMVisWorkspace *parent)
 
 OpenSWMMVisLayer (const QString &name="Unlabeled Layer", OpenSWMMVisWorkspace *parent=nullptr)
 
virtual ~OpenSWMMVisLayer ()
 
QString layerId () const
 Returns the layer's immutable unique identifier (UUID).
 
QString name () const
 Returns the user-visible name of this layer.
 
void setName (const QString &name)
 Sets the user-visible name.
 
OpenSWMMVisLayerType layerType () const
 Returns the layer type discriminator.
 
bool isVisible () const
 Returns true when this layer should be drawn.
 
void setVisible (bool visible)
 Shows or hides this layer.
 
double opacity () const
 Returns the layer opacity in the range [0.0, 1.0]. 0.0 = fully transparent; 1.0 = fully opaque.
 
void setOpacity (double opacity)
 Sets the layer opacity. Values are clamped to [0.0, 1.0].
 
SpatialReferenceSystemsrs () const
 Returns the spatial reference system for this layer, or nullptr if the layer has no known CRS.
 
void setSRS (SpatialReferenceSystem *srs, bool ownsSRS=false)
 Sets (or replaces) the CRS for this layer.
 
QString crsDescription () const
 Returns a human-readable summary of this layer's CRS for display in the Properties window.
 
MapExtent extent () const
 Returns the layer extent in the layer's own CRS.
 
void setExtent (const MapExtent &extent)
 Sets the layer spatial extent (in the layer's CRS).
 
virtual bool isRasterLayer () const
 Returns true for layers that render into a raster buffer (WMS, WMTS, GISRaster) rather than populating QGraphicsItems.
 
virtual bool isBasemapLayer () const
 Returns true for world-spanning basemap layers (XYZ tile providers, WMS/WMTS services covering the whole world) that should NOT be included when computing the data-driven full extent.
 
virtual void render (QPainter *painter, const MapExtent &extent, const QSize &imageSize, const SpatialReferenceSystem *srs)
 Renders this layer's content directly into painter.
 
virtual void fetchCache (const MapExtent &extent, const QSize &viewportSize, const SpatialReferenceSystem *srs)
 Triggers any asynchronous (or synchronous) tile/data fetch needed to populate this layer's internal cache for the given view state.
 
void setViewportSize (int w, int h)
 Called by MapCanvas before refreshScene so layers can request the correct pixel dimensions for tile/image requests.
 
int viewportWidth () const
 
int viewportHeight () const
 
QVector< OpenSWMMVisLayer * > children () const
 Returns the ordered list of child layers.
 
double layerZValue () const
 Returns the z-value base assigned to this layer by the canvas. Items within the layer should use z-values relative to this.
 
void setLayerZValue (double z)
 Called by the canvas to set this layer's z-value band.
 
const OpenSWMM::Render::TemporalSpectemporalSpec () const
 
void setTemporalSpec (const OpenSWMM::Render::TemporalSpec &spec)
 
const OpenSWMM::Render::LabelConfiglabelConfig () const
 
const OpenSWMM::Render::MaskSpecmaskSpec () const
 
void setMaskSpec (const OpenSWMM::Render::MaskSpec &spec)
 
const OpenSWMM::Render::AuxiliaryStorageSpecauxStorageSpec () const
 
void setAuxStorageSpec (const OpenSWMM::Render::AuxiliaryStorageSpec &spec)
 
const QVector< OpenSWMM::Render::JoinSpec > & joins () const
 
void setJoins (const QVector< OpenSWMM::Render::JoinSpec > &joins)
 
const OpenSWMM::Render::DiagramSpecdiagramSpec () const
 
void setDiagramSpec (const OpenSWMM::Render::DiagramSpec &spec)
 
OpenSWMMVisWorkspaceworkspace () const
 
void setBasicAuth (const QString &username, const QString &password)
 Sets HTTP Basic authentication for all subsequent network requests.
 
void setHttpHeaders (const BasemapHttpHeaders &headers)
 Sets arbitrary extra HTTP headers applied to every request.
 
BasemapHttpHeaders httpHeaders () const
 
- Public Member Functions inherited from OpenSWMM::Render::ISublayerHost
virtual ~ISublayerHost ()=default
 
virtual void onSublayersJsonLoaded (const QJsonObject &sublayersJson)
 Hook fired at the end of loadSublayersFromJson with the raw payload, so hosts can migrate style data that moved BETWEEN sublayers across schema versions (e.g. the BC fields that left MeshEdgeStyle for MeshBcStyle). Runs on both project load and .swmm-style.json import. Default: no-op.
 
- Public Member Functions inherited from OpenSWMM::Render::IAttributeProvider
virtual ~IAttributeProvider ()=default
 

Properties

QString resultsFilePath
 
QString scenarioName
 
QColor profileLineColor
 
QPen profileHglLinePen
 
QBrush profileHglFillBrush
 
QPen profileEglLinePen
 
QPen profileMaxHglLinePen
 
QBrush profileMaxHglFillBrush
 
QPen profileMaxEglLinePen
 
int currentTimeStep
 
QDateTime currentDateTime
 
int totalTimeSteps
 
SWMMResultVariable variable
 
bool showLegend
 
- Properties inherited from OpenSWMMVisLayer
QString Name
 
bool Visible
 
double Opacity
 
QString LayerId
 
OpenSWMMVisLayerType LayerType
 
QVector< OpenSWMMVisLayer * > Children
 
QString CRS
 

Additional Inherited Members

- Public Types inherited from OpenSWMMVisLayer
enum  OpenSWMMVisLayerType {
  SWMMDefaultLayer = 0 ,
  SWMMModelLayer = 1 ,
  SWMMResultsLayer = 2 ,
  SWMMGISLayer = 3 ,
  SWMMVectorLayer = 4 ,
  SWMMRasterLayer = 5 ,
  SWMMImageryLayer = 6 ,
  SWMMTabularDataLayer = 7 ,
  SWMMTabularyTimeSeriesLayer = 8 ,
  SWMMSubProjectLayer = 9 ,
  SWMMWMSLayer = 10 ,
  SWMMWMTSLayer = 11 ,
  SWMM2DMeshLayer = 12 ,
  SWMM2DResultsLayer = 13 ,
  SWMMAnnotationLayer = 14 ,
  SWMMFeatureLayer = 15
}
 Discriminator for the concrete layer class. More...
 
- Static Public Member Functions inherited from OpenSWMM::Render::ISublayerHost
static QJsonObject saveSublayersToJson (const ISublayerHost &host)
 
static QList< LegendSymbolItemaggregatedLegendSymbolItems (const ISublayerHost &host)
 Aggregates every visible sublayer's legendSymbolItems() into a single flat list (Slice S4 / §J.5 — legend-from- renderer rule, sublayer extension).
 
static ISublayerfindSublayer (const ISublayerHost &host, const QString &id)
 O(N) lookup of a sublayer by its stable id. Returns nullptr when not found. Used by the legend dock's right-click handler in S4 to find the sublayer whose style dialog should open when the user clicks a sublayer-tagged swatch.
 
static void loadSublayersFromJson (ISublayerHost &host, const QJsonObject &j)
 
- Protected Member Functions inherited from OpenSWMMVisLayer
bool addChild (OpenSWMMVisLayer *child)
 
bool removeChild (OpenSWMMVisLayer *child)
 
void setLayerType (OpenSWMMVisLayerType type)
 
- Protected Attributes inherited from OpenSWMMVisLayer
QByteArray m_authHeader
 "Basic <base64>" or empty
 
BasemapHttpHeaders m_httpHeaders
 arbitrary headers (incl. "referer")
 

Detailed Description

Overlays time-stepped simulation results on the SWMM network geometry.

Reads output from an OpenSWMMEngine binary results file (.out), maps a selected variable at the current simulation time step to a colour ramp, and paints the network elements with those colours.

Supports:

  • Animation: step forward/backward through the time series.
  • Any SWMMResultVariable (node depth/head, link flow/velocity, etc.).
  • A configurable RasterColorRamp for consistent colour mapping.
  • Legend rendering.

The layer delegates geometry loading to an associated SWMMModelLayer and only manages the colour-mapping / time-stepped rendering.

Constructor & Destructor Documentation

◆ SWMMResultsLayer()

SWMMResultsLayer::SWMMResultsLayer ( const QString &  resultsFilePath,
class SWMMModelLayer modelLayer,
OpenSWMMVisWorkspace parent = nullptr 
)
explicit
Here is the call graph for this function:

◆ ~SWMMResultsLayer()

SWMMResultsLayer::~SWMMResultsLayer ( )
override
Here is the call graph for this function:

Member Function Documentation

◆ autoStretchColorRamp()

void SWMMResultsLayer::autoStretchColorRamp ( )

Automatically sets the colour ramp range from the data min/max across all time steps for the current variable.

◆ availableAttributes()

QVector< OpenSWMM::Render::AttributeField > SWMMResultsLayer::availableAttributes ( OpenSWMMVis::SwmmCategory  cat) const
overridevirtual

Available themeable fields for cat. Empty list is a valid answer — means the layer doesn't surface per-feature attributes on this category (e.g. SWMMModelLayer::CatRainGages has no per- feature engine fields).

Order = preferred picker order. Callers should NOT re-sort.

Implements OpenSWMM::Render::IAttributeProvider.

Here is the call graph for this function:

◆ closeResults()

void SWMMResultsLayer::closeResults ( )
Here is the caller graph for this function:

◆ colorForClass()

QColor SWMMResultsLayer::colorForClass ( const QString &  classKey) const
Here is the call graph for this function:

◆ colorRamp()

RasterColorRamp SWMMResultsLayer::colorRamp ( ) const

◆ currentDateTime()

QDateTime SWMMResultsLayer::currentDateTime ( ) const
Here is the call graph for this function:

◆ currentDateTimeChanged

void SWMMResultsLayer::currentDateTimeChanged ( const QDateTime &  dt)
signal
Here is the caller graph for this function:

◆ currentTimeStep()

int SWMMResultsLayer::currentTimeStep ( ) const

◆ currentTimeStepChanged

void SWMMResultsLayer::currentTimeStepChanged ( int  step)
signal
Here is the caller graph for this function:

◆ depopulateScene()

void SWMMResultsLayer::depopulateScene ( QGraphicsScene *  scene)
overridevirtual

Removes all QGraphicsItems belonging to this layer from the scene.

Reimplemented from OpenSWMMVisLayer.

Here is the call graph for this function:

◆ dispatchAnimationTick()

void SWMMResultsLayer::dispatchAnimationTick ( int  period)
overridevirtual

Hook invoked by AnimationController on every time-step change.

   The default implementation walks sublayers() and emits
   invalidated() on each entry whose isDynamic() returns true.
   Concrete hosts may override to batch the invalidation (e.g.
   coalesce multiple sublayer re-uploads into one QSG update
   cycle), but the contract is the same: static sublayers
   MUST NOT be invalidated by an animation tick.

   \p period is the new animation period index, suitable for
   forwarding into the per-frame SublayerContext built by the
   QSG renderer on its next updatePaintNode() call. The default
   implementation does not stash it — the renderer reads the
   authoritative value from AnimationController when building
   the context — but overrides may use it for per-host caching.

Reimplemented from OpenSWMM::Render::ISublayerHost.

Here is the call graph for this function:

◆ endDateTime()

QDateTime SWMMResultsLayer::endDateTime ( ) const
Here is the caller graph for this function:

◆ extendedMetadata()

QVector< QPair< QString, QString > > SWMMResultsLayer::extendedMetadata ( ) const
overridevirtual

Ordered key→value pairs of TYPE-SPECIFIC metadata, rendered by the Metadata tab below the common block the dialog builds itself.

Default empty. Subclasses add only what is unique to them (e.g. a mesh: vertices / cells / edges / elevation range). QVector<QPair> preserves insertion order without a new type.

Reimplemented from OpenSWMMVisLayer.

Here is the call graph for this function:

◆ featureSublayer()

OpenSWMM::Render::FeatureSublayer * SWMMResultsLayer::featureSublayer ( SWMMModelLayer::Category  c) const

Typed convenience accessor by Category. Returns nullptr if the category has no sublayer (out-of-range Category).

◆ flowUnits()

int SWMMResultsLayer::flowUnits ( ) const

Engine-reported flow units (0=CFS, 1=GPM, 2=MGD, 3=CMS, 4=LPS, 5=MLD). -1 when results aren't open. Used by the Comparison Plot Dialog to label axes in US vs SI.

◆ isLive()

bool SWMMResultsLayer::isLive ( ) const
inlinenoexcept

True between openResultsLive() and the footer's arrival.

◆ kindRenderer()

OpenSWMM::Render::IFeatureRenderer * SWMMResultsLayer::kindRenderer ( SWMMModelLayer::Category  c) const

Returns the per-kind renderer for category c, or nullptr when none has been installed yet (callers should fall back to the layer-level renderer()).

The kind ordinals match SWMMModelLayer::Category (11 entries: 4 node kinds + 5 link kinds + Subcatchments + RainGages — though RainGages doesn't carry results today).

Here is the caller graph for this function:

◆ kindRendererIsDefault()

bool SWMMResultsLayer::kindRendererIsDefault ( SWMMModelLayer::Category  c) const

True when the installed kind renderer for c is semantically identical to the compile-time default — ignoring derived state (classification breaks, sampled ramp range). Gap A2.1 installs defaults eagerly on openResults(); the project serializer uses this to elide untouched slots so .oswp files stay minimal.

Here is the call graph for this function:

◆ legendSymbolItems()

QList< OpenSWMM::Render::LegendSymbolItem > SWMMResultsLayer::legendSymbolItems ( )
Here is the call graph for this function:

◆ linkOutputIndex()

int SWMMResultsLayer::linkOutputIndex ( const QString &  name) const

Output-file index for the named link, or -1.

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

◆ linkStatMaxFilling()

double SWMMResultsLayer::linkStatMaxFilling ( const QString &  linkName) const
Here is the call graph for this function:

◆ linkStatMaxFlow()

double SWMMResultsLayer::linkStatMaxFlow ( const QString &  linkName) const
Here is the call graph for this function:

◆ linkStatMaxVelocity()

double SWMMResultsLayer::linkStatMaxVelocity ( const QString &  linkName) const
Here is the call graph for this function:

◆ linkStatPumpCycles()

double SWMMResultsLayer::linkStatPumpCycles ( const QString &  linkName) const

Pump start-up count.

ACCURACY: this is the statistic the report-step caveat hurts most, and it is a LOWER BOUND rather than an approximation with a small error bar. A pump that switches off and back on entirely between two report times leaves no trace in the .out file, so that cycle is invisible. Validated at REPORT_STEP 60 s / ROUTING_STEP 0.5 s: four of five pumps counted exactly, the fifth read 2 against the report's 3. On-time and volume pumped degrade gracefully over the same run (within 0.3 % and 0.04 %) because a brief outage barely moves an integral.

Here is the call graph for this function:

◆ linkStatPumpOnTime()

double SWMMResultsLayer::linkStatPumpOnTime ( const QString &  linkName) const

Pump on-time in HOURS — the Attribute Table column's unit. Note the editing-engine getter it stands in for reports SECONDS; the model's engine path wraps that in a conversion, and this path bypasses it.

Here is the call graph for this function:

◆ linkStatPumpVolume()

double SWMMResultsLayer::linkStatPumpVolume ( const QString &  linkName) const
Here is the call graph for this function:

◆ linkStatSurchargeTime()

double SWMMResultsLayer::linkStatSurchargeTime ( const QString &  linkName) const
Here is the call graph for this function:

◆ linkStatVolFlow()

double SWMMResultsLayer::linkStatVolFlow ( const QString &  linkName) const
Here is the call graph for this function:

◆ modelLayer()

class SWMMModelLayer * SWMMResultsLayer::modelLayer ( ) const
inline

The SWMM model layer that supplies network topology + attributes for this run. Categorized rendering on results layers reads categorical strings ("tag", "Link type", …) through here.

Here is the caller graph for this function:

◆ moveSublayer()

bool SWMMResultsLayer::moveSublayer ( int  from,
int  to 
)
overridevirtual

Reorder sublayers in paint order (bottom-up). Emits repaintRequested() on success. Returns false on out-of-range indices.

Reimplemented from OpenSWMM::Render::ISublayerHost.

Here is the call graph for this function:

◆ nodeOutputIndex()

int SWMMResultsLayer::nodeOutputIndex ( const QString &  name) const

Output-file index for the named node, or -1 if not found. The output file uses its own indexing scheme (a name-keyed order) that may differ from the engine's node index, so callers must resolve via name.

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

◆ nodeStatMaxDepth()

double SWMMResultsLayer::nodeStatMaxDepth ( const QString &  nodeName) const
Here is the call graph for this function:

◆ nodeStatMaxOverflow()

double SWMMResultsLayer::nodeStatMaxOverflow ( const QString &  nodeName) const
Here is the call graph for this function:

◆ nodeStatTimeFlooded()

double SWMMResultsLayer::nodeStatTimeFlooded ( const QString &  nodeName) const
Here is the call graph for this function:

◆ nodeStatVolFlooded()

double SWMMResultsLayer::nodeStatVolFlooded ( const QString &  nodeName) const
Here is the call graph for this function:

◆ onCanvasCRSChanged()

void SWMMResultsLayer::onCanvasCRSChanged ( const SpatialReferenceSystem newCanvasSRS)
overridevirtual

Called when the user changes the canvas CRS so layers can pre-compute any CRS-dependent transform caches.

Parameters
newCanvasSRSThe new canvas CRS.

Reimplemented from OpenSWMMVisLayer.

Here is the call graph for this function:

◆ openResults()

bool SWMMResultsLayer::openResults ( QList< QString > &  warnings,
QList< QString > &  errors 
)

Opens the binary results file.

Returns
true if the file was opened and indexed successfully.
Here is the call graph for this function:

◆ openResultsAsync()

void SWMMResultsLayer::openResultsAsync ( )

Asynchronous counterpart to openResults. Runs the blocking swmm_output_open (file + header/index parse) on a worker thread; the renderer install + period-0 fetch + emits run on the GUI thread, and resultsOpenFinished(bool) fires on completion.

Here is the call graph for this function:

◆ openResultsLive()

bool SWMMResultsLayer::openResultsLive ( QList< QString > &  errors)

Open a results file the engine is still writing (live tail).

Uses swmm_output_open_live: only the header needs to be on disk; the period count comes from the file size and grows via refreshLive. Returns false WITHOUT emitting resultsError when the header is not there yet — the caller retries on the next progress tick. Zero periods is a valid live state (totalTimeSteps() == 0 until the first report step is flushed).

Here is the call graph for this function:

◆ outputHandle()

SWMM_Output SWMMResultsLayer::outputHandle ( ) const

Raw SWMM_Output handle to the open .out file, or nullptr when results aren't open yet. Exposed so Slice BC's profile plot can call swmm_output_get_node_series / swmm_output_get_link_series for bulk time-series fetches without a per-period round-trip.

Here is the caller graph for this function:

◆ periodIndexForDateTime()

int SWMMResultsLayer::periodIndexForDateTime ( const QDateTime &  dt) const

Returns the period index closest to dt on this layer's time grid.

Used by AnimationController to snap secondary layers to the primary layer's current time. Result is clamped to [0, totalTimeSteps-1].

Here is the call graph for this function:

◆ periodIndexForDateTimeAsOf()

int SWMMResultsLayer::periodIndexForDateTimeAsOf ( const QDateTime &  dt) const

Causal peer of periodIndexForDateTime: the latest period at or before dt (floor instead of nearest), clamped to [0, totalTimeSteps-1]. Used by AnimationController so a secondary output never displays a frame ahead of the animation cursor.

Here is the call graph for this function:

◆ periodsAppended

void SWMMResultsLayer::periodsAppended ( int  firstNew,
int  count 
)
signal

Live tail: periods [firstNew, firstNew+count) are now readable. Views that keep incremental state (plot tails) append from here; the animation range follows totalTimeStepsChanged as before.

Here is the caller graph for this function:

◆ populateScene()

void SWMMResultsLayer::populateScene ( QGraphicsScene *  scene,
const MapExtent canvasExtent,
const SpatialReferenceSystem canvasSRS 
)
overridevirtual

Creates / updates QGraphicsItems representing this layer in the scene.

Derived classes override this to add their items to the scene. Items should be created in scene coordinates (= map CRS coordinates) after reprojecting from the layer's native CRS.

Called by the MapCanvas when:

  • The layer is first added.
  • The canvas CRS changes (after onCanvasCRSChanged).
  • The layer data changes (model loaded, tile fetched, etc.).
Parameters
sceneThe shared OpenSWMMVisScene to add items to.
canvasExtentVisible extent in canvas-CRS coordinates.
canvasSRSThe CRS currently used by the MapCanvas.

Implements OpenSWMMVisLayer.

Here is the call graph for this function:

◆ profileEglLinePen()

QPen SWMMResultsLayer::profileEglLinePen ( ) const

◆ profileHglFillBrush()

QBrush SWMMResultsLayer::profileHglFillBrush ( ) const

◆ profileHglLinePen()

QPen SWMMResultsLayer::profileHglLinePen ( ) const

◆ profileLineColor()

QColor SWMMResultsLayer::profileLineColor ( ) const

Per-layer line/fill color used by Slice BC's profile plot.

Auto-assigned at construction from the categorical palette (cycled by an internal layer counter), but user-editable via the Sources panel. Persisted in .oswp once the result-layer schema upgrades to objects (currently still a path-string array).

◆ profileLineColorChanged

void SWMMResultsLayer::profileLineColorChanged ( const QColor &  color)
signal
Here is the caller graph for this function:

◆ profileMaxEglLinePen()

QPen SWMMResultsLayer::profileMaxEglLinePen ( ) const

◆ profileMaxHglFillBrush()

QBrush SWMMResultsLayer::profileMaxHglFillBrush ( ) const

◆ profileMaxHglLinePen()

QPen SWMMResultsLayer::profileMaxHglLinePen ( ) const

◆ profileStyleChanged

void SWMMResultsLayer::profileStyleChanged ( )
signal

any of profile{Hgl,Egl,MaxHgl,MaxEgl}Line/FillBrush changed

Here is the caller graph for this function:

◆ readProfileStyle()

void SWMMResultsLayer::readProfileStyle ( class QSettings &  settings)

Companion of writeProfileStyle. Reads any of the six keys present at the current QSettings position and pushes them through the per-setter, so missing keys leave the layer's defaults untouched.

Here is the call graph for this function:

◆ refreshLive()

int SWMMResultsLayer::refreshLive ( )

Re-count periods on a live file. Grows totalTimeSteps(), extends endDateTime(), drops whole-file aggregate caches, and emits totalTimeStepsChanged + periodsAppended when new periods appeared. When the writer's closing records have landed the layer leaves live mode and emits resultsFinalized.

Returns
the current period count (unchanged when not live).
Here is the call graph for this function:

◆ refreshRuleMirror()

void SWMMResultsLayer::refreshRuleMirror ( SWMMModelLayer::Category  c)

Re-clones the live kind renderer for c into the Rule mirror (no-op when the rule list hasn't been built). Dialog editors read the mirror; call this before mounting one so it reflects in-place mutations (variable retargeting, re-classification, per-frame rebin) the setKindRenderer sync hook cannot observe.

Here is the caller graph for this function:

◆ refreshScene()

void SWMMResultsLayer::refreshScene ( QGraphicsScene *  scene,
const MapExtent canvasExtent,
const SpatialReferenceSystem canvasSRS 
)
overridevirtual

Slice §Y.2 — incremental scene refresh.

Branches on m_sceneDirty: ValuesDirty walks the per-feature item cache and applies setBrush/setPen in place; Structural falls back to the base class depopulate + populate path. Clean returns immediately. The cache is populated during populateScene and cleared in depopulateScene.

Reimplemented from OpenSWMMVisLayer.

Here is the call graph for this function:

◆ renderer()

OpenSWMM::Render::IFeatureRenderer * SWMMResultsLayer::renderer ( ) const
virtual

The IFeatureRenderer that will drive this layer's paint pass.

Constructed eagerly as a default GraduatedRenderer so callers never have to null-check. Owned by the layer; do not delete. Returned non-const so the caller may classify / configure the renderer in place (mutations the layer should know about should go via setRenderer() to trigger rendererChanged()).

Reimplemented from OpenSWMMVisLayer.

◆ rendererChanged

void SWMMResultsLayer::rendererChanged ( )
signal

Emitted when setRenderer() swaps the renderer pointer.

Here is the caller graph for this function:

◆ reportedStartDateTime()

QDateTime SWMMResultsLayer::reportedStartDateTime ( ) const
Here is the caller graph for this function:

◆ reportFilePath()

QString SWMMResultsLayer::reportFilePath ( ) const

Path of the .rpt summary report written by the run that produced this layer's .out file (empty when unknown).

Set by SWMMVis when a simulation finishes; persisted in the .oswp sidecar (keyed by the result path) so the Report Viewer can list every run's report after a project reload.

Here is the caller graph for this function:

◆ reportStepSeconds()

int SWMMResultsLayer::reportStepSeconds ( ) const
Here is the caller graph for this function:

◆ resetKindRendererToDefaults()

void SWMMResultsLayer::resetKindRendererToDefaults ( SWMMModelLayer::Category  c)

Restores the per-kind slot for c to its compile-time default (GraduatedRenderer keyed to the scope's primary result variable, Viridis ramp, EqualInterval 5-bin).

Here is the call graph for this function:

◆ resultsError

void SWMMResultsLayer::resultsError ( const QString &  message)
signal
Here is the caller graph for this function:

◆ resultsFilePath()

QString SWMMResultsLayer::resultsFilePath ( ) const

◆ resultsFilePathChanged

void SWMMResultsLayer::resultsFilePathChanged ( const QString &  path)
signal

◆ resultsFinalized

void SWMMResultsLayer::resultsFinalized ( )
signal

Live tail: the writer's closing records arrived; the file is final.

Here is the caller graph for this function:

◆ resultsOpened

void SWMMResultsLayer::resultsOpened ( )
signal
Here is the caller graph for this function:

◆ resultsOpenFinished

void SWMMResultsLayer::resultsOpenFinished ( bool  ok)
signal

Emitted on the GUI thread when openResultsAsync() completes.

Here is the caller graph for this function:

◆ ruleList() [1/2]

const OpenSWMM::Render::RuleList * SWMMResultsLayer::ruleList ( ) const
overridevirtual

Reimplemented from OpenSWMMVisLayer.

◆ ruleList() [2/2]

OpenSWMM::Render::RuleList * SWMMResultsLayer::ruleList ( )
overridevirtual

Reimplemented from OpenSWMMVisLayer.

◆ scenarioName()

QString SWMMResultsLayer::scenarioName ( ) const

User-visible name for this run/scenario (editable, persisted in .oswp).

Defaults to "Run — HH:MM:SS" at construction time.

◆ scenarioNameChanged

void SWMMResultsLayer::scenarioNameChanged ( const QString &  name)
signal
Here is the caller graph for this function:

◆ setColorForClass()

void SWMMResultsLayer::setColorForClass ( const QString &  classKey,
const QColor &  color 
)
Here is the call graph for this function:

◆ setColorRamp()

void SWMMResultsLayer::setColorRamp ( const RasterColorRamp ramp)
Here is the call graph for this function:

◆ setCurrentTimeStep()

void SWMMResultsLayer::setCurrentTimeStep ( int  step)

Seeks to the given 0-based time step.

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

◆ setKindRenderer()

void SWMMResultsLayer::setKindRenderer ( SWMMModelLayer::Category  c,
std::unique_ptr< OpenSWMM::Render::IFeatureRenderer r 
)

Installs (or replaces) the per-kind renderer for category c. The layer takes ownership. A null pointer clears the slot (paint reverts to the layer-level renderer). Emits rendererChanged() when the slot pointer changes.

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

◆ setLabelConfig()

void SWMMResultsLayer::setLabelConfig ( const OpenSWMM::Render::LabelConfig cfg)
overridevirtual

L-1 — a label-config change (enable / font / placement) only affects the label items, but refreshScene early-returns when the scene is Clean. Escalate to Values so the next refresh runs restyleScene → refreshLabels and the change is reflected without an animation tick.

Reimplemented from OpenSWMMVisLayer.

Here is the call graph for this function:

◆ setProfileEglLinePen()

void SWMMResultsLayer::setProfileEglLinePen ( const QPen &  pen)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setProfileHglFillBrush()

void SWMMResultsLayer::setProfileHglFillBrush ( const QBrush &  brush)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setProfileHglLinePen()

void SWMMResultsLayer::setProfileHglLinePen ( const QPen &  pen)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setProfileLineColor()

void SWMMResultsLayer::setProfileLineColor ( const QColor &  color)
Here is the call graph for this function:

◆ setProfileMaxEglLinePen()

void SWMMResultsLayer::setProfileMaxEglLinePen ( const QPen &  pen)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setProfileMaxHglFillBrush()

void SWMMResultsLayer::setProfileMaxHglFillBrush ( const QBrush &  brush)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setProfileMaxHglLinePen()

void SWMMResultsLayer::setProfileMaxHglLinePen ( const QPen &  pen)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setRenderer()

void SWMMResultsLayer::setRenderer ( std::unique_ptr< OpenSWMM::Render::IFeatureRenderer r)
virtual

Replaces the current renderer.

The layer takes ownership. A null pointer is rejected (the method silently no-ops) so renderer() never returns nullptr. Emits rendererChanged() when the renderer pointer actually changes.

Reimplemented from OpenSWMMVisLayer.

Here is the call graph for this function:

◆ setReportFilePath()

void SWMMResultsLayer::setReportFilePath ( const QString &  path)

◆ setScenarioName()

void SWMMResultsLayer::setScenarioName ( const QString &  name)
Here is the call graph for this function:

◆ setShowLegend()

void SWMMResultsLayer::setShowLegend ( bool  show)
Here is the call graph for this function:

◆ setVariable()

void SWMMResultsLayer::setVariable ( SWMMResultVariable  var)
Here is the call graph for this function:

◆ showLegend()

bool SWMMResultsLayer::showLegend ( ) const

◆ showLegendChanged

void SWMMResultsLayer::showLegendChanged ( bool  show)
signal
Here is the caller graph for this function:

◆ sizeForClass()

qreal SWMMResultsLayer::sizeForClass ( const QString &  classKey) const
Here is the call graph for this function:

◆ sourceDescription()

QString SWMMResultsLayer::sourceDescription ( ) const
overridevirtual

Human-readable source of this layer: a file path, a service URL, or a description for in-memory / derived layers.

Default empty — the dialog shows "(none)". Concrete layers override to return their real origin (e.g. modelFilePath(), resultsFilePath(), serviceUrl(), or "(generated mesh)").

Reimplemented from OpenSWMMVisLayer.

◆ speciesNames()

QStringList SWMMResultsLayer::speciesNames ( ) const

Y2a — the loaded run's species names, in .out order (pollutants plus the reserved age/temperature columns).

Empty when no results are open or the run carries no quality. Read live from the reader rather than cached: the handle is reopened on reload and a stale list would repoint every species theme by a slot.

Here is the caller graph for this function:

◆ startDateTime()

QDateTime SWMMResultsLayer::startDateTime ( ) const
Here is the caller graph for this function:

◆ stepBackward()

void SWMMResultsLayer::stepBackward ( bool  loop = false)

Goes back one time step (wraps at start if loop is true).

Here is the call graph for this function:

◆ stepForward()

void SWMMResultsLayer::stepForward ( bool  loop = false)

Advances to the next time step (wraps at end if loop is true).

Here is the call graph for this function:

◆ styleSubjects()

std::vector< std::unique_ptr< openswmmvis::ui::ILayerStyleSubject > > SWMMResultsLayer::styleSubjects ( )
overridevirtual

Slice U-2 — surface every visible-results sublayer (and the scenario / variable controls) as styleable subjects for the unified LayerStyleDialog.

Reimplemented from OpenSWMMVisLayer.

◆ subcatchOutputIndex()

int SWMMResultsLayer::subcatchOutputIndex ( const QString &  name) const

Output-file index for the named subcatchment, or -1. Mirrors nodeOutputIndex / linkOutputIndex; added in Slice BL so the Comparison Plot Dialog can read subcatchment series.

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

◆ subcatchStatMaxRunoff()

double SWMMResultsLayer::subcatchStatMaxRunoff ( const QString &  subName) const
Here is the call graph for this function:

◆ subcatchStatPrecip()

double SWMMResultsLayer::subcatchStatPrecip ( const QString &  subName) const
Here is the call graph for this function:

◆ subcatchStatRunoffVol()

double SWMMResultsLayer::subcatchStatRunoffVol ( const QString &  subName) const
Here is the call graph for this function:

◆ sublayerLegendItems()

QList< OpenSWMM::Render::LegendSymbolItem > SWMMResultsLayer::sublayerLegendItems ( )

Phase 8 (2026-05-25) — ramp-aware legend rows.

   Replaces the generic ISublayer::legendSymbolItems()
   single-swatch output with graduated legend rows that reflect
   what populateScene actually paints (5 bins from m_colorRamp,
   ranged across each sublayer's sampled attribute range, labelled
   with value samples). Used by LegendLayerTreeModel when the
   layer is a SWMMResultsLayer; the generic ISublayer aggregator
   remains the fallback for other host layers.

   Each item carries the sublayerId so the legend dock's
   right-click → "Edit Sublayer Style…" path (Phase 5) keeps
   working unchanged.

   Non-const because it may trigger lazy ensure*AttributeRange()
   sampling when first asked for an attribute's legend bins.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sublayers()

QList< OpenSWMM::Render::ISublayer * > SWMMResultsLayer::sublayers ( ) const
overridevirtual

The ordered list of sublayers owned by this layer.

   Paint order is list order (bottom-up). Callers must NOT
   cache the returned list across structural changes — the
   host may add / remove / reorder sublayers in response to
   user actions, and the references become stale.

   Returned references are non-owning; the host retains
   ownership of every sublayer.

Implements OpenSWMM::Render::ISublayerHost.

Here is the caller graph for this function:

◆ supportsClassEdit()

bool SWMMResultsLayer::supportsClassEdit ( OpenSWMM::Render::ClassEditKind  kind) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ totalTimeSteps()

int SWMMResultsLayer::totalTimeSteps ( ) const

◆ totalTimeStepsChanged

void SWMMResultsLayer::totalTimeStepsChanged ( int  count)
signal
Here is the caller graph for this function:

◆ variable()

SWMMResultVariable SWMMResultsLayer::variable ( ) const

◆ variableChanged

void SWMMResultsLayer::variableChanged ( SWMMResultVariable  var)
signal
Here is the caller graph for this function:

◆ writeProfileStyle()

void SWMMResultsLayer::writeProfileStyle ( class QSettings &  settings) const

Writes this layer's per-source profile pens & brushes to the current QSettings position. Called from the dialogs' source persistence loops while QSettings is already positioned at the matching array index.

Keys written (prefix-free, relative to the current group/array index): profileHglLinePen, profileHglFillBrush, profileEglLinePen, profileMaxHglLinePen, profileMaxHglFillBrush, profileMaxEglLinePen Values are QPen / QBrush variants — Qt serialises them via QDataStream so colour, width, style, and dash pattern all round-trip.

Property Documentation

◆ currentDateTime

QDateTime SWMMResultsLayer::currentDateTime
read

◆ currentTimeStep

int SWMMResultsLayer::currentTimeStep
readwrite

◆ profileEglLinePen

QPen SWMMResultsLayer::profileEglLinePen
readwrite

◆ profileHglFillBrush

QBrush SWMMResultsLayer::profileHglFillBrush
readwrite

◆ profileHglLinePen

QPen SWMMResultsLayer::profileHglLinePen
readwrite

◆ profileLineColor

QColor SWMMResultsLayer::profileLineColor
readwrite

◆ profileMaxEglLinePen

QPen SWMMResultsLayer::profileMaxEglLinePen
readwrite

◆ profileMaxHglFillBrush

QBrush SWMMResultsLayer::profileMaxHglFillBrush
readwrite

◆ profileMaxHglLinePen

QPen SWMMResultsLayer::profileMaxHglLinePen
readwrite

◆ resultsFilePath

QString SWMMResultsLayer::resultsFilePath
read

◆ scenarioName

QString SWMMResultsLayer::scenarioName
readwrite

◆ showLegend

bool SWMMResultsLayer::showLegend
readwrite

◆ totalTimeSteps

int SWMMResultsLayer::totalTimeSteps
read

◆ variable

SWMMResultVariable SWMMResultsLayer::variable
readwrite

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