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
openswmmvis::io Namespace Reference

Namespaces

namespace  gdalcaps
 
namespace  rastergeoref
 

Classes

struct  CoordinateReference
 How a 2D result source's XY coordinates relate to the model's CRS. More...
 
struct  Mesh2DExportInputs
 The run to export plus the unit / CRS context the source cannot state. More...
 
struct  Mesh2DExportOptions
 What to export. Collected by the dialog, consumed by exportMesh2DResults. More...
 
struct  Mesh2DExportReport
 What was written, or why nothing was. More...
 
struct  Mesh2DGridHint
 What a caller needs to size a raster before running the export. More...
 
class  Mesh2DH5Reader
 
class  RptParser
 
struct  RptSection
 
struct  SwmmDatState
 State carried across lines when reading a SWMM .dat timeseries file. More...
 

Typedefs

using Mesh2DExportProgress = std::function< bool(int done, int total, const QString &what)>
 Progress sink. Return false to cancel — every file written so far is then deleted, so a cancelled export leaves nothing half-written behind.
 

Enumerations

enum class  Mesh2DExportFormat {
  Shapefile ,
  GeoPackage ,
  GeoTiff
}
 Output container. Vector formats share one OGR code path. More...
 
enum class  Mesh2DInterp {
  NaturalNeighbour ,
  Idw ,
  GreenGauss
}
 How cell-centred values are carried to raster pixels. More...
 
enum  Mesh2DVariable : unsigned {
  Mesh2DDepth = 1u << 0 ,
  Mesh2DHead = 1u << 1 ,
  Mesh2DVx = 1u << 2 ,
  Mesh2DVy = 1u << 3 ,
  Mesh2DVmag = 1u << 4
}
 Exportable fields, as a bitmask. More...
 

Functions

bool exportMesh2DResults (const Mesh2DExportInputs &inputs, const Mesh2DExportOptions &options, const Mesh2DExportProgress &progress, Mesh2DExportReport *report)
 Run the export described by options against inputs.
 
Mesh2DGridHint mesh2DGridHint (IMesh2DSource *source, double unitFactor)
 Mesh extent and a default pixel size for source, so a dialog can show the resulting raster's dimensions before anything is written.
 
QString mesh2DVariableKey (Mesh2DVariable variable)
 Lower-case single-word name of variable ("depth", "vmag", …), used for file suffixes, layer names and the sidecar's field column.
 
QString mesh2DVariableLabel (Mesh2DVariable variable)
 Human label for variable, e.g. "Water surface elevation".
 
QChar guessDelimiter (const QString &sampleLine)
 Guess the per-row delimiter from a sample line.
 
bool tryParseTimestamp (const QString &s, double &jOut, double fallbackBase)
 Try to parse s as a timestamp into a SWMM Julian date.
 
bool parseRow (const QString &line, QChar delim, double &timeJulianOut, std::vector< double > &valuesOut, double hoursSinceStartFallbackBase)
 Parse one delimited row into a timestamp + N value cells.
 
bool parseSwmmDatLine (const QString &line, SwmmDatState &state, double &timeJulianOut, double &valueOut)
 Parse one line of a SWMM .dat timeseries file.
 

Variables

constexpr float kMesh2DNoData = -9999.0f
 NoData written into every raster band (dry / outside the mesh).
 
constexpr unsigned kMesh2DMaxVariables = Mesh2DDepth | Mesh2DHead | Mesh2DVmag
 Maximum fields exist only for these variables (see Mesh2DExportOptions::includeMax). A signed component's maximum is not a meaningful envelope.
 

Typedef Documentation

◆ Mesh2DExportProgress

using openswmmvis::io::Mesh2DExportProgress = typedef std::function<bool(int done, int total, const QString &what)>

Progress sink. Return false to cancel — every file written so far is then deleted, so a cancelled export leaves nothing half-written behind.

Enumeration Type Documentation

◆ Mesh2DExportFormat

Output container. Vector formats share one OGR code path.

Enumerator
Shapefile 

one .shp set per variable ("ESRI Shapefile")

GeoPackage 

one .gpkg, one layer per variable ("GPKG")

GeoTiff 

one .tif per variable, one band per step ("GTiff")

◆ Mesh2DInterp

enum class openswmmvis::io::Mesh2DInterp
strong

How cell-centred values are carried to raster pixels.

Enumerator
NaturalNeighbour 

Sibson weights over the cell-centroid Delaunay.

Idw 

Shepard over the k nearest centroids.

GreenGauss 

containing cell + its Green–Gauss gradient (fastest)

◆ Mesh2DVariable

Exportable fields, as a bitmask.

Enumerator
Mesh2DDepth 

overland flow depth

Mesh2DHead 

water-surface elevation

Mesh2DVx 

velocity, x component

Mesh2DVy 

velocity, y component

Mesh2DVmag 

speed |v|

Function Documentation

◆ exportMesh2DResults()

bool openswmmvis::io::exportMesh2DResults ( const Mesh2DExportInputs inputs,
const Mesh2DExportOptions options,
const Mesh2DExportProgress progress,
Mesh2DExportReport report 
)

Run the export described by options against inputs.

Parameters
progressMay be empty; called between units of work.
reportOptional; receives the files written, warnings, and the failure reason.
Returns
true when every requested file was written.
Here is the call graph for this function:

◆ guessDelimiter()

QChar openswmmvis::io::guessDelimiter ( const QString &  sampleLine)

Guess the per-row delimiter from a sample line.

Counts tab / comma / semicolon occurrences in the line; the highest non-zero count wins. Ties favour tab over comma over semicolon. Defaults to comma when nothing matches.

Here is the caller graph for this function:

◆ mesh2DGridHint()

Mesh2DGridHint openswmmvis::io::mesh2DGridHint ( IMesh2DSource source,
double  unitFactor 
)

Mesh extent and a default pixel size for source, so a dialog can show the resulting raster's dimensions before anything is written.

Returns
a default-constructed (invalid) hint when the source has no usable geometry.

◆ mesh2DVariableKey()

QString openswmmvis::io::mesh2DVariableKey ( Mesh2DVariable  variable)

Lower-case single-word name of variable ("depth", "vmag", …), used for file suffixes, layer names and the sidecar's field column.

Here is the caller graph for this function:

◆ mesh2DVariableLabel()

QString openswmmvis::io::mesh2DVariableLabel ( Mesh2DVariable  variable)

Human label for variable, e.g. "Water surface elevation".

Here is the caller graph for this function:

◆ parseRow()

bool openswmmvis::io::parseRow ( const QString &  line,
QChar  delim,
double timeJulianOut,
std::vector< double > &  valuesOut,
double  hoursSinceStartFallbackBase 
)

Parse one delimited row into a timestamp + N value cells.

Parameters
lineThe raw input line (no trailing newline).
delimDelimiter from guessDelimiter().
timeJulianOutOn success, SWMM Julian date for cell 0.
valuesOutFilled with one double per value column; empty / non-numeric cells become NaN.
hoursSinceStartFallbackBaseForwarded to tryParseTimestamp().
Returns
true iff the timestamp parsed. Value cells may be NaN.
Here is the call graph for this function:

◆ parseSwmmDatLine()

bool openswmmvis::io::parseSwmmDatLine ( const QString &  line,
SwmmDatState state,
double timeJulianOut,
double valueOut 
)

Parse one line of a SWMM .dat timeseries file.

Mirrors the engine's table_parseFileLine (legacy/engine/table.c):

  • Whitespace and/or comma separated tokens
  • Lines starting with ; are comments (rejected)
  • Empty lines are rejected
  • 2 tokens → <time> <value> where time is either HH:MM[:SS] or numeric hours; value's date is state.lastDateJulian
  • 3 tokens → <date> <time> <value>; the parsed date replaces state.lastDateJulian for subsequent lines
  • No header / column-name parsing — .dat is data-only by spec
    Parameters
    lineRaw input line (no trailing newline).
    stateIn/out cache of the most recently parsed date.
    timeJulianOutOn success, SWMM Julian date for this row.
    valueOutOn success, the value at this row.
    Returns
    true iff the line yielded a usable (time, value) pair.

◆ tryParseTimestamp()

bool openswmmvis::io::tryParseTimestamp ( const QString &  s,
double jOut,
double  fallbackBase 
)

Try to parse s as a timestamp into a SWMM Julian date.

Parameters
sThe raw cell text (may contain leading/trailing whitespace).
jOutOn success, the SWMM Julian date (days since 1899-12-30).
fallbackBaseWhen all dated formats fail, treat s as a number of hours since this base Julian date. Pass NaN to disable the numeric fallback.
Returns
true on success.
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ kMesh2DMaxVariables

constexpr unsigned openswmmvis::io::kMesh2DMaxVariables = Mesh2DDepth | Mesh2DHead | Mesh2DVmag
constexpr

Maximum fields exist only for these variables (see Mesh2DExportOptions::includeMax). A signed component's maximum is not a meaningful envelope.

◆ kMesh2DNoData

constexpr float openswmmvis::io::kMesh2DNoData = -9999.0f
constexpr

NoData written into every raster band (dry / outside the mesh).