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
labelconfig.h
Go to the documentation of this file.
1
18#ifndef OPENSWMM_RENDER_LABELCONFIG_H
19#define OPENSWMM_RENDER_LABELCONFIG_H
20
21#include <QColor>
22#include <QFont>
23#include <QJsonObject>
24#include <QString>
25
26namespace OpenSWMM::Render {
27
47{
49 bool enabled = false;
50
55 QString fieldName;
56
63 QString expression;
64
66 QFont font;
67
70 qreal fontSizePt = 9.0;
71
73 QColor color = QColor(20, 20, 20);
74
79 bool haloEnabled = false;
80 QColor haloColor = QColor(255, 255, 255);
81 qreal haloRadiusPx = 1.5;
82
94
101 double minScale = 0.0;
102 double maxScale = 0.0;
103
109 bool backgroundEnabled = false;
110 QColor backgroundColor = QColor(255, 255, 255, 200);
113
121
122 [[nodiscard]] QJsonObject toJson() const;
123 void fromJson(const QJsonObject &j);
124
126 [[nodiscard]] bool isValid() const { return fontSizePt > 0.0; }
127
131 [[nodiscard]] QFont effectiveFont() const
132 {
133 QFont f = font;
134 f.setPointSizeF(fontSizePt);
135 return f;
136 }
137};
138
139inline bool operator==(const LabelConfig &a, const LabelConfig &b)
140{
141 return a.enabled == b.enabled
142 && a.fieldName == b.fieldName
143 && a.expression == b.expression
144 && a.font == b.font
145 && qFuzzyCompare(a.fontSizePt, b.fontSizePt)
146 && a.color == b.color
147 && a.haloEnabled == b.haloEnabled
148 && a.haloColor == b.haloColor
149 && qFuzzyCompare(a.haloRadiusPx, b.haloRadiusPx)
150 && a.placement == b.placement
151 && qFuzzyCompare(a.minScale, b.minScale)
152 && qFuzzyCompare(a.maxScale, b.maxScale)
153 && a.backgroundEnabled == b.backgroundEnabled
154 && a.backgroundColor == b.backgroundColor
155 && qFuzzyCompare(a.backgroundPaddingPx, b.backgroundPaddingPx)
156 && qFuzzyCompare(a.backgroundRadiusPx, b.backgroundRadiusPx)
157 && a.priorityField == b.priorityField;
158}
159inline bool operator!=(const LabelConfig &a, const LabelConfig &b) { return !(a == b); }
160
161} // namespace OpenSWMM::Render
162
163#endif // OPENSWMM_RENDER_LABELCONFIG_H
int b
local residual indices, a < b
Definition meshquadmatch.cpp:46
int a
Definition meshquadmatch.cpp:46
Definition gisrasterlayer.h:40
bool operator==(const BasemapRenderParams &a, const BasemapRenderParams &b)
Definition basemaprenderparams.h:67
bool operator!=(const BasemapRenderParams &a, const BasemapRenderParams &b)
Definition basemaprenderparams.h:74
Per-layer label rendering parameters.
Definition labelconfig.h:47
Placement placement
Definition labelconfig.h:93
bool backgroundEnabled
Definition labelconfig.h:109
bool enabled
Definition labelconfig.h:49
QColor haloColor
Definition labelconfig.h:80
QFont font
Definition labelconfig.h:66
QColor color
Definition labelconfig.h:73
QJsonObject toJson() const
Definition labelconfig.cpp:13
double maxScale
Definition labelconfig.h:102
qreal fontSizePt
Definition labelconfig.h:70
double minScale
Definition labelconfig.h:101
void fromJson(const QJsonObject &j)
Definition labelconfig.cpp:46
Placement
Where the label sits relative to the feature anchor.
Definition labelconfig.h:85
@ Centre
Definition labelconfig.h:91
@ Below
Definition labelconfig.h:88
@ Left
Definition labelconfig.h:89
@ AutoPlacement
Definition labelconfig.h:86
@ Right
Definition labelconfig.h:90
@ Above
Definition labelconfig.h:87
bool isValid() const
Definition labelconfig.h:126
qreal backgroundRadiusPx
Definition labelconfig.h:112
QFont effectiveFont() const
Build a QFont with our fontSizePt applied. Helpers cache this so the paint loop doesn't reconstruct i...
Definition labelconfig.h:131
QString expression
Definition labelconfig.h:63
qreal haloRadiusPx
Definition labelconfig.h:81
QString fieldName
Definition labelconfig.h:55
bool haloEnabled
Definition labelconfig.h:79
QColor backgroundColor
Definition labelconfig.h:110
QString priorityField
Definition labelconfig.h:120
qreal backgroundPaddingPx
Definition labelconfig.h:111