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
featurelayer.h File Reference
#include "layers/gisvectorlayer.h"
#include "feature/featuregeometry.h"
#include "feature/featurestore.h"
#include "feature/featuretypes.h"
#include <QJsonObject>
#include <QString>
#include <QVector>
#include <memory>
Include dependency graph for featurelayer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ZPolicy
 How a layer's vertex Z values are obtained (PLAN §4.1). More...
 
class  FeatureLayer
 An editable, GeoPackage-backed vector layer. More...
 

Enumerations

enum class  FeatureLayerRole {
  General = 0 ,
  DomainBoundary ,
  Breakline ,
  Region ,
  ParameterZone ,
  SwmmDelineation ,
  BoundaryCondition
}
 What a feature layer is FOR. More...
 

Functions

QString featureLayerRoleLabel (FeatureLayerRole r)
 
QString featureLayerRoleToken (FeatureLayerRole r)
 
FeatureLayerRole featureLayerRoleFromToken (const QString &token)
 
openswmmvis::feature::Schema featureLayerRoleTemplate (FeatureLayerRole r)
 The fields a newly created layer of role r starts with.
 
openswmmvis::feature::GeometryType featureLayerRoleGeometry (FeatureLayerRole r)
 The geometry type a role implies, for the New-layer dialog's default. GeometryType::None when the role does not imply one.
 

Detailed Description

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

An EDITABLE vector layer: user-drawn points, lines and polygons (with holes and multiple parts) carrying a user-defined attribute schema, stored in the project GeoPackage (workplans/MESH_DIALOG_TABS_AND_FEATURE_LAYERS_PLAN_2026-09-07.md §3, D1/D2).

Why it subclasses GISVectorLayer

Everything about DISPLAYING an OGR table is already solved by the base: populateScene renders polygons with interior rings (gisvectorlayer.cpp:885), tags every scene item with its FID (:779-788), reprojects to the canvas CRS, and supplies identify, selection sync, symbology, labels, rules and the style-dialog subject. FeatureLayer adds only what is genuinely new — a write path, an authored schema, a Z policy and a role — and inherits the rest.

One connection, not two

The base is opened GDAL_OF_UPDATE (via GISVectorLayer::setOpenFlags) and the layer's FeatureStore is ATTACHED to that same GDALDataset / OGRLayer rather than opening its own. Two SQLite handles on one GeoPackage would be legal but would need cache-coherency care after every write; one handle needs none.

Threading

GUI thread only, like every other layer. Mesh generation and attribute assignment continue to re-open the .gpkg READ-ONLY by path on their workers (meshgenerationdialog.h:89-92, meshattributeassigndialog.h:44-47); that is safe because every write here is flushed immediately and no long-lived SQL transaction is held open.

Enumeration Type Documentation

◆ FeatureLayerRole

enum class FeatureLayerRole
strong

What a feature layer is FOR.

A role is a schema template plus a label — never a behaviour switch. The layer stays a plain OGR table whatever its role, so every existing consumer that accepts "a vector layer" keeps working unchanged (PLAN §6). The role only drives: the fields pre-filled by the New Feature Layer dialog, the glyph shown beside the layer in the mesh dialog's combos, and which "Use as …" shortcuts are offered.

Enumerator
General 

No template.

DomainBoundary 

Mesh domain polygon(s); interior rings become holes.

Breakline 

3D constraint lines / hard points.

Region 

Refinement, quad and min-cell-size regions.

ParameterZone 

Roughness, land use, infiltration.

SwmmDelineation 

Source for Import Feature Layer → SWMM objects.

BoundaryCondition 

Lines mapped onto 2D mesh boundary edges.

Function Documentation

◆ featureLayerRoleFromToken()

FeatureLayerRole featureLayerRoleFromToken ( const QString &  token)
Here is the caller graph for this function:

◆ featureLayerRoleGeometry()

openswmmvis::feature::GeometryType featureLayerRoleGeometry ( FeatureLayerRole  r)

The geometry type a role implies, for the New-layer dialog's default. GeometryType::None when the role does not imply one.

◆ featureLayerRoleLabel()

QString featureLayerRoleLabel ( FeatureLayerRole  r)
Here is the caller graph for this function:

◆ featureLayerRoleTemplate()

openswmmvis::feature::Schema featureLayerRoleTemplate ( FeatureLayerRole  r)

The fields a newly created layer of role r starts with.

◆ featureLayerRoleToken()

QString featureLayerRoleToken ( FeatureLayerRole  r)
Here is the caller graph for this function: