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

A vector layer whose features came from a web feature service. More...

#include <wfslayer.h>

Inheritance diagram for WFSLayer:
Collaboration diagram for WFSLayer:

Public Member Functions

 WFSLayer (const QString &name, OpenSWMMVisWorkspace *parent=nullptr)
 Constructs an empty layer; adopt a response to fill it.
 
 ~WFSLayer () override
 
bool adoptResponse (const QByteArray &body, QString &message)
 Takes a GetFeature response and opens it as this layer's data.
 
QString serviceUrl () const
 The service this came from, for the layer's properties.
 
void setServiceUrl (const QString &url)
 
QString typeName () const
 The collection, as the service names it.
 
void setTypeName (const QString &typeName)
 
QString sourceDescription () const override
 Where this layer's data came from.
 
- Public Member Functions inherited from GISVectorLayer
 GISVectorLayer (const QString &filePath, const QString &layerName={}, OpenSWMMVisWorkspace *parent=nullptr)
 
 ~GISVectorLayer () override
 
void openAsync (const QString &filePath, const QString &layerName={})
 Asynchronously open filePath / layerName. GDALOpenEx + GetExtent (which forces a scan on some drivers) run on a worker thread; the layer is populated on the GUI thread and openFinished(bool) fires on completion. Construct with an empty path first; the synchronous openDataset path (tests / project restore) is unchanged.
 
QString filePath () const
 Returns the file path to the OGR dataset.
 
QString ogrLayerName () const
 Returns the OGR sub-layer name opened within the dataset.
 
class OGRLayer * ogrLayer () const
 Read-only OGRLayer handle for callers that need to walk features directly (e.g. mesh-generator constraint pulls). Returns nullptr if the dataset is not open.
 
void appendScenePolygonsTo (QPainterPath &out) const
 Slice Z.14-paint — append every polygon ring this layer currently exposes (post-attribute-filter) to out in canvas-scene coords (Y-flipped, same space the canvas QGraphicsItems paint into).
 
int featureCount () const
 Returns the number of features currently visible (after filtering).
 
QStringList fieldNames () const
 Returns the list of field (attribute column) names.
 
QVector< QPair< QString, QString > > extendedMetadata () const override
 Ordered key→value pairs of TYPE-SPECIFIC metadata, rendered by the Metadata tab below the common block the dialog builds itself.
 
QVector< OpenSWMM::Render::AttributeFieldavailableAttributes (OpenSWMMVis::SwmmCategory cat) const override
 
QString filterExpression () const
 Returns the current OGR attribute filter expression.
 
void setFilterExpression (const QString &expr)
 Sets an OGR SQL WHERE-clause filter on the features.
 
GISVectorSymbol symbol () const
 
void setSymbol (const GISVectorSymbol &symbol)
 
void setLabelConfig (const OpenSWMM::Render::LabelConfig &cfg) override
 Slice X.18 — full label configuration.
 
QStringList ogrFieldNames () const
 Names of the OGR fields available for label expressions. Empty when no dataset has been opened yet. Used by the Labels tab to populate the field combobox.
 
std::vector< std::unique_ptr< openswmmvis::ui::ILayerStyleSubject > > styleSubjects () override
 
OpenSWMM::Render::IFeatureRendererrenderer () const
 The IFeatureRenderer that will drive this layer's paint pass.
 
void setRenderer (std::unique_ptr< OpenSWMM::Render::IFeatureRenderer > r)
 Replaces the current renderer.
 
OpenSWMM::Render::RuleListruleList () override
 
const OpenSWMM::Render::RuleListruleList () const override
 
QSet< long long > selectedFeatureIds () const
 Returns the set of currently selected feature IDs.
 
void setSelectedFeatureIds (const QSet< long long > &ids)
 Selects the features with the given IDs (replacing any prior selection).
 
void clearSelection ()
 Clears all selected features.
 
QSet< long long > featureIdsInRect (const MapExtent &rectCanvasCrs) const
 SVBC round B — fids of every feature whose GEOMETRY intersects rectCanvasCrs (OGR bbox prefilter, then precise Intersects). The rect arrives in canvas CRS and is inverse-transformed when the layer is reprojected. Any pre-existing spatial filter is saved and restored (clone dance).
 
QVector< QPointF > selectedFeatureAnchors () const
 Scene-space centres of the selected features' items — beacon anchors for MapCanvas::flashSelection.
 
QList< QVariantMap > identifyAt (double mapX, double mapY, const SpatialReferenceSystem *canvasSRS, double tolerance=1e-6) const
 Returns attributes of features that intersect the given map point.
 
QList< QVariantMap > identifyAt (double mapX, double mapY, double tolerance=1e-6) const
 Convenience overload — no CRS needed (uses current layer CRS).
 
void populateScene (QGraphicsScene *scene, const MapExtent &canvasExtent, const SpatialReferenceSystem *canvasSRS) override
 Creates / updates QGraphicsItems representing this layer in the scene.
 
void depopulateScene (QGraphicsScene *scene) override
 Removes all QGraphicsItems belonging to this layer from the scene.
 
void refreshScene (QGraphicsScene *scene, const MapExtent &canvasExtent, const SpatialReferenceSystem *canvasSRS) override
 Smart scene refresh — updates existing items instead of destroying and recreating.
 
void onCanvasCRSChanged (const SpatialReferenceSystem *newCanvasSRS) override
 Called when the user changes the canvas CRS so layers can pre-compute any CRS-dependent transform caches.
 
- Public Member Functions inherited from OpenSWMMVisLayer
 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].
 
SpatialReferenceSystemsrs () 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 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.
 
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.
 
void setLayerZValue (double z)
 Called by the canvas to set this layer's z-value band.
 
const OpenSWMM::Render::TemporalSpectemporalSpec () const
 
void setTemporalSpec (const OpenSWMM::Render::TemporalSpec &spec)
 
const OpenSWMM::Render::LabelConfiglabelConfig () const
 
const OpenSWMM::Render::MaskSpecmaskSpec () const
 
void setMaskSpec (const OpenSWMM::Render::MaskSpec &spec)
 
const OpenSWMM::Render::AuxiliaryStorageSpecauxStorageSpec () 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::DiagramSpecdiagramSpec () const
 
void setDiagramSpec (const OpenSWMM::Render::DiagramSpec &spec)
 
OpenSWMMVisWorkspaceworkspace () 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
 
- Public Member Functions inherited from OpenSWMM::Render::IAttributeProvider
virtual ~IAttributeProvider ()=default
 

Additional Inherited Members

- Public Types inherited from OpenSWMMVisLayer
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 inherited from GISVectorLayer
void filePathChanged (const QString &path)
 
void layerNameChanged (const QString &name)
 
void featureCountChanged (int count)
 
void filterExpressionChanged (const QString &expr)
 
void symbolChanged (const GISVectorSymbol &symbol)
 
void selectionChanged (const QSet< long long > &selectedIds)
 
void rendererChanged ()
 Emitted when setRenderer() swaps the renderer pointer.
 
void openFinished (bool ok)
 Emitted on the GUI thread when openAsync() completes.
 
void crsAssumed (const QString &filePath)
 Emitted once when this layer's file declares no CRS and its coordinates are therefore assumed to already be in the canvas CRS.
 
- Signals inherited from OpenSWMMVisLayer
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 ()
 
- Static Public Member Functions inherited from GISVectorLayer
static QList< OgrSublayerInfoenumerateSublayers (const QString &filePath, QString *errorOut=nullptr)
 Enumerate the layers in a vector datasource without fully loading any of them. Opens read-only, reads each OGR layer's name / geometry / feature-count / CRS, then closes.
 
- Protected Member Functions inherited from GISVectorLayer
void setOpenFlags (unsigned flags)
 GDALOpenEx flags used by openDataset and openAsync.
 
unsigned openFlags () const
 
GDALDataset * dataset () const
 The open dataset, or nullptr. Non-owning; the layer closes it. Exposed for subclasses that must reach GDAL directly (schema changes, transaction control).
 
void markSceneDirty ()
 Force the next populateScene() to rebuild its items. Call after mutating the underlying dataset so the scene reflects the write; refreshScene() alone short-circuits on a clean dirty flag.
 
void openDataset (const QString &filePath, const QString &layerName)
 Open filePath / layerName synchronously.
 
void closeDataset ()
 Closes whatever is open, releasing the dataset.
 
- Protected Member Functions inherited from OpenSWMMVisLayer
bool addChild (OpenSWMMVisLayer *child)
 
bool removeChild (OpenSWMMVisLayer *child)
 
void setLayerType (OpenSWMMVisLayerType type)
 
- Protected Attributes inherited from OpenSWMMVisLayer
QByteArray m_authHeader
 "Basic <base64>" or empty
 
BasemapHttpHeaders m_httpHeaders
 arbitrary headers (incl. "referer")
 
- Properties inherited from GISVectorLayer
QString filePath
 
QString layerName
 
int featureCount
 
QString filterExpr
 
GISVectorSymbol symbol
 
- Properties inherited from OpenSWMMVisLayer
QString Name
 
bool Visible
 
double Opacity
 
QString LayerId
 
OpenSWMMVisLayerType LayerType
 
QVector< OpenSWMMVisLayer * > Children
 
QString CRS
 

Detailed Description

A vector layer whose features came from a web feature service.

Constructor & Destructor Documentation

◆ WFSLayer()

WFSLayer::WFSLayer ( const QString &  name,
OpenSWMMVisWorkspace parent = nullptr 
)
explicit

Constructs an empty layer; adopt a response to fill it.

Parameters
nameLayer name shown in the legend.
parentOwning object.
Here is the call graph for this function:

◆ ~WFSLayer()

WFSLayer::~WFSLayer ( )
override
Here is the call graph for this function:

Member Function Documentation

◆ adoptResponse()

bool WFSLayer::adoptResponse ( const QByteArray &  body,
QString &  message 
)

Takes a GetFeature response and opens it as this layer's data.

The bytes are put where GDAL can open them and left there for as long as the layer lives, because a GISVectorLayer keeps its dataset open and reads features from it per paint — unlike a layer that reads everything into memory once, this one cannot let go of its source. The name is therefore unique per layer, and removed on destruction.

Parameters
bodyThe response body — GeoJSON or GML.
[out]messageWhy not, on failure. A service that refuses answers with a document rather than an HTTP error, so this carries the service's own words where it has them.
Returns
True when features were opened.
Here is the call graph for this function:

◆ serviceUrl()

QString WFSLayer::serviceUrl ( ) const
inline

The service this came from, for the layer's properties.

◆ setServiceUrl()

void WFSLayer::setServiceUrl ( const QString &  url)
inline

◆ setTypeName()

void WFSLayer::setTypeName ( const QString &  typeName)
inline
Here is the call graph for this function:

◆ sourceDescription()

QString WFSLayer::sourceDescription ( ) const
overridevirtual

Where this layer's data came from.

The service and collection, never the in-memory path GDAL was handed — that names nothing a user could open and does not survive the session.

Reimplemented from GISVectorLayer.

◆ typeName()

QString WFSLayer::typeName ( ) const
inline

The collection, as the service names it.

Here is the caller graph for this function:

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