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
profilepathoverlay.h
Go to the documentation of this file.
1
18#ifndef PROFILE_PATH_OVERLAY_H
19#define PROFILE_PATH_OVERLAY_H
20
21#include "plot/profilerouter.h"
22
23#include <QColor>
24#include <QGraphicsItemGroup>
25#include <QPointF>
26#include <QVector>
27#include <functional>
28
29class SWMMModelLayer;
30class QPainter;
31
47class ProfilePathOverlay : public QGraphicsItemGroup
48{
49public:
50 explicit ProfilePathOverlay(SWMMModelLayer *model,
51 QGraphicsItem *parent = nullptr);
52
56 void setPaths(const QVector<ProfileRouter::Path> &paths);
57
62 void setHighlightedPath(int index);
63
68 void setEndpoints(int startEngineNodeIdx, int endEngineNodeIdx);
69
75 void clear();
76
80 [[nodiscard]] int pathCount() const;
81
86 [[nodiscard]] QColor colorForPath(int index) const;
87
89 using SceneToPixel = std::function<QPointF(const QPointF &)>;
90
94 void paintOverlay(QPainter &p, const SceneToPixel &toPixel) const;
95
96private:
97 void rebuild();
98 void applyHighlightStyling();
99
100 [[nodiscard]] QVector<QPointF> sceneCoordsForLink(int engineLinkIdx) const;
101 [[nodiscard]] QPointF sceneCoordForNode(int engineNodeIdx) const;
102
103 SWMMModelLayer *m_model = nullptr;
104 QVector<ProfileRouter::Path> m_paths;
105 QVector<QGraphicsPathItem *> m_pathItems;
106 QGraphicsEllipseItem *m_startHalo = nullptr;
107 QGraphicsEllipseItem *m_endHalo = nullptr;
108 int m_highlighted = -1;
109 int m_startEngineNodeIdx = -1;
110 int m_endEngineNodeIdx = -1;
111};
112
113#endif // PROFILE_PATH_OVERLAY_H
Renders an ordered list of candidate paths over the map.
Definition profilepathoverlay.h:48
std::function< QPointF(const QPointF &)> SceneToPixel
Map scene point → device pixel, supplied by the canvas.
Definition profilepathoverlay.h:89
int pathCount() const
Returns the number of candidate paths currently displayed.
Definition profilepathoverlay.cpp:136
QColor colorForPath(int index) const
Returns the categorical color assigned to path index. Useful for the picker dialog to render a matchi...
Definition profilepathoverlay.cpp:141
void paintOverlay(QPainter &p, const SceneToPixel &toPixel) const
Draw paths + endpoint halos in widget/pixel space. Called by MapCanvas after the QSG frame so the pro...
Definition profilepathoverlay.cpp:147
void setEndpoints(int startEngineNodeIdx, int endEngineNodeIdx)
Marks two endpoints with pulsing halos so the user can see which start/end the candidates connect....
Definition profilepathoverlay.cpp:85
void clear()
Removes all rendered children and detaches. Caller is responsible for delete-ing the overlay or letti...
Definition profilepathoverlay.cpp:127
void setHighlightedPath(int index)
Promotes path index to full opacity; dims the rest. Pass -1 to show all candidates at equal weight.
Definition profilepathoverlay.cpp:76
void setPaths(const QVector< ProfileRouter::Path > &paths)
Replaces the displayed candidate paths. Rebuilds child items.
Definition profilepathoverlay.cpp:69
Renders the SWMM network elements (nodes, links, subcatchments, rain gages) for one OpenSWMMEngine mo...
Definition swmmmodellayer.h:133
ArrowPlacement p
Definition linesymbollayer.cpp:27
int index
Position in m_quadRegions / m_quadReports.
Definition meshgenerator.cpp:153
Path-routing primitives over an abstract weighted graph, used by Slice BC's profile-path picker.
QVector< Path > paths
Definition pslgminsize.cpp:560
QVector< int > parent
union-find
Definition pslgminsize.cpp:176