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
OpenSWMMVisWorkspace Class Reference

Top-level project container managing sessions, the SWMM model layer, and persistence paths for one SWMMVis project. More...

#include <openswmmvisworkspace.h>

Inheritance diagram for OpenSWMMVisWorkspace:
Collaboration diagram for OpenSWMMVisWorkspace:

Signals

void layerChanged ()
 
void projectFilePathChanged ()
 
void projectTileChanged ()
 

Public Member Functions

 OpenSWMMVisWorkspace (QObject *parent=nullptr)
 OpenSWMMVisWorkspace constructor with parent object as parameter (default is nullptr)
 
 OpenSWMMVisWorkspace (const QString &projectFilepath="", QObject *parent=nullptr)
 OpenSWMMVisWorkspace constructor with project file path and parent object as parameters.
 
virtual ~OpenSWMMVisWorkspace ()
 
QString projectPath () const
 projectPath getter method
 
QString title () const
 projectName getter method
 
QString swmmProjectPath () const
 Get the path to the SWMM project file.
 
SWMMModelLayerswmmModelLayer () const
 Returns the SWMM model layer bound to this project.
 
bool setSWMMModelLayer (SWMMModelLayer *modelLayer, QList< QString > &warnings, QList< QString > &errors)
 Binds a SWMM model layer to the project.
 
QVector< OpenSWMMVisSession * > layers () const
 layers getter method
 
bool saveProject (const QString &filepath, QList< QString > &warnings, QList< QString > &errors)
 Saves the workspace project to the given file path.
 
bool saveSWMMProject (const QString &filepath, QList< QString > &warnings, QList< QString > &errors)
 Saves the SWMM model file companion (.inp) to the given path.
 
bool openSWMMModel (const QString &filepath, QList< QString > &warnings, QList< QString > &errors)
 Opens a SWMM input file and loads the model into this workspace.
 
bool hasChanges () const
 Returns true when the workspace has unsaved changes.
 

Static Public Member Functions

static OpenSWMMVisWorkspacenewInstance (const QString &projectFilepath="", QObject *parent=nullptr)
 Factory: create and optionally initialise a workspace from a project file path.
 

Properties

QString ProjectFilePath
 
QString Title
 

Detailed Description

Top-level project container managing sessions, the SWMM model layer, and persistence paths for one SWMMVis project.

The workspace is the owner of:

  • The project file path (.oswp or a path to an .inp).
  • The (optional) separate SWMM input file path when an .oswp sidecar is used.
  • The list of open sessions (one per MDI sub-window).
  • The single SWMMModelLayer that is bound to the project.

Use newInstance() to create a workspace; the constructor alone does not open any files.

Constructor & Destructor Documentation

◆ OpenSWMMVisWorkspace() [1/2]

OpenSWMMVisWorkspace::OpenSWMMVisWorkspace ( QObject *  parent = nullptr)

OpenSWMMVisWorkspace constructor with parent object as parameter (default is nullptr)

Parameters
parentQObject parent object
Returns
OpenSWMMVisWorkspace object with parent as parent object

◆ OpenSWMMVisWorkspace() [2/2]

OpenSWMMVisWorkspace::OpenSWMMVisWorkspace ( const QString &  projectFilepath = "",
QObject *  parent = nullptr 
)

OpenSWMMVisWorkspace constructor with project file path and parent object as parameters.

Parameters
projectFilepathQString project file path
parentQObject parent object
Returns
OpenSWMMVisWorkspace object with project file path and parent as parent object

◆ ~OpenSWMMVisWorkspace()

OpenSWMMVisWorkspace::~OpenSWMMVisWorkspace ( )
virtual

Member Function Documentation

◆ hasChanges()

bool OpenSWMMVisWorkspace::hasChanges ( ) const

Returns true when the workspace has unsaved changes.

The flag is set whenever the model layer is mutated and cleared after a successful save.

◆ layerChanged

void OpenSWMMVisWorkspace::layerChanged ( )
signal
Here is the caller graph for this function:

◆ layers()

QVector< OpenSWMMVisSession * > OpenSWMMVisWorkspace::layers ( ) const

layers getter method

Returns
QVector<OpenSWMMVisLayer*> vector of OpenSWMMVisLayer pointers
See also
layer
addLayer
removeLayer
layer

◆ newInstance()

OpenSWMMVisWorkspace * OpenSWMMVisWorkspace::newInstance ( const QString &  projectFilepath = "",
QObject *  parent = nullptr 
)
static

Factory: create and optionally initialise a workspace from a project file path.

If projectFilepath is non-empty the two-phase initialisation is run immediately so the returned workspace is ready for use.

Parameters
projectFilepathPath to an .oswp or .inp file, or empty for a new untitled project.
parentQt parent object.
Returns
Newly allocated workspace; ownership passes to the caller.

◆ openSWMMModel()

bool OpenSWMMVisWorkspace::openSWMMModel ( const QString &  filepath,
QList< QString > &  warnings,
QList< QString > &  errors 
)

Opens a SWMM input file and loads the model into this workspace.

Parameters
filepathAbsolute path to the .inp file.
warningsPopulated with non-fatal parser warnings.
errorsPopulated with error messages on failure.
Returns
true on success; false if the file could not be opened or parsed.

◆ projectFilePathChanged

void OpenSWMMVisWorkspace::projectFilePathChanged ( )
signal

◆ projectPath()

QString OpenSWMMVisWorkspace::projectPath ( ) const

projectPath getter method

Returns
QString project file path

◆ projectTileChanged

void OpenSWMMVisWorkspace::projectTileChanged ( )
signal

◆ saveProject()

bool OpenSWMMVisWorkspace::saveProject ( const QString &  filepath,
QList< QString > &  warnings,
QList< QString > &  errors 
)

Saves the workspace project to the given file path.

Parameters
filepathDestination path (.oswp or .inp).
warningsPopulated with non-fatal save warnings.
errorsPopulated with error messages on failure.
Returns
true on success; false otherwise.
Note
Currently unimplemented at the workspace level; per-window save is handled by SWMMVisProjectWindow::saveAs(). Calls log a warning and append an error explaining the limitation.

◆ saveSWMMProject()

bool OpenSWMMVisWorkspace::saveSWMMProject ( const QString &  filepath,
QList< QString > &  warnings,
QList< QString > &  errors 
)

Saves the SWMM model file companion (.inp) to the given path.

Parameters
filepathDestination .inp path.
warningsPopulated with non-fatal save warnings.
errorsPopulated with error messages on failure.
Returns
true on success; false otherwise.
Note
Currently unimplemented; see saveProject() for the same routing contract.

◆ setSWMMModelLayer()

bool OpenSWMMVisWorkspace::setSWMMModelLayer ( SWMMModelLayer modelLayer,
QList< QString > &  warnings,
QList< QString > &  errors 
)

Binds a SWMM model layer to the project.

Exactly one model layer can be bound to each project.

Here is the call graph for this function:

◆ swmmModelLayer()

SWMMModelLayer * OpenSWMMVisWorkspace::swmmModelLayer ( ) const

Returns the SWMM model layer bound to this project.

◆ swmmProjectPath()

QString OpenSWMMVisWorkspace::swmmProjectPath ( ) const

Get the path to the SWMM project file.

See also
projectName

◆ title()

QString OpenSWMMVisWorkspace::title ( ) const

projectName getter method

Returns
QString project name
See also
setProjectName

Property Documentation

◆ ProjectFilePath

QString OpenSWMMVisWorkspace::ProjectFilePath
read

◆ Title

QString OpenSWMMVisWorkspace::Title
read

The documentation for this class was generated from the following files: