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
SelectionOps Namespace Reference

Classes

struct  TraceResult
 Result of an upstream / downstream network trace. More...
 

Functions

QSet< SWMMObjectRefinvert (SWMMModelLayer *model, const QSet< SWMMObjectRef > &current)
 Invert the selection, scoped to a single category when the current selection is homogeneous.
 
TraceResult trace (SWMMModelLayer *model, const QSet< SWMMObjectRef > &seeds, bool upstream)
 All objects connected upstream (or downstream) of seeds.
 

Function Documentation

◆ invert()

QSet< SWMMObjectRef > SelectionOps::invert ( SWMMModelLayer model,
const QSet< SWMMObjectRef > &  current 
)

Invert the selection, scoped to a single category when the current selection is homogeneous.

"Category" here is the fine SWMMModelLayer::Category — Junctions, Outfalls, Storage, Dividers, Conduits, Pumps, Orifices, Weirs, Outlets, Subcatchments, Rain Gages. So inverting a selection of three junctions yields every other junction; a selection of a junction plus a conduit is mixed and inverts across all eleven categories.

Rules:

  • Empty selection (or one holding only pass-through refs) → select all.
  • 2D mesh refs (MeshVertex / MeshEdge / MeshCell) and non-spatial data refs (Curve / TimeSeries / …) are passed through unchanged: they neither participate in the homogeneity test nor get inverted.
Returns
the next selection set. Empty (and a no-op for the caller) when model is null or has no engine.
Here is the call graph for this function:

◆ trace()

TraceResult SelectionOps::trace ( SWMMModelLayer model,
const QSet< SWMMObjectRef > &  seeds,
bool  upstream 
)

All objects connected upstream (or downstream) of seeds.

Seeding: a selected node seeds itself; a selected link seeds both its endpoints; a selected subcatchment seeds itself when tracing upstream, and when tracing downstream contributes its outlet chain (each subcatchment hop is included in the result, and the terminal outlet node becomes a node seed). Mesh and data refs in seeds are ignored.

Traversal is a BFS over the directed link graph — reversed for upstream. A link is included when both endpoints land inside the visited node set.

Subcatchments: drainage runs subcatchment → node, so a subcatchment is always upstream of its outlet. Tracing upstream therefore pulls in every subcatchment draining to a visited node, plus — transitively — every subcatchment draining into one of those. Tracing downstream picks up subcatchments only along the outlet chain of a subcatchment seed. That asymmetry is physical, not an oversight.

Both BFS loops are visited-guarded, so a malformed subcatchment→subcatchment cycle terminates instead of hanging.

Here is the call graph for this function: