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
meshprofileoverlay.h
Go to the documentation of this file.
1
21#ifndef MESH_PROFILE_OVERLAY_H
22#define MESH_PROFILE_OVERLAY_H
23
24#include <QPointF>
25#include <QVector>
26#include <functional>
27
28class QPainter;
29
31{
32public:
33 MeshProfileOverlay() = default;
34
37 void setPolyline(const QVector<QPointF> &scenePolyline);
38
41 void setArrowChainage(double chainage);
42
44 using SceneToPixel = std::function<QPointF(const QPointF &)>;
45
49 void paint(QPainter &p, const SceneToPixel &toPixel) const;
50
51 // ── Geometry helpers (chainage ↔ scene point along the polyline) ──────
52 [[nodiscard]] double totalLength() const { return m_total; }
53 [[nodiscard]] QPointF chainageToScene(double chainage) const;
56 [[nodiscard]] double nearestChainage(const QPointF &scenePt) const;
57 [[nodiscard]] const QVector<QPointF> &polyline() const { return m_poly; }
58
59private:
60 QVector<QPointF> m_poly;
61 QVector<double> m_chain;
62 double m_total = 0.0;
63 double m_arrowChainage = -1.0;
64};
65
66#endif // MESH_PROFILE_OVERLAY_H
Definition meshprofileoverlay.h:31
std::function< QPointF(const QPointF &)> SceneToPixel
Map scene point → device pixel, supplied by the canvas.
Definition meshprofileoverlay.h:44
double nearestChainage(const QPointF &scenePt) const
Chainage of the point on the polyline closest to scenePt (orthogonal projection). Used by the map dra...
Definition meshprofileoverlay.cpp:101
QPointF chainageToScene(double chainage) const
Definition meshprofileoverlay.cpp:86
const QVector< QPointF > & polyline() const
Definition meshprofileoverlay.h:57
void setArrowChainage(double chainage)
Position the arrow at chainage (scene units along the path). A negative value hides the arrow.
Definition meshprofileoverlay.cpp:38
void paint(QPainter &p, const SceneToPixel &toPixel) const
Draw the casing + colored line + position arrow in widget/pixel space. Called by MapCanvas::paintEven...
Definition meshprofileoverlay.cpp:43
void setPolyline(const QVector< QPointF > &scenePolyline)
Set the persistent profile polyline (scene coords). Rebuilds the chainage table used for chainage↔poi...
Definition meshprofileoverlay.cpp:22
MeshProfileOverlay()=default
double totalLength() const
Definition meshprofileoverlay.h:52
ArrowPlacement p
Definition linesymbollayer.cpp:27