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
extensionmodelaccess.cpp File Reference

Project/model facades, native transactions and spatial preview adapters. More...

#include "plugins/extensionmodelaccess.h"
#include "plugins/extensionattributes.h"
#include "plugins/extensionstateregistry.h"
#include "plugins/extensionviewaccess.h"
#include <QScopeGuard>
#include "render/renderers/graduatedrenderer.h"
#include "swmmvisprojectwindow.h"
#include "map/mapcanvas.h"
#include "map/spatialreferencesystem.h"
#include "map/openswmmvisscene.h"
#include "layers/gisvectorlayer.h"
#include "layers/featurelayer.h"
#include "layers/gisrasterlayer.h"
#include "layers/swmmresultslayer.h"
#include "layers/swmm2dresultslayer.h"
#include "project/projectserializer.h"
#include "project/projectsaveoutputs.h"
#include "map/mapundostack.h"
#include "map/importcommands.h"
#include "ui/properties/swmmsubcatchpropertyadapter.h"
#include "core/swmmdatetime.h"
#include "selection/selectionmanager.h"
#include <openswmm/engine/openswmm_model.h>
#include <ogr_spatialref.h>
#include <ogrsf_frmts.h>
#include <cpl_vsi.h>
#include <QDir>
#include <QRegularExpression>
#include <QFileInfo>
#include <QJsonDocument>
#include <QJsonArray>
#include <QSaveFile>
#include <QGraphicsItemGroup>
#include <QGraphicsPathItem>
#include <QGraphicsEllipseItem>
#include <QGraphicsSimpleTextItem>
#include <QPainterPath>
#include <QPen>
#include <QMetaProperty>
#include <QStandardPaths>
#include <QTimer>
#include <QThread>
#include <cmath>
#include <memory>
#include <map>
#include <utility>
#include <cstring>
Include dependency graph for extensionmodelaccess.cpp:

Namespaces

namespace  openswmmvis
 

Functions

std::unique_ptr< OpenSWMM::Sdk::IEditScope > openswmmvis::beginTimeSeriesModelEdit (SWMMVisProjectWindow *window, const QString &label, QString *error=nullptr)
 Begin a checked native time-series assignment transaction.
 
void openswmmvis::installExtensionModelAccess (GuiExtensionHost *host, std::function< QList< SWMMVisProjectWindow * >()> windows, std::function< SWMMVisProjectWindow *()> active)
 Install QPointer-backed SDK model facades owned by the extension host.
 

Detailed Description

Project/model facades, native transactions and spatial preview adapters.

ModelAccess retains guarded model/project facades for the extension lifetime. Closed windows leave inert facades, so previously returned interface addresses remain safe to query. Each facade scopes project state to its owning extension.

Native and mediated edit scopes share per-window leases with normal simulations. Before/after snapshots use ProjectSaveOutputs staging, constrain companion writes to a dedicated recovery directory, and temporarily request inline mesh serialization. Commit rebuilds the GUI mirror and pushes one snapshot command; abort reopens the before snapshot. Snapshot replay opens a replacement engine successfully before releasing the current one. Files remain reviewable under the project or the user-data directory.

Spatial services use explicit traditional GIS axis order. Viewport edges are sampled before transformation. Loaded-layer boundaries preserve polygon holes and multipart structure; transient preview items are transformed to the canvas CRS and never become persistent layers. Layer/filter/selection notifications let consumers discard stale catalogue previews. All facade and engine operations are confined to the GUI thread.

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

Variable Documentation

◆ active

std::function<SWMMVisProjectWindow *()> active

◆ model

ModelFacade* model = nullptr

◆ windows

std::function<QList<SWMMVisProjectWindow *>()> windows