![]() |
SWMMVis
6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
|
Overlays time-stepped simulation results on the SWMM network geometry. More...
#include <swmmresultslayer.h>
Public Member Functions | |
| SWMMResultsLayer (const QString &resultsFilePath, class SWMMModelLayer *modelLayer, OpenSWMMVisWorkspace *parent=nullptr) | |
| ~SWMMResultsLayer () override | |
| class SWMMModelLayer * | modelLayer () 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::IFeatureRenderer * | renderer () 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::IFeatureRenderer * | 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()). | |
| 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::LegendSymbolItem > | legendSymbolItems () |
| 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::RuleList * | ruleList () override |
| const OpenSWMM::Render::RuleList * | ruleList () const override |
| QVector< OpenSWMM::Render::AttributeField > | availableAttributes (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::FeatureSublayer * | featureSublayer (SWMMModelLayer::Category c) const |
| QList< OpenSWMM::Render::LegendSymbolItem > | sublayerLegendItems () |
| 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]. | |
| SpatialReferenceSystem * | srs () 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::TemporalSpec & | temporalSpec () const |
| void | setTemporalSpec (const OpenSWMM::Render::TemporalSpec &spec) |
| const OpenSWMM::Render::LabelConfig & | labelConfig () const |
| const OpenSWMM::Render::MaskSpec & | maskSpec () const |
| void | setMaskSpec (const OpenSWMM::Render::MaskSpec &spec) |
| const OpenSWMM::Render::AuxiliaryStorageSpec & | auxStorageSpec () 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::DiagramSpec & | diagramSpec () const |
| void | setDiagramSpec (const OpenSWMM::Render::DiagramSpec &spec) |
| OpenSWMMVisWorkspace * | workspace () 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< LegendSymbolItem > | aggregatedLegendSymbolItems (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 ISublayer * | findSublayer (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") | |
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:
The layer delegates geometry loading to an associated SWMMModelLayer and only manages the colour-mapping / time-stepped rendering.
|
explicit |
|
override |
| void SWMMResultsLayer::autoStretchColorRamp | ( | ) |
Automatically sets the colour ramp range from the data min/max across all time steps for the current variable.
|
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.
| void SWMMResultsLayer::closeResults | ( | ) |
| QColor SWMMResultsLayer::colorForClass | ( | const QString & | classKey | ) | const |
| RasterColorRamp SWMMResultsLayer::colorRamp | ( | ) | const |
| QDateTime SWMMResultsLayer::currentDateTime | ( | ) | const |
|
signal |
| int SWMMResultsLayer::currentTimeStep | ( | ) | const |
|
signal |
|
overridevirtual |
Removes all QGraphicsItems belonging to this layer from the scene.
Reimplemented from OpenSWMMVisLayer.
|
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.
| QDateTime SWMMResultsLayer::endDateTime | ( | ) | 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.
| 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).
| 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.
|
inlinenoexcept |
True between openResultsLive() and the footer's arrival.
| 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).
| 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.
| QList< OpenSWMM::Render::LegendSymbolItem > SWMMResultsLayer::legendSymbolItems | ( | ) |
| int SWMMResultsLayer::linkOutputIndex | ( | const QString & | name | ) | const |
Output-file index for the named link, or -1.
| double SWMMResultsLayer::linkStatMaxFilling | ( | const QString & | linkName | ) | const |
| double SWMMResultsLayer::linkStatMaxFlow | ( | const QString & | linkName | ) | const |
| double SWMMResultsLayer::linkStatMaxVelocity | ( | const QString & | linkName | ) | const |
| 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.
| 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.
| double SWMMResultsLayer::linkStatPumpVolume | ( | const QString & | linkName | ) | const |
| double SWMMResultsLayer::linkStatSurchargeTime | ( | const QString & | linkName | ) | const |
| double SWMMResultsLayer::linkStatVolFlow | ( | const QString & | linkName | ) | 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.
|
overridevirtual |
Reorder sublayers in paint order (bottom-up). Emits repaintRequested() on success. Returns false on out-of-range indices.
Reimplemented from OpenSWMM::Render::ISublayerHost.
| 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.
| double SWMMResultsLayer::nodeStatMaxDepth | ( | const QString & | nodeName | ) | const |
| double SWMMResultsLayer::nodeStatMaxOverflow | ( | const QString & | nodeName | ) | const |
| double SWMMResultsLayer::nodeStatTimeFlooded | ( | const QString & | nodeName | ) | const |
| double SWMMResultsLayer::nodeStatVolFlooded | ( | const QString & | nodeName | ) | const |
|
overridevirtual |
Called when the user changes the canvas CRS so layers can pre-compute any CRS-dependent transform caches.
| newCanvasSRS | The new canvas CRS. |
Reimplemented from OpenSWMMVisLayer.
| bool SWMMResultsLayer::openResults | ( | QList< QString > & | warnings, |
| QList< QString > & | errors | ||
| ) |
Opens the binary results file.
| 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.
| 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).
| 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.
| 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].
| 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.
|
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.
|
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:
| scene | The shared OpenSWMMVisScene to add items to. |
| canvasExtent | Visible extent in canvas-CRS coordinates. |
| canvasSRS | The CRS currently used by the MapCanvas. |
Implements OpenSWMMVisLayer.
| QPen SWMMResultsLayer::profileEglLinePen | ( | ) | const |
| QBrush SWMMResultsLayer::profileHglFillBrush | ( | ) | const |
| QPen SWMMResultsLayer::profileHglLinePen | ( | ) | const |
| 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).
|
signal |
| QPen SWMMResultsLayer::profileMaxEglLinePen | ( | ) | const |
| QBrush SWMMResultsLayer::profileMaxHglFillBrush | ( | ) | const |
| QPen SWMMResultsLayer::profileMaxHglLinePen | ( | ) | const |
|
signal |
any of profile{Hgl,Egl,MaxHgl,MaxEgl}Line/FillBrush changed
| 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.
| 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.
| 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.
|
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.
|
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.
|
signal |
| QDateTime SWMMResultsLayer::reportedStartDateTime | ( | ) | const |
| 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.
| int SWMMResultsLayer::reportStepSeconds | ( | ) | const |
| 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).
|
signal |
| QString SWMMResultsLayer::resultsFilePath | ( | ) | const |
|
signal |
|
signal |
Live tail: the writer's closing records arrived; the file is final.
|
signal |
|
signal |
Emitted on the GUI thread when openResultsAsync() completes.
|
overridevirtual |
Reimplemented from OpenSWMMVisLayer.
|
overridevirtual |
Reimplemented from OpenSWMMVisLayer.
| QString SWMMResultsLayer::scenarioName | ( | ) | const |
User-visible name for this run/scenario (editable, persisted in .oswp).
Defaults to "Run — HH:MM:SS" at construction time.
|
signal |
| void SWMMResultsLayer::setColorForClass | ( | const QString & | classKey, |
| const QColor & | color | ||
| ) |
| void SWMMResultsLayer::setColorRamp | ( | const RasterColorRamp & | ramp | ) |
| void SWMMResultsLayer::setCurrentTimeStep | ( | int | step | ) |
Seeks to the given 0-based time step.
| 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.
|
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.
| void SWMMResultsLayer::setProfileEglLinePen | ( | const QPen & | pen | ) |
| void SWMMResultsLayer::setProfileHglFillBrush | ( | const QBrush & | brush | ) |
| void SWMMResultsLayer::setProfileHglLinePen | ( | const QPen & | pen | ) |
| void SWMMResultsLayer::setProfileLineColor | ( | const QColor & | color | ) |
| void SWMMResultsLayer::setProfileMaxEglLinePen | ( | const QPen & | pen | ) |
| void SWMMResultsLayer::setProfileMaxHglFillBrush | ( | const QBrush & | brush | ) |
| void SWMMResultsLayer::setProfileMaxHglLinePen | ( | const QPen & | pen | ) |
|
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.
| void SWMMResultsLayer::setReportFilePath | ( | const QString & | path | ) |
| void SWMMResultsLayer::setScenarioName | ( | const QString & | name | ) |
| void SWMMResultsLayer::setShowLegend | ( | bool | show | ) |
| void SWMMResultsLayer::setVariable | ( | SWMMResultVariable | var | ) |
| bool SWMMResultsLayer::showLegend | ( | ) | const |
|
signal |
| qreal SWMMResultsLayer::sizeForClass | ( | const QString & | classKey | ) | 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.
| 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.
| QDateTime SWMMResultsLayer::startDateTime | ( | ) | const |
| void SWMMResultsLayer::stepBackward | ( | bool | loop = false | ) |
Goes back one time step (wraps at start if loop is true).
| void SWMMResultsLayer::stepForward | ( | bool | loop = false | ) |
Advances to the next time step (wraps at end if loop is true).
|
overridevirtual |
Slice U-2 — surface every visible-results sublayer (and the scenario / variable controls) as styleable subjects for the unified LayerStyleDialog.
Reimplemented from OpenSWMMVisLayer.
| 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.
| double SWMMResultsLayer::subcatchStatMaxRunoff | ( | const QString & | subName | ) | const |
| double SWMMResultsLayer::subcatchStatPrecip | ( | const QString & | subName | ) | const |
| double SWMMResultsLayer::subcatchStatRunoffVol | ( | const QString & | subName | ) | const |
| 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.
|
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.
| bool SWMMResultsLayer::supportsClassEdit | ( | OpenSWMM::Render::ClassEditKind | kind | ) | const |
| int SWMMResultsLayer::totalTimeSteps | ( | ) | const |
|
signal |
| SWMMResultVariable SWMMResultsLayer::variable | ( | ) | const |
|
signal |
| 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.
|
read |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
read |
|
readwrite |
|
readwrite |
|
read |
|
readwrite |