#include <projectserializer.h>
◆ applyFromFile()
| bool ProjectSerializer::applyFromFile |
( |
const QString & |
oswpPath, |
|
|
SWMMVisProjectWindow * |
pw, |
|
|
QString * |
errorOut = nullptr, |
|
|
QStringList * |
warningsOut = nullptr |
|
) |
| |
|
static |
Read a .oswp and apply any state it carries to pw's already-loaded SWMM layer and canvas. Silently skips keys the current build doesn't understand (forward-compat). Returns true if the file was parsed successfully. An absent file is not an error — callers Just-Load the .inp and call this opportunistically. Single-instance overload reads sessions[0]. Referenced files that no longer exist (results .out, GIS rasters/vectors) are skipped and reported via warningsOut so the caller can surface them — the load itself proceeds.
◆ resolveStoredPath()
| QString ProjectSerializer::resolveStoredPath |
( |
const QString & |
stored, |
|
|
const QString & |
oswpFile |
|
) |
| |
|
inlinestatic |
Resolve a path read from a .oswp file: relative paths are resolved against oswpFile's parent directory; absolute paths pass through unchanged (v1–v3 backward compat); empty input returns empty. Inlined alongside toRelativePath.
◆ saveToFile() [1/2]
| bool ProjectSerializer::saveToFile |
( |
const QString & |
oswpPath, |
|
|
SWMMVisProject * |
proj, |
|
|
QString * |
errorOut = nullptr |
|
) |
| |
|
static |
Multi-instance overload (AA-3.4). Iterates proj's instance list and writes one sessions[N] block per window, plus the project-level canvas / basemaps / preferences blocks.
◆ saveToFile() [2/2]
| bool ProjectSerializer::saveToFile |
( |
const QString & |
oswpPath, |
|
|
SWMMVisProjectWindow * |
pw, |
|
|
QString * |
errorOut = nullptr |
|
) |
| |
|
static |
Write a .oswp sidecar describing pw's current GUI state. Single-instance convenience overload: synthesises a one-entry sessions[] array. Returns true on success; writes an error string on failure.
◆ sidecarPathFor()
| QString ProjectSerializer::sidecarPathFor |
( |
const QString & |
inpPath | ) |
|
|
inlinestatic |
Canonical sidecar path: same directory + basename as the given .inp, with the extension swapped to .oswp. Empty input returns empty. Inlined alongside toRelativePath / resolveStoredPath (Slice RB.5) so unit tests can exercise it without linking the full ProjectSerializer .cpp.
◆ toRelativePath()
| QString ProjectSerializer::toRelativePath |
( |
const QString & |
path, |
|
|
const QString & |
oswpFile |
|
) |
| |
|
inlinestatic |
Convert path to a path relative to the directory containing oswpFile. Returns the cleaned absolute path unchanged when the two are on different volumes (cross-drive on Windows) or when path is already empty. Uses QDir::relativeFilePath — does not resolve symlinks, to preserve the user's symlink intent across save/load. Inlined so unit tests can exercise it without linking the full ProjectSerializer .cpp (which pulls in MapCanvas etc.).
◆ kCurrentSchemaVersion
| constexpr int ProjectSerializer::kCurrentSchemaVersion = 5 |
|
staticconstexpr |
Current writer version.
Schema 5 (2026-09-07) added the "feature" gisLayers type — an editable, GeoPackage-backed FeatureLayer carrying role / zPolicy / symbol alongside the path-shaped record the other two types use. Readers of schema 4 dispatch only on "raster" / "vector" and fall through silently on an unknown type, so older builds degrade by skipping feature layers rather than failing to open the project.
The documentation for this class was generated from the following files: