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
observedcsvrunlayer.h
Go to the documentation of this file.
1
26#ifndef OPENSWMMVIS_PLOT_OBSERVEDCSVRUNLAYER_H
27#define OPENSWMMVIS_PLOT_OBSERVEDCSVRUNLAYER_H
28
29#include "plot/irunlayer.h"
30
31#include <QHash>
32#include <QString>
33#include <QStringList>
34
35#include <vector>
36
37namespace openswmmvis::plot {
38
39class ObservedCsvRunLayer final : public IRunLayer
40{
41public:
57 static std::unique_ptr<ObservedCsvRunLayer> load(
58 const QString& path,
59 PlotAttribute defaultAttr,
60 UnitSystem unitSys = UnitSystem::SI,
61 QString *errorOut = nullptr);
62
63 ~ObservedCsvRunLayer() override = default;
64
67 const QStringList& columnLabels() const noexcept { return m_labels; }
68
70 const QString& sourcePath() const noexcept { return m_path; }
71
72 // IRunLayer
73 QString scenarioName() const override;
74 UnitSystem unitSystem() const override { return m_unit; }
75 double startDateJulian() const override;
76 int periodCount() const override;
77 int reportStepSeconds() const override;
78 QString persistenceKey() const override;
79
80 void getSeriesAt(const ObjectRef& ref,
81 PlotAttribute attr,
82 SeriesData& out) const override;
83
84 bool supportsAttribute(PlotAttribute attr) const override;
85
86private:
87 ObservedCsvRunLayer() = default;
88
92 static bool parseRow_(const QString& line,
93 QChar delim,
94 double& timeJulianOut,
95 std::vector<double>& valuesOut,
96 double hoursSinceStartFallbackBase);
97
98 QString m_path;
99 QString m_label;
100 UnitSystem m_unit = UnitSystem::SI;
102 QStringList m_labels;
103 std::vector<double> m_timesJulian;
104 QHash<QString, std::vector<double>> m_byLabel;
105};
106
107} // namespace openswmmvis::plot
108
109#endif // OPENSWMMVIS_PLOT_OBSERVEDCSVRUNLAYER_H
Per-project flow-units state + label helpers.
Definition unitsystem.h:28
Abstract source backing one comparison-plot run.
Definition irunlayer.h:171
Definition observedcsvrunlayer.h:40
double startDateJulian() const override
Start date of the simulation as SWMM Julian, or NaN if unknown.
Definition observedcsvrunlayer.cpp:148
void getSeriesAt(const ObjectRef &ref, PlotAttribute attr, SeriesData &out) const override
Resolve a series. Returns timesJulian + values for the spec. Implementations are responsible for reso...
Definition observedcsvrunlayer.cpp:181
static std::unique_ptr< ObservedCsvRunLayer > load(const QString &path, PlotAttribute defaultAttr, UnitSystem unitSys=UnitSystem::SI, QString *errorOut=nullptr)
Load a CSV / TSV file and assign all its columns to a single chart attribute (the row they land on).
Definition observedcsvrunlayer.cpp:48
const QStringList & columnLabels() const noexcept
Column labels for all loaded series — order matches the CSV's column order. Useful for the dialog to ...
Definition observedcsvrunlayer.h:67
int reportStepSeconds() const override
Report step in seconds. 0 if unknown.
Definition observedcsvrunlayer.cpp:159
int periodCount() const override
Total number of time periods available (grows during live mode).
Definition observedcsvrunlayer.cpp:154
QString scenarioName() const override
Human label shown in the SeriesPanel tree + legends.
Definition observedcsvrunlayer.cpp:143
bool supportsAttribute(PlotAttribute attr) const override
Convenience: does this source carry the given attribute at all? Default impl returns true; subclasses...
Definition observedcsvrunlayer.cpp:171
QString persistenceKey() const override
Stable identity string for .oswp round-trip. Defaults to the scenario name; subclasses may override w...
Definition observedcsvrunlayer.cpp:166
const QString & sourcePath() const noexcept
File path used to load.
Definition observedcsvrunlayer.h:70
UnitSystem unitSystem() const override
Unit system the source advertises (drives axis labels).
Definition observedcsvrunlayer.h:74
Slice BL — abstract "data-source" that the ComparisonPlotModel reads timeseries from.
Definition chartproperties.h:34
PlotAttribute
What a series plots. One row per attribute in the Nx2 grid.
Definition plotattribute.h:38
@ SI
m, m/s, m³/s, m³
EdgeRef ref
Definition pslgminsize.cpp:377
int path
Definition pslgminsize.cpp:234
Identifies what object a series is about. Kind is the discriminator; the active union member is impli...
Definition irunlayer.h:38
Result of one series resolution. Times are SWMM DateTime doubles (OLE-Automation epoch,...
Definition irunlayer.h:151