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
couplednodesublayer.h
Go to the documentation of this file.
1
18#ifndef OPENSWMM_RENDER_SUBLAYERS_COUPLEDNODESUBLAYER_H
19#define OPENSWMM_RENDER_SUBLAYERS_COUPLEDNODESUBLAYER_H
20
21#include "render/isublayer.h"
23
24#include <QColor>
25#include <QJsonObject>
26#include <QString>
27
28namespace OpenSWMM::Render
29{
30
32{
33 Q_OBJECT
34 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY styleChanged)
35 Q_PROPERTY(double markerSizePx READ markerSizePx WRITE setMarkerSizePx NOTIFY styleChanged)
36
37 Q_CLASSINFO("group:color", "Symbology")
38 Q_CLASSINFO("group:markerSizePx", "Symbology")
39
40public:
41 explicit CoupledNodeStyle(QObject *parent = nullptr) : SublayerStyle(parent) {}
42
43 [[nodiscard]] QColor color() const { return m_color; }
44 [[nodiscard]] double markerSizePx() const { return m_markerSizePx; }
45
46 void setColor(const QColor &v) { if (m_color == v) return; m_color = v; setDirty(); }
47 void setMarkerSizePx(double v);
48
49 [[nodiscard]] QJsonObject toJson() const override;
50 void fromJson(const QJsonObject &j) override;
51
52private:
53 // Defaults mirror MeshNodeStyle's historic taggedColor / taggedSizePx so
54 // migrated projects render identically.
55 QColor m_color = QColor(0xff, 0x8c, 0x00, 235); // orange
56 double m_markerSizePx = 5.0;
57};
58
60{
61 Q_OBJECT
62public:
63 explicit CoupledNodeSublayer(QString id_, QObject *parent = nullptr);
64
65 Kind kind() const override { return MarkerKind; }
66 QString id() const override { return m_id; }
67 QString displayName() const override { return tr("Coupled Nodes"); }
68
69 bool isVisible() const override { return m_visible; }
70 void setVisible(bool v) override;
71 qreal opacity() const override { return m_opacity; }
72 void setOpacity(qreal o) override;
73
74 bool isDynamic() const override { return false; }
75
76 SublayerStyle *style() override { return m_style; }
77
78 QList<LegendSymbolItem> legendSymbolItems() const override;
79 QSGNode *buildOrUpdateNode(QSGNode *existing, const SublayerContext &) override;
80
81 [[nodiscard]] CoupledNodeStyle *coupledStyle() const { return m_style; }
82
83private:
84 QString m_id;
85 // Visible by default: the legacy behaviour (highlightTagged default true
86 // with the mesh ctor turning vertices on) drew coupled markers on a
87 // fresh mesh, and they are the primary 1D↔2D wiring cue.
88 bool m_visible = true;
89 qreal m_opacity = 1.0;
90 CoupledNodeStyle *m_style;
91};
92
93} // namespace OpenSWMM::Render
94
95#endif
Definition couplednodesublayer.h:32
void setMarkerSizePx(double v)
Definition couplednodesublayer.cpp:12
void setColor(const QColor &v)
Definition couplednodesublayer.h:46
QColor color
Definition couplednodesublayer.h:34
QJsonObject toJson() const override
Serialize the style to JSON.
Definition couplednodesublayer.cpp:20
void fromJson(const QJsonObject &j) override
Restore the style from JSON.
Definition couplednodesublayer.cpp:28
double markerSizePx() const
Definition couplednodesublayer.h:44
double markerSizePx
Definition couplednodesublayer.h:35
QColor color() const
Definition couplednodesublayer.h:43
Definition couplednodesublayer.h:60
QString id() const override
Definition couplednodesublayer.h:66
CoupledNodeStyle * coupledStyle() const
Definition couplednodesublayer.h:81
QList< LegendSymbolItem > legendSymbolItems() const override
Returns the legend rows this sublayer contributes.
Definition couplednodesublayer.cpp:61
QSGNode * buildOrUpdateNode(QSGNode *existing, const SublayerContext &) override
Build (or update) the QSG node tree for this sublayer.
Definition couplednodesublayer.cpp:76
bool isVisible() const override
Definition couplednodesublayer.h:69
void setVisible(bool v) override
Definition couplednodesublayer.cpp:46
void setOpacity(qreal o) override
Definition couplednodesublayer.cpp:53
bool isDynamic() const override
Whether this sublayer's output depends on the current animation period.
Definition couplednodesublayer.h:74
SublayerStyle * style() override
Returns the property-bag QObject that owns this sublayer's style knobs.
Definition couplednodesublayer.h:76
Kind kind() const override
Definition couplednodesublayer.h:65
qreal opacity() const override
Definition couplednodesublayer.h:71
QString displayName() const override
Definition couplednodesublayer.h:67
One toggleable visual aspect of a results / model layer.
Definition isublayer.h:87
Kind
Coarse taxonomy of sublayer paint behaviours.
Definition isublayer.h:100
@ MarkerKind
Definition isublayer.h:101
Base class for per-sublayer style property bags.
Definition sublayerstyle.h:56
void styleChanged()
Emitted when any property changes.
void setDirty()
Definition sublayerstyle.h:97
Toggleable visual aspect of an output layer.
Definition gisrasterlayer.h:40
QVector< int > v
pool vertex indices
Definition pslgminsize.cpp:159
QVector< int > parent
union-find
Definition pslgminsize.cpp:176
Per-frame parameters handed to ISublayer::buildOrUpdateNode().
Definition isublayer.h:73
QObject base class for per-sublayer style property bags.