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
profilenetworkadapter.h File Reference

Bridge between SWMMModelLayer (live engine state) and the pure-logic ProfileRouter / ProfileBuilder modules used by Slice BC's profile plot. More...

#include "plot/profilebuilder.h"
#include "plot/profilerouter.h"
#include <QPointF>
#include <QString>
#include <QVector>
Include dependency graph for profilenetworkadapter.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ProfileNetworkAdapter::LinkInfo
 Just enough about each link to weight it in the routing graph. engineLinkIdx is round-tripped through the Edge::linkId field so callers can later resolve which model link a path traverses. More...
 
struct  ProfileNetworkAdapter::NodeInfo
 Per-node static data needed to materialize a PathStatic. More...
 
struct  ProfileNetworkAdapter::PathLinkInfo
 Per-link static data needed to materialize a PathStatic. maxDepth is the conduit cross-section primary dimension (e.g. circular pipe diameter) — used for the conduit-crown line in the renderer; 0 for non-conduits. More...
 

Namespaces

namespace  ProfileNetworkAdapter
 

Functions

ProfileRouter::Graph ProfileNetworkAdapter::buildGraph (int nodeCount, const QVector< LinkInfo > &links, double nonConduitWeight=1.0)
 Builds a directed routing graph from the given link list. Conduits receive weight = max(length, kMinConduitWeight); all other link kinds receive nonConduitWeight (a small fixed value so pumps/weirs/orifices are traversable without dominating conduit-length routing). See Slice BC's Phase 8.7.1 notes.
 
ProfileBuilder::PathStatic ProfileNetworkAdapter::buildPathStatic (const ProfileRouter::Path &routerPath, const QVector< NodeInfo > &nodes, const QVector< PathLinkInfo > &links)
 Materializes a ProfileBuilder::PathStatic from a router-emitted path plus pre-resolved per-node / per-link static data. nodes must have length routerPath.nodes.size(); links must have length routerPath.edges.size().
 
void ProfileNetworkAdapter::swapForReversed (PathLinkInfo &link)
 Swaps the offset1 / offset2 fields of link in-place when the path traverses the underlying model link backward. Reduces boilerplate in callers building PathLinkInfo lists.
 
ProfileBuilder::NodeKind ProfileNetworkAdapter::toNodeKind (int swmmNodeType, bool isVirtual)
 Maps an engine node type code (0=junction, 1=outfall, 2=storage, 3=divider) plus the virtual-junction flag to a NodeKind.
 
double ProfileNetworkAdapter::renderRimDepth (bool isVirtual, double maxDepth, double rimDepth)
 Picks the depth the profile should draw a node's ground/rim line at, given its hydraulic max depth and its rendering rim depth.
 
ProfileRouter::Graph ProfileNetworkAdapter::buildGraphFromModel (SWMMModelLayer *model, double nonConduitWeight=1.0)
 Convenience overload — pulls links from a live SWMMModelLayer and forwards to buildGraph().
 
ProfileBuilder::PathStatic ProfileNetworkAdapter::buildPathStaticFromModel (SWMMModelLayer *model, const ProfileRouter::Path &routerPath)
 Convenience overload — materializes a PathStatic by querying the engine for each node's invert/maxDepth and each link's offsets/ cross-section. Path orientation is derived from routerPath.nodes.
 
double ProfileNetworkAdapter::bearingFromPoints (const QPointF &at, const QPointF &away)
 Map bearing of the direction at -> away, as the profile's plan rose measures it: 0 = +y (north), increasing CLOCKWISE, in radians on (-pi, pi].
 
void ProfileNetworkAdapter::collectNodeBranches (SWMMModelLayer *model, const ProfileRouter::Path &routerPath, ProfileBuilder::PathStatic &path)
 Fills PathStatic::nodes[i].branches with every link incident to each path node, path links included (marked onPath).
 
int ProfileNetworkAdapter::findNodeIndex (SWMMModelLayer *model, const QString &name)
 Resolves an engine node index by name; returns -1 if not found. Wrapper around swmm_node_index for the rare callers that don't want to pull <openswmm_nodes.h> themselves.
 
int ProfileNetworkAdapter::findLinkIndex (SWMMModelLayer *model, const QString &name)
 Resolves an engine link index by name; returns -1 if not found.
 

Detailed Description

Bridge between SWMMModelLayer (live engine state) and the pure-logic ProfileRouter / ProfileBuilder modules used by Slice BC's profile plot.

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

The adapter is split into two layers:

  1. Pure-logic builders — buildGraph() / buildPathStatic() operate on plain POD inputs (LinkInfo / NodeInfo / etc.) and are fully unit-testable headless.
  2. Live-model glue — *FromModel() overloads pull data from the SWMMModelLayer + raw engine handle and forward to the pure-logic builders. They are exercised by integration tests, not by the GoogleTest unit fixture.

This split lets the routing math be verified in isolation while the engine-binding layer evolves with the rest of BC's stack.