![]() |
SWMMVis
6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
|
Abstract base class for all layers displayed in the MapCanvas. More...
#include <openswmmvislayer.h>
Public Types | |
| enum | OpenSWMMVisLayerType { SWMMDefaultLayer = 0 , SWMMModelLayer = 1 , SWMMResultsLayer = 2 , SWMMGISLayer = 3 , SWMMVectorLayer = 4 , SWMMRasterLayer = 5 , SWMMImageryLayer = 6 , SWMMTabularDataLayer = 7 , SWMMTabularyTimeSeriesLayer = 8 , SWMMSubProjectLayer = 9 , SWMMWMSLayer = 10 , SWMMWMTSLayer = 11 , SWMM2DMeshLayer = 12 , SWMM2DResultsLayer = 13 , SWMMAnnotationLayer = 14 , SWMMFeatureLayer = 15 } |
| Discriminator for the concrete layer class. More... | |
Signals | |
| void | nameChanged (const QString &newName) |
| void | layerTypeChanged (OpenSWMMVisLayerType newType) |
| void | visibilityChanged (bool visible) |
| void | opacityChanged (double opacity) |
| void | srsChanged (SpatialReferenceSystem *newSRS) |
| void | extentChanged (const MapExtent &newExtent) |
| void | childrenChanged () |
| void | repaintRequested () |
| void | temporalSpecChanged (const OpenSWMM::Render::TemporalSpec &spec) |
| void | maskSpecChanged (const OpenSWMM::Render::MaskSpec &spec) |
| void | auxStorageSpecChanged (const OpenSWMM::Render::AuxiliaryStorageSpec &spec) |
| void | joinsChanged (const QVector< OpenSWMM::Render::JoinSpec > &joins) |
| void | diagramSpecChanged (const OpenSWMM::Render::DiagramSpec &spec) |
| void | labelConfigChanged () |
Public Member Functions | |
| OpenSWMMVisLayer (OpenSWMMVisWorkspace *parent) | |
| OpenSWMMVisLayer (const QString &name="Unlabeled Layer", OpenSWMMVisWorkspace *parent=nullptr) | |
| virtual | ~OpenSWMMVisLayer () |
| QString | layerId () const |
| Returns the layer's immutable unique identifier (UUID). | |
| QString | name () const |
| Returns the user-visible name of this layer. | |
| void | setName (const QString &name) |
| Sets the user-visible name. | |
| OpenSWMMVisLayerType | layerType () const |
| Returns the layer type discriminator. | |
| bool | isVisible () const |
| Returns true when this layer should be drawn. | |
| void | setVisible (bool visible) |
| Shows or hides this layer. | |
| double | opacity () const |
| Returns the layer opacity in the range [0.0, 1.0]. 0.0 = fully transparent; 1.0 = fully opaque. | |
| void | setOpacity (double opacity) |
| Sets the layer opacity. Values are clamped to [0.0, 1.0]. | |
| SpatialReferenceSystem * | srs () const |
| Returns the spatial reference system for this layer, or nullptr if the layer has no known CRS. | |
| void | setSRS (SpatialReferenceSystem *srs, bool ownsSRS=false) |
| Sets (or replaces) the CRS for this layer. | |
| QString | crsDescription () const |
| Returns a human-readable summary of this layer's CRS for display in the Properties window. | |
| MapExtent | extent () const |
| Returns the layer extent in the layer's own CRS. | |
| void | setExtent (const MapExtent &extent) |
| Sets the layer spatial extent (in the layer's CRS). | |
| virtual QString | sourceDescription () const |
| Human-readable source of this layer: a file path, a service URL, or a description for in-memory / derived layers. | |
| virtual QVector< QPair< QString, QString > > | extendedMetadata () const |
| Ordered key→value pairs of TYPE-SPECIFIC metadata, rendered by the Metadata tab below the common block the dialog builds itself. | |
| virtual bool | isRasterLayer () const |
| Returns true for layers that render into a raster buffer (WMS, WMTS, GISRaster) rather than populating QGraphicsItems. | |
| virtual bool | isBasemapLayer () const |
| Returns true for world-spanning basemap layers (XYZ tile providers, WMS/WMTS services covering the whole world) that should NOT be included when computing the data-driven full extent. | |
| virtual void | render (QPainter *painter, const MapExtent &extent, const QSize &imageSize, const SpatialReferenceSystem *srs) |
Renders this layer's content directly into painter. | |
| virtual void | fetchCache (const MapExtent &extent, const QSize &viewportSize, const SpatialReferenceSystem *srs) |
| Triggers any asynchronous (or synchronous) tile/data fetch needed to populate this layer's internal cache for the given view state. | |
| void | setViewportSize (int w, int h) |
| Called by MapCanvas before refreshScene so layers can request the correct pixel dimensions for tile/image requests. | |
| int | viewportWidth () const |
| int | viewportHeight () const |
| QVector< OpenSWMMVisLayer * > | children () const |
| Returns the ordered list of child layers. | |
| virtual void | populateScene (QGraphicsScene *scene, const MapExtent &canvasExtent, const SpatialReferenceSystem *canvasSRS)=0 |
| Creates / updates QGraphicsItems representing this layer in the scene. | |
| virtual void | depopulateScene (QGraphicsScene *scene) |
| Removes all QGraphicsItems belonging to this layer from the scene. | |
| virtual void | refreshScene (QGraphicsScene *scene, const MapExtent &canvasExtent, const SpatialReferenceSystem *canvasSRS) |
| Smart scene refresh — updates existing items instead of destroying and recreating. | |
| double | layerZValue () const |
| Returns the z-value base assigned to this layer by the canvas. Items within the layer should use z-values relative to this. | |
| virtual std::vector< std::unique_ptr< openswmmvis::ui::ILayerStyleSubject > > | styleSubjects () |
| Slice U-2 — return the styleable subjects for the unified LayerStyleDialog. | |
| void | setLayerZValue (double z) |
| Called by the canvas to set this layer's z-value band. | |
| virtual void | onCanvasCRSChanged (const SpatialReferenceSystem *newCanvasSRS) |
| Called when the user changes the canvas CRS so layers can pre-compute any CRS-dependent transform caches. | |
| virtual OpenSWMM::Render::IFeatureRenderer * | renderer () const |
| virtual void | setRenderer (std::unique_ptr< OpenSWMM::Render::IFeatureRenderer >) |
| virtual OpenSWMM::Render::RuleList * | ruleList () |
| virtual const OpenSWMM::Render::RuleList * | ruleList () const |
| const OpenSWMM::Render::TemporalSpec & | temporalSpec () const |
| void | setTemporalSpec (const OpenSWMM::Render::TemporalSpec &spec) |
| const OpenSWMM::Render::LabelConfig & | labelConfig () const |
| virtual void | setLabelConfig (const OpenSWMM::Render::LabelConfig &cfg) |
| const OpenSWMM::Render::MaskSpec & | maskSpec () const |
| void | setMaskSpec (const OpenSWMM::Render::MaskSpec &spec) |
| const OpenSWMM::Render::AuxiliaryStorageSpec & | auxStorageSpec () const |
| void | setAuxStorageSpec (const OpenSWMM::Render::AuxiliaryStorageSpec &spec) |
| const QVector< OpenSWMM::Render::JoinSpec > & | joins () const |
| void | setJoins (const QVector< OpenSWMM::Render::JoinSpec > &joins) |
| const OpenSWMM::Render::DiagramSpec & | diagramSpec () const |
| void | setDiagramSpec (const OpenSWMM::Render::DiagramSpec &spec) |
| OpenSWMMVisWorkspace * | workspace () const |
| void | setBasicAuth (const QString &username, const QString &password) |
| Sets HTTP Basic authentication for all subsequent network requests. | |
| void | setHttpHeaders (const BasemapHttpHeaders &headers) |
| Sets arbitrary extra HTTP headers applied to every request. | |
| BasemapHttpHeaders | httpHeaders () const |
Protected Member Functions | |
| bool | addChild (OpenSWMMVisLayer *child) |
| bool | removeChild (OpenSWMMVisLayer *child) |
| void | setLayerType (OpenSWMMVisLayerType type) |
Protected Attributes | |
| QByteArray | m_authHeader |
| "Basic <base64>" or empty | |
| BasemapHttpHeaders | m_httpHeaders |
| arbitrary headers (incl. "referer") | |
Properties | |
| QString | Name |
| bool | Visible |
| double | Opacity |
| QString | LayerId |
| OpenSWMMVisLayerType | LayerType |
| QVector< OpenSWMMVisLayer * > | Children |
| QString | CRS |
Abstract base class for all layers displayed in the MapCanvas.
Every layer has:
Discriminator for the concrete layer class.
|
explicit |
|
explicit |
|
virtual |
|
protected |
|
inline |
|
signal |
Slice Z.15-attach — emitted when the AuxiliaryStorageSpec changes.
| QVector< OpenSWMMVisLayer * > OpenSWMMVisLayer::children | ( | ) | const |
Returns the ordered list of child layers.
|
signal |
| QString OpenSWMMVisLayer::crsDescription | ( | ) | const |
Returns a human-readable summary of this layer's CRS for display in the Properties window.
Format: "AUTH:CODE - description" when an authority code is available (e.g. "EPSG:2926 - NAD83(HARN) / Washington South"), otherwise the description alone or "(none)" if no CRS.
|
virtual |
Removes all QGraphicsItems belonging to this layer from the scene.
Reimplemented in OpenSWMMVisAnnotationLayer, GISRasterLayer, GISVectorLayer, SWMM2DMeshLayer, SWMM2DResultsLayer, SWMMModelLayer, SWMMResultsLayer, WCSLayer, WMSLayer, and WMTSLayer.
|
inline |
|
signal |
Slice Z.12-attach — emitted when the DiagramSpec changes.
|
inlinevirtual |
Ordered key→value pairs of TYPE-SPECIFIC metadata, rendered by the Metadata tab below the common block the dialog builds itself.
Default empty. Subclasses add only what is unique to them (e.g. a mesh: vertices / cells / edges / elevation range). QVector<QPair> preserves insertion order without a new type.
Reimplemented in OpenSWMMVisAnnotationLayer, FeatureLayer, GISRasterLayer, GISVectorLayer, SWMM2DMeshLayer, SWMM2DResultsLayer, SWMMModelLayer, and SWMMResultsLayer.
| MapExtent OpenSWMMVisLayer::extent | ( | ) | const |
Returns the layer extent in the layer's own CRS.
|
signal |
|
virtual |
Triggers any asynchronous (or synchronous) tile/data fetch needed to populate this layer's internal cache for the given view state.
Called by MapCanvas::refreshLayerItems() for every visible raster layer BEFORE the MapRenderJob is started. This decouples tile-requesting (potentially async HTTP) from tile-drawing (synchronous, in the background render thread).
The default implementation is a no-op.
| extent | Visible geographic extent in canvas-CRS coordinates. |
| viewportSize | Pixel dimensions of the viewport. |
| srs | Canvas CRS. |
Reimplemented in XYZTileLayer, GISRasterLayer, WCSLayer, WMSLayer, and WMTSLayer.
|
inline |
|
inlinevirtual |
Returns true for world-spanning basemap layers (XYZ tile providers, WMS/WMTS services covering the whole world) that should NOT be included when computing the data-driven full extent.
MapCanvas::fullExtent() uses this to skip basemap layers so that "Zoom to Full Extent" zooms to the project's data (SWMM network, DTM, bounded WMS coverage) rather than the whole globe. Layers with a specific, bounded geographic footprint (GISRasterLayer, local WMS/WMTS with EX_GeographicBoundingBox) return false so they participate in the extent union.
Reimplemented in GISRasterLayer, WCSLayer, WMTSLayer, and XYZTileLayer.
|
inlinevirtual |
Returns true for layers that render into a raster buffer (WMS, WMTS, GISRaster) rather than populating QGraphicsItems.
The MapCanvas uses this to decide whether a layer participates in the background render job or in the QGraphicsScene overlay.
Reimplemented in GISRasterLayer, WCSLayer, WMSLayer, WMTSLayer, and XYZTileLayer.
| bool OpenSWMMVisLayer::isVisible | ( | ) | const |
Returns true when this layer should be drawn.
|
inline |
|
signal |
Slice Z.16-attach — emitted when the joins list changes (any add / remove / edit). Recipients re-resolve their attribute access through the new list.
|
inline |
|
signal |
VS.10 — emitted whenever the layer's labelConfig() is mutated through setLabelConfig(). Canvas + legend observe this to repaint labels.
| QString OpenSWMMVisLayer::layerId | ( | ) | const |
Returns the layer's immutable unique identifier (UUID).
| OpenSWMMVisLayer::OpenSWMMVisLayerType OpenSWMMVisLayer::layerType | ( | ) | const |
Returns the layer type discriminator.
|
signal |
| double OpenSWMMVisLayer::layerZValue | ( | ) | const |
Returns the z-value base assigned to this layer by the canvas. Items within the layer should use z-values relative to this.
|
inline |
|
signal |
Slice Z.14-attach — emitted when the per-layer MaskSpec changes.
| QString OpenSWMMVisLayer::name | ( | ) | const |
Returns the user-visible name of this layer.
|
signal |
|
virtual |
Called when the user changes the canvas CRS so layers can pre-compute any CRS-dependent transform caches.
| newCanvasSRS | The new canvas CRS. |
Reimplemented in OpenSWMMVisAnnotationLayer, GISRasterLayer, GISVectorLayer, SWMM2DMeshLayer, SWMM2DResultsLayer, SWMMModelLayer, SWMMResultsLayer, WCSLayer, WMSLayer, WMTSLayer, and XYZTileLayer.
| double OpenSWMMVisLayer::opacity | ( | ) | const |
Returns the layer opacity in the range [0.0, 1.0]. 0.0 = fully transparent; 1.0 = fully opaque.
|
signal |
|
pure virtual |
Creates / updates QGraphicsItems representing this layer in the scene.
Derived classes override this to add their items to the scene. Items should be created in scene coordinates (= map CRS coordinates) after reprojecting from the layer's native CRS.
Called by the MapCanvas when:
| scene | The shared OpenSWMMVisScene to add items to. |
| canvasExtent | Visible extent in canvas-CRS coordinates. |
| canvasSRS | The CRS currently used by the MapCanvas. |
Implemented in WCSLayer, XYZTileLayer, OpenSWMMVisAnnotationLayer, GISRasterLayer, GISVectorLayer, SWMM2DMeshLayer, SWMM2DResultsLayer, SWMMModelLayer, SWMMResultsLayer, TabularDataLayer, WMSLayer, WMTSLayer, and OpenSWMMVisSession.
|
virtual |
Smart scene refresh — updates existing items instead of destroying and recreating.
Override in subclasses to provide efficient incremental updates. The default implementation calls depopulateScene() then populateScene(), which is backward-compatible but causes flicker for raster/tile layers.
Raster/WMS layers should override to keep persistent scene items and update them in-place. Vector layers should override to skip rebuilding when only the view extent has changed (items are already in scene coords).
Reimplemented in OpenSWMMVisAnnotationLayer, GISRasterLayer, GISVectorLayer, SWMM2DMeshLayer, SWMM2DResultsLayer, SWMMModelLayer, SWMMResultsLayer, WCSLayer, WMSLayer, and WMTSLayer.
|
protected |
|
virtual |
Renders this layer's content directly into painter.
Called by the background MapRenderJob for raster layers. The painter is backed by a QImage of imageSize pixels spanning the geographic area described by extent in CRS srs. Pixel (0,0) maps to (extent.xMin, extent.yMax).
The default implementation is a no-op. Raster layer subclasses (WMS, WMTS, GISRaster) override this to paint their cached tile/image data without touching QGraphicsScene.
| painter | Target painter (backed by viewport-sized QImage). |
| extent | Visible geographic extent in canvas-CRS coordinates. |
| imageSize | Pixel dimensions of the target image. |
| srs | Canvas CRS. |
Reimplemented in XYZTileLayer, GISRasterLayer, TabularDataLayer, WCSLayer, WMSLayer, and WMTSLayer.
|
inlinevirtual |
Reimplemented in GISVectorLayer, SWMM2DResultsLayer, SWMMResultsLayer, SWMM2DMeshLayer, and SWMMModelLayer.
|
signal |
|
inlinevirtual |
Reimplemented in GISVectorLayer, SWMM2DMeshLayer, SWMM2DResultsLayer, SWMMModelLayer, and SWMMResultsLayer.
|
inlinevirtual |
Reimplemented in GISVectorLayer, SWMM2DMeshLayer, SWMM2DResultsLayer, SWMMModelLayer, and SWMMResultsLayer.
| void OpenSWMMVisLayer::setAuxStorageSpec | ( | const OpenSWMM::Render::AuxiliaryStorageSpec & | spec | ) |
| void OpenSWMMVisLayer::setBasicAuth | ( | const QString & | username, |
| const QString & | password | ||
| ) |
Sets HTTP Basic authentication for all subsequent network requests.
Builds the "Authorization: Basic <base64(user:pass)>" header and stores it in m_authHeader. Call with an empty username to clear.
| void OpenSWMMVisLayer::setDiagramSpec | ( | const OpenSWMM::Render::DiagramSpec & | spec | ) |
| void OpenSWMMVisLayer::setExtent | ( | const MapExtent & | extent | ) |
Sets the layer spatial extent (in the layer's CRS).
| void OpenSWMMVisLayer::setHttpHeaders | ( | const BasemapHttpHeaders & | headers | ) |
Sets arbitrary extra HTTP headers applied to every request.
Includes the "referer" key as the HTTP Referer header.
| void OpenSWMMVisLayer::setJoins | ( | const QVector< OpenSWMM::Render::JoinSpec > & | joins | ) |
|
virtual |
Reimplemented in GISVectorLayer, SWMMModelLayer, and SWMMResultsLayer.
|
protected |
| void OpenSWMMVisLayer::setLayerZValue | ( | double | z | ) |
Called by the canvas to set this layer's z-value band.
| void OpenSWMMVisLayer::setMaskSpec | ( | const OpenSWMM::Render::MaskSpec & | spec | ) |
| void OpenSWMMVisLayer::setName | ( | const QString & | name | ) |
Sets the user-visible name.
| void OpenSWMMVisLayer::setOpacity | ( | double | opacity | ) |
Sets the layer opacity. Values are clamped to [0.0, 1.0].
|
virtual |
Reimplemented in GISVectorLayer, SWMM2DResultsLayer, SWMMResultsLayer, SWMM2DMeshLayer, and SWMMModelLayer.
| void OpenSWMMVisLayer::setSRS | ( | SpatialReferenceSystem * | srs, |
| bool | ownsSRS = false |
||
| ) |
Sets (or replaces) the CRS for this layer.
Transfers ownership of srs to this layer if ownsSRS is true.
| void OpenSWMMVisLayer::setTemporalSpec | ( | const OpenSWMM::Render::TemporalSpec & | spec | ) |
|
inline |
Called by MapCanvas before refreshScene so layers can request the correct pixel dimensions for tile/image requests.
| void OpenSWMMVisLayer::setVisible | ( | bool | visible | ) |
Shows or hides this layer.
|
inlinevirtual |
Human-readable source of this layer: a file path, a service URL, or a description for in-memory / derived layers.
Default empty — the dialog shows "(none)". Concrete layers override to return their real origin (e.g. modelFilePath(), resultsFilePath(), serviceUrl(), or "(generated mesh)").
Reimplemented in OpenSWMMVisAnnotationLayer, FeatureLayer, GISRasterLayer, GISVectorLayer, SWMM2DMeshLayer, SWMM2DResultsLayer, SWMMModelLayer, SWMMResultsLayer, TabularDataLayer, WCSLayer, WFSLayer, WMSLayer, WMTSLayer, and XYZTileLayer.
| SpatialReferenceSystem * OpenSWMMVisLayer::srs | ( | ) | const |
Returns the spatial reference system for this layer, or nullptr if the layer has no known CRS.
|
signal |
|
virtual |
Slice U-2 — return the styleable subjects for the unified LayerStyleDialog.
Each returned subject becomes one tab (or sub-tab inside a section) in the dialog. The dialog calls this once when it opens and owns the returned unique_ptrs.
Default implementation returns an empty list (which still yields a usable dialog — General/Rendering/Metadata tabs are built-in). Layers override to surface their style bags.
Reimplemented in GISRasterLayer, GISVectorLayer, SWMM2DMeshLayer, SWMM2DResultsLayer, SWMMModelLayer, and SWMMResultsLayer.
|
inline |
|
signal |
Slice Z.13-attach — emitted when the per-layer TemporalSpec is replaced (any field different from the previous spec). The AnimationController observes this to retune its tick scheduling in Z.13-controller.
|
inline |
|
inline |
|
signal |
|
inline |
|
protected |
"Basic <base64>" or empty
|
protected |
arbitrary headers (incl. "referer")
|
read |
|
read |
|
read |
|
read |
|
readwrite |
|
readwrite |
|
readwrite |