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
IViewEvents.hpp
Go to the documentation of this file.
1
12#pragma once
13#include "ISessionEvents.hpp"
14#include <QDateTime>
15#include <QStringList>
16
18#define OPENSWMM_VIEW_EVENTS_IID "io.opensimulator.openswmm.IEventSource/3.0"
19
20namespace OpenSWMM::Sdk
21{
47
62
64enum class ResultAvailability : quint32 {
65 Empty = 0,
66 Loading = 1,
67 Ready = 2,
68 Failed = 3
69};
70
73 QString channelId;
74 QString variableKey;
75 QString units;
76};
77
81 QString layerId;
82 quint64 sourceGeneration = 0;
83 QString dimension;
84 QString path;
86 QString error;
87 bool active = false;
88 bool live = false;
89 qint64 periodCount = 0;
90 qint64 currentIndex = -1;
91 QDateTime currentDateTime;
92 QList<ResultVariableState> variables;
93};
94
99 quint64 sequence = 0;
101 QList<LayerViewState> layers;
102 QList<ResultsViewState> results;
103 QString projectUnits;
104 qint64 selectedObjects = 0;
105};
106
127
130 QList<ViewEventKind> kinds;
131 QUuid sessionId;
136 bool accepts(const ViewEvent &event) const
137 {
138 return (kinds.isEmpty() || kinds.contains(event.kind)) &&
139 (sessionId.isNull() || sessionId == event.session.sessionId) &&
140 (layerSessionId.isNull() || layerSessionId == event.layerSessionId);
141 }
142};
143
146{
147public:
149 virtual ~IViewEvents() = default;
153 virtual ViewSnapshot viewSnapshot(const QUuid &sessionId) const = 0;
162 virtual QMetaObject::Connection
163 observeViews(QObject *context, const ViewEventFilter &filter,
164 std::function<void(const ViewEvent &)> callback) = 0;
165};
166}
168Q_DECLARE_METATYPE(OpenSWMM::Sdk::ViewEvent)
169Q_DECLARE_METATYPE(OpenSWMM::Sdk::ViewSnapshot)
170Q_DECLARE_METATYPE(OpenSWMM::Sdk::ViewEventKind)
Authoritative model-session lifecycle, revision snapshots and project-save observations.
#define OPENSWMM_VIEW_EVENTS_IID
Frozen discovery identity for SDK 1.4 model/layer/results observations.
Definition IViewEvents.hpp:18
Frozen optional GUI-thread view metadata and deferred domain observation service.
Definition IViewEvents.hpp:146
virtual ~IViewEvents()=default
Destroy an implementation; consumers borrow the host-owned capability.
virtual QMetaObject::Connection observeViews(QObject *context, const ViewEventFilter &filter, std::function< void(const ViewEvent &)> callback)=0
Observe future queued invalidations on the GUI thread.
virtual ViewSnapshot viewSnapshot(const QUuid &sessionId) const =0
Copy one session's current tracked view state, without side effects.
QPointer< QObject > context
Required provider lifetime guard.
Definition extensionattributes.cpp:31
Public header-only ABI for independently compiled native GUI extensions.
Definition ExtensionHost.hpp:24
@ Failed
Settled with an explicit worker/preparation error.
ViewEventKind
Stable invalidation reasons, without geometry, selection or result arrays.
Definition IViewEvents.hpp:23
@ ModelGeometryChanged
Geometry/topology may have changed; rebuilds are broad.
@ LayerRemoved
Historical detach; the attachment no longer resolves.
@ LayerFilterChanged
The applied vector attribute filter changed.
@ LayerCrsChanged
Layer coordinate-reference metadata changed.
@ ResultsTimeChanged
Published/displayed cursor changed, not merely a frame request.
@ LayerAdded
A new runtime attachment is present in the layer snapshot.
@ LayerStyleChanged
Authored renderer/style configuration changed.
@ LayerSchemaChanged
Feature field descriptors changed.
@ LayerSelectionChanged
A vector layer's selected feature identities changed.
@ LayerSourceChanged
Layer source metadata/loading state changed.
@ ResultsSourceChanged
Attached reader/source epoch, availability or count changed.
@ ProjectUnitsChanged
Project display units changed; file-native units are separate.
@ LayerFeaturesChanged
Feature content/geometry changed; query the source again.
@ LayerMetadataChanged
Name, visibility, opacity or layer discriminator changed.
@ ObjectRenamed
Exact native namespace and old/new name where available.
@ AttributeValuesChanged
Native/computed values need to be queried again.
@ AttributeSchemaChanged
Computed/native field descriptors need to be queried again.
@ ModelOptionsChanged
Accepted native option keys, or empty for broad invalidation.
@ ModelSelectionChanged
Canonical shared authored-model selection changed.
@ ResultsVariableChanged
Selected result variable/channel changed.
@ LayerOrderChanged
Top-level or sublayer ordering changed.
@ ResultsActiveChanged
Session-wide active 1D/2D choice changed, including detachment.
ResultAvailability
Metadata availability of the currently attached results source.
Definition IViewEvents.hpp:64
@ Empty
No adopted reader/source.
@ Loading
A particular load generation is being prepared/restored.
@ Ready
Native readiness barrier completed for the current generation.
Copied metadata for one unambiguous current canvas attachment.
Definition IViewEvents.hpp:49
QString crsWkt
Layer CRS, possibly empty.
Definition IViewEvents.hpp:54
qint64 selectionCount
Selected FID count; identities use a paged query.
Definition IViewEvents.hpp:60
qint64 featureCount
Available source count, or -1 for non-vector/unknown.
Definition IViewEvents.hpp:59
QString layerId
Native persisted ID; it may change on restore or repeat across layers.
Definition IViewEvents.hpp:51
QString title
Current display name.
Definition IViewEvents.hpp:52
double opacity
Local opacity in [0,1].
Definition IViewEvents.hpp:56
QUuid layerSessionId
Runtime attachment UUID, replaced after detach/reattach.
Definition IViewEvents.hpp:50
QString type
Native type caption; use capability flags for commands.
Definition IViewEvents.hpp:53
bool vector
The attachment supports feature selection and filtering.
Definition IViewEvents.hpp:57
QString filter
Current applied vector attribute filter, empty without one.
Definition IViewEvents.hpp:58
bool visible
Local layer visibility.
Definition IViewEvents.hpp:55
Owning metadata for one open lifetime, distinct from its persistent project identity.
Definition ISessionEvents.hpp:56
One current rendering channel's selected variable and native unit metadata.
Definition IViewEvents.hpp:72
QString units
Source/descriptor units, possibly empty; never inferred from project units.
Definition IViewEvents.hpp:75
QString channelId
Empty for the 1D variable; semantic sublayer ID for 2D channels.
Definition IViewEvents.hpp:73
QString variableKey
Stable native variable key, not a translated label.
Definition IViewEvents.hpp:74
Copied state of an attached results layer, separate from run-attempt telemetry.
Definition IViewEvents.hpp:79
QString error
Latest preparation error; a failure can leave an older reader usable.
Definition IViewEvents.hpp:86
QString layerId
Native persisted layer ID.
Definition IViewEvents.hpp:81
qint64 periodCount
Published source period count.
Definition IViewEvents.hpp:89
QString path
Adopted reader/source path when known.
Definition IViewEvents.hpp:84
QString dimension
"1d" or "2d".
Definition IViewEvents.hpp:83
QUuid layerSessionId
Owning canvas attachment identity, matching LayerViewState.
Definition IViewEvents.hpp:80
QList< ResultVariableState > variables
Current semantic rendering channels.
Definition IViewEvents.hpp:92
bool active
This session's active source in its dimension.
Definition IViewEvents.hpp:87
qint64 currentIndex
Displayed frame index, or -1 with no adopted frame.
Definition IViewEvents.hpp:90
quint64 sourceGeneration
Monotonic replacement/open/close epoch within this layer.
Definition IViewEvents.hpp:82
QDateTime currentDateTime
Displayed frame time, invalid when unavailable.
Definition IViewEvents.hpp:91
bool live
Source is still receiving periods; false after native finalization.
Definition IViewEvents.hpp:88
ResultAvailability availability
Current source state.
Definition IViewEvents.hpp:85
Registration-time reason, session and runtime-attachment selection.
Definition IViewEvents.hpp:129
bool accepts(const ViewEvent &event) const
Match a copied observation without consulting native state.
Definition IViewEvents.hpp:136
QList< ViewEventKind > kinds
Empty accepts every IViewEvents reason.
Definition IViewEvents.hpp:130
QUuid layerSessionId
Null accepts all attachments and session-wide changes.
Definition IViewEvents.hpp:132
QUuid sessionId
Null accepts all model sessions.
Definition IViewEvents.hpp:131
Owning deferred observation identifying state to query again.
Definition IViewEvents.hpp:113
ModelSessionState session
Copied open-lifetime/revision metadata.
Definition IViewEvents.hpp:116
QString objectNamespace
"node", "link", "subcatchment" or "gage", when known.
Definition IViewEvents.hpp:120
quint64 sourceGeneration
Affected result epoch, zero for other domains.
Definition IViewEvents.hpp:119
QString objectName
Exact current object name when supplied by the native operation.
Definition IViewEvents.hpp:122
ViewEventKind kind
Invalidation reason.
Definition IViewEvents.hpp:114
QUuid origin
Caller token for synchronous view-command effects; null for native/async work.
Definition IViewEvents.hpp:125
QUuid layerSessionId
Affected attachment, null for session-wide changes.
Definition IViewEvents.hpp:117
QString layerId
Copied native ID, which alone is not an unambiguous command target.
Definition IViewEvents.hpp:118
QString previousName
Exact prior name only for a precise native rename.
Definition IViewEvents.hpp:121
quint64 sequence
Shared session/view registry publication sequence.
Definition IViewEvents.hpp:115
QStringList keys
Bounded option keys or channel IDs; empty means broad invalidation.
Definition IViewEvents.hpp:123
Pure copied current metadata at the shared registry watermark.
Definition IViewEvents.hpp:98
QString projectUnits
Project display-unit key, separate from native result units.
Definition IViewEvents.hpp:103
qint64 selectedObjects
Count in canonical cross-view selection, including nonspatial refs.
Definition IViewEvents.hpp:104
QList< LayerViewState > layers
Current attachments in native bottom-to-top order.
Definition IViewEvents.hpp:101
ModelSessionState session
Null sessionId means unknown/retired session.
Definition IViewEvents.hpp:100
quint64 sequence
Same application registry watermark as session snapshots.
Definition IViewEvents.hpp:99
QList< ResultsViewState > results
Attached result sources, including unavailable sources.
Definition IViewEvents.hpp:102