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
seriesstyleobject.h
Go to the documentation of this file.
1
25#ifndef OPENSWMMVIS_PLOT_SERIESSTYLEOBJECT_H
26#define OPENSWMMVIS_PLOT_SERIESSTYLEOBJECT_H
27
28#include "plot/seriesstyle.h"
29
30#include <QColor>
31#include <QFont>
32#include <QObject>
33#include <QString>
34
35namespace openswmmvis::plot {
36
37class SeriesStyleObject : public QObject
38{
39 Q_OBJECT
40
41 // ---- Identity ----------------------------------------------------------
42 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
43 Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged)
44 Q_PROPERTY(QString legendName READ legendName WRITE setLegendName NOTIFY legendNameChanged)
46
47 // ---- Line --------------------------------------------------------------
48 Q_PROPERTY(bool showLine READ showLine WRITE setShowLine NOTIFY showLineChanged)
49 Q_PROPERTY(qreal lineWidth READ lineWidth WRITE setLineWidth NOTIFY lineWidthChanged)
50 Q_PROPERTY(Qt::PenStyle dash READ dash WRITE setDash NOTIFY dashChanged)
51 Q_PROPERTY(Qt::PenCapStyle capStyle READ capStyle WRITE setCapStyle NOTIFY capStyleChanged)
52 Q_PROPERTY(Qt::PenJoinStyle joinStyle READ joinStyle WRITE setJoinStyle NOTIFY joinStyleChanged)
53
54 // ---- Markers -----------------------------------------------------------
55 Q_PROPERTY(bool showMarkers READ showMarkers WRITE setShowMarkers NOTIFY showMarkersChanged)
56 Q_PROPERTY(MarkerShapeQ shape READ shape WRITE setShape NOTIFY shapeChanged)
57 Q_PROPERTY(qreal markerSize READ markerSize WRITE setMarkerSize NOTIFY markerSizeChanged)
61
62 // ---- Point labels ------------------------------------------------------
69
70 // ---- Area fill ---------------------------------------------------------
73
74public:
78 enum class MarkerShapeQ : int {
79 Circle = static_cast<int>(MarkerShape::Circle),
80 Square = static_cast<int>(MarkerShape::Square),
81 Triangle = static_cast<int>(MarkerShape::Triangle),
82 Diamond = static_cast<int>(MarkerShape::Diamond),
83 Cross = static_cast<int>(MarkerShape::Cross),
84 Plus = static_cast<int>(MarkerShape::Plus),
85 };
86 Q_ENUM(MarkerShapeQ)
87
88
91 enum class LabelFormatModeQ : int {
92 Decimals = static_cast<int>(NumberFormatMode::Decimals),
94 };
95 Q_ENUM(LabelFormatModeQ)
96
97 explicit SeriesStyleObject(QObject *parent = nullptr);
98 explicit SeriesStyleObject(const SeriesStyle& initial, QObject *parent = nullptr);
99 ~SeriesStyleObject() override = default;
100
102 SeriesStyle style() const noexcept { return m_style; }
103
107 void setStyle(const SeriesStyle& s);
108
122 QString legendOverride() const { return m_legendOverride; }
123
128 Q_INVOKABLE QString displayLabelFor(const QString &propertyName) const;
129
130 // ---- Getters -----------------------------------------------------------
131 QColor color() const noexcept { return m_style.color; }
132 qreal opacity() const noexcept { return m_style.opacity; }
133 QString legendName() const { return m_style.legendName; }
134
135 bool showLine() const noexcept { return m_style.showLine; }
136 qreal lineWidth() const noexcept { return m_style.lineWidth; }
137 Qt::PenStyle dash() const noexcept { return m_style.dash; }
138 Qt::PenCapStyle capStyle() const noexcept { return m_style.capStyle; }
139 Qt::PenJoinStyle joinStyle() const noexcept { return m_style.joinStyle; }
140
141 bool showMarkers() const noexcept { return m_style.showMarkers; }
142 MarkerShapeQ shape() const noexcept { return static_cast<MarkerShapeQ>(m_style.shape); }
143 qreal markerSize() const noexcept { return m_style.markerSize; }
144 QColor markerFillColor() const noexcept { return m_style.markerFillColor; }
145 QColor markerBorderColor() const noexcept { return m_style.markerBorderColor; }
146 qreal markerBorderWidth() const noexcept { return m_style.markerBorderWidth; }
147
148 bool showPointLabels() const noexcept { return m_style.showPointLabels; }
149 QFont pointLabelFont() const noexcept { return m_style.pointLabelFont; }
150 QColor pointLabelColor() const noexcept { return m_style.pointLabelColor; }
152 { return static_cast<LabelFormatModeQ>(m_style.pointLabelFormatMode); }
153 int pointLabelPrecision() const noexcept { return m_style.pointLabelPrecision; }
154 QString pointLabelFormat() const { return m_style.pointLabelFormat; }
155
156 bool showAreaFill() const noexcept { return m_style.showAreaFill; }
157 QColor areaFillColor() const noexcept { return m_style.areaFillColor; }
158
159public slots:
160 void setColor(const QColor& c);
161 void setOpacity(qreal v);
162 void setLegendName(const QString& s);
163 void setLegendOverride(const QString& s);
164
165 void setShowLine(bool on);
166 void setLineWidth(qreal v);
167 void setDash(Qt::PenStyle s);
168 void setCapStyle(Qt::PenCapStyle s);
169 void setJoinStyle(Qt::PenJoinStyle s);
170
171 void setShowMarkers(bool on);
172 void setShape(MarkerShapeQ s);
173 void setMarkerSize(qreal v);
174 void setMarkerFillColor(const QColor& c);
175 void setMarkerBorderColor(const QColor& c);
177
178 void setShowPointLabels(bool on);
179 void setPointLabelFont(const QFont& f);
180 void setPointLabelColor(const QColor& c);
183 void setPointLabelFormat(const QString& spec);
184
185 void setShowAreaFill(bool on);
186 void setAreaFillColor(const QColor& c);
187
188signals:
189 void colorChanged(const QColor&);
190 void opacityChanged(qreal);
191 void legendNameChanged(const QString&);
192 void legendOverrideChanged(const QString&);
193
194 void showLineChanged(bool);
195 void lineWidthChanged(qreal);
196 void dashChanged(Qt::PenStyle);
197 void capStyleChanged(Qt::PenCapStyle);
198 void joinStyleChanged(Qt::PenJoinStyle);
199
202 void markerSizeChanged(qreal);
203 void markerFillColorChanged(const QColor&);
204 void markerBorderColorChanged(const QColor&);
206
208 void pointLabelFontChanged(const QFont&);
209 void pointLabelColorChanged(const QColor&);
212 void pointLabelFormatChanged(const QString&);
213
215 void areaFillColorChanged(const QColor&);
216
220
221private:
222 void emitAggregate_();
223
224 SeriesStyle m_style;
225 QString m_legendOverride;
226};
227
228} // namespace openswmmvis::plot
229
232
233#endif // OPENSWMMVIS_PLOT_SERIESSTYLEOBJECT_H
Definition seriesstyleobject.h:38
void setJoinStyle(Qt::PenJoinStyle s)
void capStyleChanged(Qt::PenCapStyle)
qreal markerBorderWidth
Definition seriesstyleobject.h:60
bool showPointLabels() const noexcept
Definition seriesstyleobject.h:148
Qt::PenCapStyle capStyle
Definition seriesstyleobject.h:51
qreal opacity
Definition seriesstyleobject.h:43
QColor markerBorderColor() const noexcept
Definition seriesstyleobject.h:145
MarkerShapeQ shape() const noexcept
Definition seriesstyleobject.h:142
void markerBorderColorChanged(const QColor &)
qreal markerSize() const noexcept
Definition seriesstyleobject.h:143
bool showAreaFill
Definition seriesstyleobject.h:71
int pointLabelPrecision
Definition seriesstyleobject.h:67
QString legendName() const
Definition seriesstyleobject.h:133
QFont pointLabelFont
Definition seriesstyleobject.h:64
Q_INVOKABLE QString displayLabelFor(const QString &propertyName) const
Human-friendly, group-prefixed label for the QPropertyModel tree. Returns labels like "Line — Width",...
Definition seriesstyleobject.cpp:61
QColor pointLabelColor() const noexcept
Definition seriesstyleobject.h:150
LabelFormatModeQ pointLabelFormatMode
Definition seriesstyleobject.h:66
QString legendName
Definition seriesstyleobject.h:44
QString pointLabelFormat() const
Definition seriesstyleobject.h:154
bool showLine
Definition seriesstyleobject.h:48
QString legendOverride() const
Spec-level legend override (mirrors SeriesSpec::legendOverride).
Definition seriesstyleobject.h:122
bool showAreaFill() const noexcept
Definition seriesstyleobject.h:156
void legendNameChanged(const QString &)
Qt::PenStyle dash() const noexcept
Definition seriesstyleobject.h:137
void setAreaFillColor(const QColor &c)
bool showMarkers() const noexcept
Definition seriesstyleobject.h:141
MarkerShapeQ shape
Definition seriesstyleobject.h:56
qreal markerBorderWidth() const noexcept
Definition seriesstyleobject.h:146
QColor markerFillColor() const noexcept
Definition seriesstyleobject.h:144
void setLegendOverride(const QString &s)
Definition seriesstyleobject.cpp:120
void styleChanged(const openswmmvis::plot::SeriesStyle &s)
Aggregate change signal — fires after every per-field setter. Hosts subscribe to this once to live-up...
bool showPointLabels
Definition seriesstyleobject.h:63
void setLegendName(const QString &s)
void areaFillColorChanged(const QColor &)
QColor areaFillColor() const noexcept
Definition seriesstyleobject.h:157
void markerFillColorChanged(const QColor &)
void setPointLabelFont(const QFont &f)
bool showMarkers
Definition seriesstyleobject.h:55
void setStyle(const SeriesStyle &s)
Replace every field at once. Emits per-field NOTIFYs that actually differ from the previous values,...
Definition seriesstyleobject.cpp:19
qreal markerSize
Definition seriesstyleobject.h:57
LabelFormatModeQ
Q_ENUM mirror of NumberFormatMode so QPropertyModel can render a combo-box for the point-label number...
Definition seriesstyleobject.h:91
Qt::PenCapStyle capStyle() const noexcept
Definition seriesstyleobject.h:138
void pointLabelFormatModeChanged(LabelFormatModeQ)
LabelFormatModeQ pointLabelFormatMode() const noexcept
Definition seriesstyleobject.h:151
QColor pointLabelColor
Definition seriesstyleobject.h:65
void setMarkerFillColor(const QColor &c)
void joinStyleChanged(Qt::PenJoinStyle)
bool showLine() const noexcept
Definition seriesstyleobject.h:135
void setPointLabelFormatMode(LabelFormatModeQ m)
Definition seriesstyleobject.cpp:163
int pointLabelPrecision() const noexcept
Definition seriesstyleobject.h:153
QColor color() const noexcept
Definition seriesstyleobject.h:131
void pointLabelFontChanged(const QFont &)
Qt::PenJoinStyle joinStyle() const noexcept
Definition seriesstyleobject.h:139
SeriesStyle style() const noexcept
Snapshot of the current style.
Definition seriesstyleobject.h:102
QString pointLabelFormat
Definition seriesstyleobject.h:68
qreal lineWidth() const noexcept
Definition seriesstyleobject.h:136
qreal opacity() const noexcept
Definition seriesstyleobject.h:132
MarkerShapeQ
A Q_ENUM-registered mirror of MarkerShape so QPropertyModel can render a combo-box for it....
Definition seriesstyleobject.h:78
Qt::PenStyle dash
Definition seriesstyleobject.h:50
Qt::PenJoinStyle joinStyle
Definition seriesstyleobject.h:52
void setPointLabelFormat(const QString &spec)
QFont pointLabelFont() const noexcept
Definition seriesstyleobject.h:149
void setPointLabelColor(const QColor &c)
QColor color
Definition seriesstyleobject.h:42
QColor markerFillColor
Definition seriesstyleobject.h:58
QColor areaFillColor
Definition seriesstyleobject.h:72
QString legendOverride
Definition seriesstyleobject.h:45
void pointLabelFormatChanged(const QString &)
void pointLabelColorChanged(const QColor &)
void legendOverrideChanged(const QString &)
void setCapStyle(Qt::PenCapStyle s)
void setShape(MarkerShapeQ s)
Definition seriesstyleobject.cpp:152
QColor markerBorderColor
Definition seriesstyleobject.h:59
void setMarkerBorderColor(const QColor &c)
qreal lineWidth
Definition seriesstyleobject.h:49
double s
Scene px per model length unit.
Definition inletdrawingview.cpp:82
MaskMode m
Definition maskspec.cpp:18
std::size_t n
Definition mesh2dresultsexport.cpp:426
Definition chartproperties.h:34
@ Decimals
Fixed-point: count digits after the point ('f').
@ SignificantFigures
General: count significant figures ('g').
QVector< int > v
pool vertex indices
Definition pslgminsize.cpp:159
QVector< int > parent
union-find
Definition pslgminsize.cpp:176
Per-series rendering style for chart plots (comprehensive schema).
Aggregated rendering parameters for one chart series.
Definition seriesstyle.h:48
QFont pointLabelFont
Definition seriesstyle.h:71
NumberFormatMode pointLabelFormatMode
Definition seriesstyle.h:74
bool showAreaFill
Definition seriesstyle.h:78
QString pointLabelFormat
Definition seriesstyle.h:75
QColor color
Definition seriesstyle.h:50
Qt::PenStyle dash
Definition seriesstyle.h:57
qreal markerBorderWidth
Definition seriesstyle.h:67
QString legendName
Definition seriesstyle.h:52
QColor areaFillColor
Definition seriesstyle.h:79
QColor markerBorderColor
Definition seriesstyle.h:66
int pointLabelPrecision
Definition seriesstyle.h:73
qreal markerSize
Definition seriesstyle.h:64
Qt::PenJoinStyle joinStyle
Definition seriesstyle.h:59
bool showLine
Definition seriesstyle.h:55
QColor pointLabelColor
Definition seriesstyle.h:72
MarkerShape shape
Definition seriesstyle.h:63
bool showPointLabels
Definition seriesstyle.h:70
qreal opacity
Definition seriesstyle.h:51
QColor markerFillColor
Definition seriesstyle.h:65
qreal lineWidth
Definition seriesstyle.h:56
bool showMarkers
Definition seriesstyle.h:62
Qt::PenCapStyle capStyle
Definition seriesstyle.h:58