10#ifndef GISVECTORLAYER_H
11#define GISVECTORLAYER_H
21#include <QPainterPath>
35class OGRCoordinateTransformation;
42class IFeatureRenderer;
66 QPen
linePen = QPen(QColor(Qt::blue), 2.0);
85 [[nodiscard]] QJsonObject
toJson()
const;
155 [[nodiscard]]
static QList<OgrSublayerInfo>
163 [[nodiscard]] QString
filePath()
const;
175 [[nodiscard]]
class OGRLayer *
ogrLayer()
const {
return m_ogrLayer; }
207 [[nodiscard]] QVector<QPair<QString, QString>>
extendedMetadata()
const override;
216 [[nodiscard]] QVector<OpenSWMM::Render::AttributeField>
255 [[nodiscard]] std::vector<std::unique_ptr<openswmmvis::ui::ILayerStyleSubject>>
278 void setRenderer(std::unique_ptr<OpenSWMM::Render::IFeatureRenderer> r);
334 [[nodiscard]] QList<QVariantMap>
identifyAt(
double mapX,
double mapY,
336 double tolerance = 1
e-6)
const;
341 [[nodiscard]] QList<QVariantMap>
identifyAt(
double mapX,
double mapY,
342 double tolerance = 1
e-6)
const;
412 [[nodiscard]]
unsigned openFlags()
const {
return m_openFlags; }
417 [[nodiscard]] GDALDataset *
dataset()
const {
return m_dataset; }
467 void syncSymbolFromRenderer();
470 QString m_ogrLayerName;
471 QString m_filterExpr;
477 QSet<long long> m_selectedIds;
482 unsigned m_openFlags = 0;
484 GDALDataset *m_dataset =
nullptr;
485 OGRLayer *m_ogrLayer =
nullptr;
486 mutable OGRCoordinateTransformation *m_transform =
nullptr;
490 mutable QString m_transformCanvasWkt;
493 mutable bool m_warnedNoCRS =
false;
505 std::unique_ptr<OpenSWMM::Render::RuleList> m_ruleList;
508 bool m_needsRebuild =
true;
512 QList<QGraphicsItem *> m_sceneItems;
A map layer backed by a GDAL/OGR vector dataset.
Definition gisvectorlayer.h:103
void setSelectedFeatureIds(const QSet< long long > &ids)
Selects the features with the given IDs (replacing any prior selection).
Definition gisvectorlayer.cpp:640
QString filterExpr
Definition gisvectorlayer.h:110
QString sourceDescription() const override
Human-readable source of this layer: a file path, a service URL, or a description for in-memory / der...
Definition gisvectorlayer.cpp:230
void rendererChanged()
Emitted when setRenderer() swaps the renderer pointer.
void selectionChanged(const QSet< long long > &selectedIds)
QStringList fieldNames() const
Returns the list of field (attribute column) names.
Definition gisvectorlayer.cpp:255
QVector< QPointF > selectedFeatureAnchors() const
Scene-space centres of the selected features' items — beacon anchors for MapCanvas::flashSelection.
Definition gisvectorlayer.cpp:781
int featureCount
Definition gisvectorlayer.h:108
void setOpenFlags(unsigned flags)
GDALOpenEx flags used by openDataset and openAsync.
Definition gisvectorlayer.h:411
void setRenderer(std::unique_ptr< OpenSWMM::Render::IFeatureRenderer > r)
Replaces the current renderer.
Definition gisvectorlayer.cpp:607
void populateScene(QGraphicsScene *scene, const MapExtent &canvasExtent, const SpatialReferenceSystem *canvasSRS) override
Creates / updates QGraphicsItems representing this layer in the scene.
Definition gisvectorlayer.cpp:814
class OGRLayer * ogrLayer() const
Read-only OGRLayer handle for callers that need to walk features directly (e.g. mesh-generator constr...
Definition gisvectorlayer.h:175
void crsAssumed(const QString &filePath)
Emitted once when this layer's file declares no CRS and its coordinates are therefore assumed to alre...
QString filterExpression() const
Returns the current OGR attribute filter expression.
Definition gisvectorlayer.cpp:370
unsigned openFlags() const
Definition gisvectorlayer.h:412
void setSymbol(const GISVectorSymbol &symbol)
Definition gisvectorlayer.cpp:488
GDALDataset * dataset() const
The open dataset, or nullptr. Non-owning; the layer closes it. Exposed for subclasses that must reach...
Definition gisvectorlayer.h:417
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.
Definition gisvectorlayer.cpp:663
void layerNameChanged(const QString &name)
void filterExpressionChanged(const QString &expr)
GISVectorSymbol symbol
Definition gisvectorlayer.h:111
QSet< long long > featureIdsInRect(const MapExtent &rectCanvasCrs) const
SVBC round B — fids of every feature whose GEOMETRY intersects rectCanvasCrs (OGR bbox prefilter,...
Definition gisvectorlayer.cpp:724
QStringList ogrFieldNames() const
Names of the OGR fields available for label expressions. Empty when no dataset has been opened yet....
Definition gisvectorlayer.cpp:551
void setFilterExpression(const QString &expr)
Sets an OGR SQL WHERE-clause filter on the features.
Definition gisvectorlayer.cpp:372
void openAsync(const QString &filePath, const QString &layerName={})
Asynchronously open filePath / layerName. GDALOpenEx + GetExtent (which forces a scan on some drivers...
Definition gisvectorlayer.cpp:1261
void depopulateScene(QGraphicsScene *scene) override
Removes all QGraphicsItems belonging to this layer from the scene.
Definition gisvectorlayer.cpp:1037
void symbolChanged(const GISVectorSymbol &symbol)
static QList< OgrSublayerInfo > enumerateSublayers(const QString &filePath, QString *errorOut=nullptr)
Enumerate the layers in a vector datasource without fully loading any of them. Opens read-only,...
Definition gisvectorlayer.cpp:1083
QVector< OpenSWMM::Render::AttributeField > availableAttributes(OpenSWMMVis::SwmmCategory cat) const override
Definition gisvectorlayer.cpp:278
QString layerName
Definition gisvectorlayer.h:107
void closeDataset()
Closes whatever is open, releasing the dataset.
Definition gisvectorlayer.cpp:1286
void openFinished(bool ok)
Emitted on the GUI thread when openAsync() completes.
void clearSelection()
Clears all selected features.
Definition gisvectorlayer.cpp:648
OpenSWMM::Render::IFeatureRenderer * renderer() const
The IFeatureRenderer that will drive this layer's paint pass.
Definition gisvectorlayer.cpp:599
~GISVectorLayer() override
Definition gisvectorlayer.cpp:212
QString filePath
Definition gisvectorlayer.h:106
void appendScenePolygonsTo(QPainterPath &out) const
Slice Z.14-paint — append every polygon ring this layer currently exposes (post-attribute-filter) to ...
Definition gisvectorlayer.cpp:306
void openDataset(const QString &filePath, const QString &layerName)
Open filePath / layerName synchronously.
Definition gisvectorlayer.cpp:1256
void markSceneDirty()
Force the next populateScene() to rebuild its items. Call after mutating the underlying dataset so th...
Definition gisvectorlayer.h:422
QSet< long long > selectedFeatureIds() const
Returns the set of currently selected feature IDs.
Definition gisvectorlayer.cpp:638
void setLabelConfig(const OpenSWMM::Render::LabelConfig &cfg) override
Slice X.18 — full label configuration.
Definition gisvectorlayer.cpp:531
OpenSWMM::Render::RuleList * ruleList() override
Definition gisvectorlayer.cpp:624
QString ogrLayerName() const
Returns the OGR sub-layer name opened within the dataset.
Definition gisvectorlayer.cpp:228
void onCanvasCRSChanged(const SpatialReferenceSystem *newCanvasSRS) override
Called when the user changes the canvas CRS so layers can pre-compute any CRS-dependent transform cac...
Definition gisvectorlayer.cpp:1051
QVector< QPair< QString, QString > > extendedMetadata() const override
Ordered key→value pairs of TYPE-SPECIFIC metadata, rendered by the Metadata tab below the common bloc...
Definition gisvectorlayer.cpp:236
void featureCountChanged(int count)
std::vector< std::unique_ptr< openswmmvis::ui::ILayerStyleSubject > > styleSubjects() override
Definition gisvectorlayer.cpp:574
void filePathChanged(const QString &path)
void refreshScene(QGraphicsScene *scene, const MapExtent &canvasExtent, const SpatialReferenceSystem *canvasSRS) override
Smart scene refresh — updates existing items instead of destroying and recreating.
Definition gisvectorlayer.cpp:1059
Definition gisvectorsymboladapter.h:26
An axis-aligned bounding box in the coordinate space of a given CRS.
Definition mapextent.h:26
Interface every themeable layer implements so renderer panels can populate attribute combos without h...
Definition iattributeprovider.h:73
Abstract interface — every vector layer's paint path goes here.
Definition ifeaturerenderer.h:85
Ordered owning container for Rules on one layer.
Definition rulelist.h:48
Abstract base class for all layers displayed in the MapCanvas.
Definition openswmmvislayer.h:116
QString name() const
Returns the user-visible name of this layer.
Definition openswmmvislayer.cpp:62
Top-level project container managing sessions, the SWMM model layer, and persistence paths for one SW...
Definition openswmmvisworkspace.h:42
Represents a coordinate reference system backed by a GDAL OGRSpatialReference.
Definition spatialreferencesystem.h:28
Layer-side seam for "what attributes can I theme by?" — Slice DM.1.
QGraphicsScene * scene
Definition inletdrawingview.cpp:78
int e
Definition inpmeshreader.cpp:41
bool ok
Definition inpmeshwriter.cpp:575
Shared label-configuration value-type used by every layer that paints text labels.
Definition gisrasterlayer.h:40
SwmmCategory
Stable ordinal categorising every SWMM-element kind that has per-kind styling, per-kind tree rows,...
Definition swmm_category.h:28
Abstract base class for all map layers displayed in the MapCanvas.
int path
Definition pslgminsize.cpp:234
QVector< int > parent
union-find
Definition pslgminsize.cpp:176
Lightweight description of one OGR layer inside a datasource, produced by enumerateSublayers() withou...
Definition gisvectorlayer.h:138
QString name
OGR layer name (GetName()).
Definition gisvectorlayer.h:139
QString crsDescription
From GetSpatialRef(); empty if none.
Definition gisvectorlayer.h:142
int index
GetLayer(i) ordinal.
Definition gisvectorlayer.h:143
QString geometryType
Human label, e.g. "Polygon", "3D Line String".
Definition gisvectorlayer.h:140
long long featureCount
GetFeatureCount(); -1 if unknown.
Definition gisvectorlayer.h:141
Definition gisvectorlayer.cpp:1154
Rendering symbology for a vector layer.
Definition gisvectorlayer.h:52
QColor markerFill
Definition gisvectorlayer.h:58
double markerSize
Definition gisvectorlayer.h:57
double markerOutlineW
Definition gisvectorlayer.h:60
QColor labelColor
Definition gisvectorlayer.h:76
MarkerShape markerShape
Definition gisvectorlayer.h:56
QJsonObject toJson() const
Definition gisvectorlayer.cpp:404
QString labelField
Definition gisvectorlayer.h:74
MarkerShape
Definition gisvectorlayer.h:54
@ Star
Definition gisvectorlayer.h:54
@ Square
Definition gisvectorlayer.h:54
@ Cross
Definition gisvectorlayer.h:54
@ Diamond
Definition gisvectorlayer.h:54
@ Circle
Definition gisvectorlayer.h:54
@ Triangle
Definition gisvectorlayer.h:54
QColor markerOutline
Definition gisvectorlayer.h:59
QBrush polygonFill
Definition gisvectorlayer.h:69
QPen polygonOutline
Definition gisvectorlayer.h:70
bool showLabels
Definition gisvectorlayer.h:73
QPen linePen
Definition gisvectorlayer.h:66
OpenSWMM::Render::LabelConfig labelConfig
Definition gisvectorlayer.h:83
void fromJson(const QJsonObject &j)
Definition gisvectorlayer.cpp:433
QFont labelFont
Definition gisvectorlayer.h:75
Per-layer label rendering parameters.
Definition labelconfig.h:47