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

Time-series data export (CSV / SWMM .dat) for the Comparison Plot Dialog. More...

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

Go to the source code of this file.

Classes

struct  openswmmvis::plot::ExportSeries
 One series to export — name becomes the CSV column header / .dat comment line. Times are SWMM Julian doubles (see core/swmmdatetime.h). More...
 

Namespaces

namespace  openswmmvis
 
namespace  openswmmvis::plot
 

Functions

QString openswmmvis::plot::seriesToCsvText (const QVector< ExportSeries > &series)
 Build wide-format CSV text: column 0 = ISO timestamp, one column per series. Rows are the sorted union of all series' timestamps; a cell is empty where its series has no sample (or a non-finite value) at that time.
 
QString openswmmvis::plot::seriesToDatText (const ExportSeries &series)
 Build SWMM .dat text for a single series: ";name" comment line followed by "MM/dd/yyyy HH:mm:ss value" rows. Non-finite values are skipped (SWMM cannot parse them).
 
bool openswmmvis::plot::writeSeriesCsv (const QString &path, const QVector< ExportSeries > &series, QString *errorOut=nullptr)
 Write CSV to path. Returns false and populates errorOut on failure.
 
QStringList openswmmvis::plot::writeSeriesDat (const QString &path, const QVector< ExportSeries > &series, QString *errorOut=nullptr)
 Write .dat file(s). A single series writes exactly path; multiple series write one file each, named "<base>_<sanitized series name>.dat" beside path. Returns the list of files written (empty on failure, with errorOut populated).
 
QString openswmmvis::plot::sanitizedFileToken (const QString &name)
 Reduce a series name to a filesystem-safe token for the multi-series .dat fan-out (non [A-Za-z0-9_-] runs collapse to '_').
 

Detailed Description

Time-series data export (CSV / SWMM .dat) for the Comparison Plot Dialog.

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
Date
2026
License\n GPL-3.0-or-later

Pure model-layer code (Qt Core only — no widgets) so the formats are unit-testable. Both formats round-trip through the app's own readers:

  • CSV uses ISO "yyyy-MM-dd HH:mm:ss" timestamps, which ObservedCsvRunLayer (via io::parseRow) re-loads directly.
  • .dat uses the SWMM external time-series format ("MM/dd/yyyy HH:mm:ss value"), readable by the engine's TIMESERIES FILE mechanism and by ObservedCsvRunLayer.

A .dat file carries exactly one series, so exporting N > 1 series to .dat fans out to one file per series with the series name appended to the chosen base name.