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
annotationtextitem.h
Go to the documentation of this file.
1
14#ifndef OPENSWMMVIS_LAYERS_ANNOTATIONTEXTITEM_H
15#define OPENSWMMVIS_LAYERS_ANNOTATIONTEXTITEM_H
16
17#include <QColor>
18#include <QFont>
19#include <QJsonObject>
20#include <QObject>
21#include <QString>
22#include <QUuid>
23
33class AnnotationTextItem : public QObject
34{
35 Q_OBJECT
36
40 /*\@{*/
41 Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
42 /*\@}*/
43
44
50 /*\@{*/
51 Q_PROPERTY(double x READ x WRITE setX NOTIFY positionChanged)
52 Q_PROPERTY(double y READ y WRITE setY NOTIFY positionChanged)
53 Q_PROPERTY(double rotation READ rotation WRITE setRotation NOTIFY rotationChanged)
54 /*\@}*/
55
59 /*\@{*/
60 Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
61 Q_PROPERTY(QColor fillColor READ fillColor WRITE setFillColor NOTIFY fillColorChanged)
62 /*\@}*/
63
67 /*\@{*/
69 Q_PROPERTY(QColor outlineColor READ outlineColor WRITE setOutlineColor NOTIFY outlineColorChanged)
70 Q_PROPERTY(double outlineWidth READ outlineWidth WRITE setOutlineWidth NOTIFY outlineWidthChanged)
71 /*\@}*/
72
76 /*\@{*/
77 Q_PROPERTY(bool haloEnabled READ haloEnabled WRITE setHaloEnabled NOTIFY haloEnabledChanged)
78 Q_PROPERTY(QColor haloColor READ haloColor WRITE setHaloColor NOTIFY haloColorChanged)
79 Q_PROPERTY(double haloRadius READ haloRadius WRITE setHaloRadius NOTIFY haloRadiusChanged)
80 /*\@}*/
81
85 /*\@{*/
92 /*\@}*/
93
94public:
95 explicit AnnotationTextItem(QObject *parent = nullptr);
96 ~AnnotationTextItem() override = default;
97
100 [[nodiscard]] QString id() const { return m_id; }
101
103 void setId(const QString &id) { m_id = id; }
104
105 // ----- Getters -----------------------------------------------------------
106 [[nodiscard]] QString text() const { return m_text; }
107 [[nodiscard]] double x() const { return m_x; }
108 [[nodiscard]] double y() const { return m_y; }
109 [[nodiscard]] double rotation() const { return m_rotation; }
110 [[nodiscard]] QFont font() const { return m_font; }
111 [[nodiscard]] QColor fillColor() const { return m_fillColor; }
112
113 [[nodiscard]] bool outlineEnabled() const { return m_outlineEnabled; }
114 [[nodiscard]] QColor outlineColor() const { return m_outlineColor; }
115 [[nodiscard]] double outlineWidth() const { return m_outlineWidth; }
116
117 [[nodiscard]] bool haloEnabled() const { return m_haloEnabled; }
118 [[nodiscard]] QColor haloColor() const { return m_haloColor; }
119 [[nodiscard]] double haloRadius() const { return m_haloRadius; }
120
121 [[nodiscard]] bool backgroundEnabled() const { return m_bgEnabled; }
122 [[nodiscard]] QColor backgroundFillColor() const { return m_bgFill; }
123 [[nodiscard]] QColor backgroundOutlineColor() const { return m_bgOutline; }
124 [[nodiscard]] double backgroundOutlineWidth() const { return m_bgOutlineWidth; }
125 [[nodiscard]] double backgroundPadding() const { return m_bgPadding; }
126 [[nodiscard]] double backgroundCornerRadius() const { return m_bgCornerRadius; }
127
129 [[nodiscard]] QJsonObject toJson() const;
130
134 void fromJson(const QJsonObject &obj);
135
136public slots:
137 void setText(const QString &t);
138 void setX(double v);
139 void setY(double v);
140 void setPosition(double x, double y);
141 void setRotation(double deg);
142 void setFont(const QFont &f);
143 void setFillColor(const QColor &c);
144
145 void setOutlineEnabled(bool on);
146 void setOutlineColor(const QColor &c);
147 void setOutlineWidth(double w);
148
149 void setHaloEnabled(bool on);
150 void setHaloColor(const QColor &c);
151 void setHaloRadius(double r);
152
153 void setBackgroundEnabled(bool on);
154 void setBackgroundFillColor(const QColor &c);
155 void setBackgroundOutlineColor(const QColor &c);
156 void setBackgroundOutlineWidth(double w);
157 void setBackgroundPadding(double p);
158 void setBackgroundCornerRadius(double r);
159
160signals:
161 void textChanged(const QString &);
163 void rotationChanged(double);
164 void fontChanged(const QFont &);
165 void fillColorChanged(const QColor &);
166
168 void outlineColorChanged(const QColor &);
170
172 void haloColorChanged(const QColor &);
173 void haloRadiusChanged(double);
174
176 void backgroundFillColorChanged(const QColor &);
177 void backgroundOutlineColorChanged(const QColor &);
181
185 void changed();
186
187private:
188 QString m_id;
189 QString m_text = QStringLiteral("Text");
190 double m_x = 0.0;
191 double m_y = 0.0;
192 double m_rotation = 0.0;
193
194 QFont m_font;
195 QColor m_fillColor = Qt::black;
196
197 bool m_outlineEnabled = false;
198 QColor m_outlineColor = Qt::white;
199 double m_outlineWidth = 1.0;
200
201 bool m_haloEnabled = true;
202 QColor m_haloColor = QColor(255, 255, 255, 220);
203 double m_haloRadius = 2.0;
204
205 bool m_bgEnabled = false;
206 QColor m_bgFill = QColor(255, 255, 255, 200);
207 QColor m_bgOutline = QColor(80, 80, 80, 255);
208 double m_bgOutlineWidth = 1.0;
209 double m_bgPadding = 4.0;
210 double m_bgCornerRadius = 3.0;
211};
212
213#endif // OPENSWMMVIS_LAYERS_ANNOTATIONTEXTITEM_H
Data model for a single styled text annotation.
Definition annotationtextitem.h:34
void setBackgroundFillColor(const QColor &c)
Definition annotationtextitem.cpp:216
QColor backgroundFillColor
Definition annotationtextitem.h:87
void setRotation(double deg)
Definition annotationtextitem.cpp:136
double x() const
Definition annotationtextitem.h:107
double rotation() const
Definition annotationtextitem.h:109
double x
Definition annotationtextitem.h:51
void setHaloRadius(double r)
Definition annotationtextitem.cpp:200
QFont font() const
Definition annotationtextitem.h:110
void setPosition(double x, double y)
Definition annotationtextitem.cpp:127
void setId(const QString &id)
Definition annotationtextitem.h:103
double backgroundOutlineWidth
Definition annotationtextitem.h:89
QColor haloColor() const
Definition annotationtextitem.h:118
void setOutlineColor(const QColor &c)
Definition annotationtextitem.cpp:168
double y() const
Definition annotationtextitem.h:108
void setOutlineWidth(double w)
Definition annotationtextitem.cpp:176
void fromJson(const QJsonObject &obj)
Definition annotationtextitem.cpp:64
void backgroundPaddingChanged(double)
void haloColorChanged(const QColor &)
QColor outlineColor() const
Definition annotationtextitem.h:114
double backgroundOutlineWidth() const
Definition annotationtextitem.h:124
QString text() const
Definition annotationtextitem.h:106
void setHaloEnabled(bool on)
Definition annotationtextitem.cpp:184
QColor fillColor() const
Definition annotationtextitem.h:111
void rotationChanged(double)
void backgroundOutlineWidthChanged(double)
void setBackgroundEnabled(bool on)
Definition annotationtextitem.cpp:208
void setY(double v)
Definition annotationtextitem.cpp:119
double haloRadius() const
Definition annotationtextitem.h:119
void textChanged(const QString &)
QFont font
Definition annotationtextitem.h:60
void setBackgroundCornerRadius(double r)
Definition annotationtextitem.cpp:248
void backgroundFillColorChanged(const QColor &)
double rotation
Definition annotationtextitem.h:53
void fillColorChanged(const QColor &)
QColor fillColor
Definition annotationtextitem.h:61
void setBackgroundOutlineColor(const QColor &c)
Definition annotationtextitem.cpp:224
QColor haloColor
Definition annotationtextitem.h:78
bool haloEnabled
Definition annotationtextitem.h:77
bool haloEnabled() const
Definition annotationtextitem.h:117
bool outlineEnabled
Definition annotationtextitem.h:68
double haloRadius
Definition annotationtextitem.h:79
double backgroundPadding
Definition annotationtextitem.h:90
void setBackgroundOutlineWidth(double w)
Definition annotationtextitem.cpp:232
bool backgroundEnabled
Definition annotationtextitem.h:86
QString text
Definition annotationtextitem.h:41
void setBackgroundPadding(double p)
Definition annotationtextitem.cpp:240
void outlineEnabledChanged(bool)
void backgroundOutlineColorChanged(const QColor &)
void outlineWidthChanged(double)
void backgroundCornerRadiusChanged(double)
void setOutlineEnabled(bool on)
Definition annotationtextitem.cpp:160
double backgroundPadding() const
Definition annotationtextitem.h:125
void outlineColorChanged(const QColor &)
void backgroundEnabledChanged(bool)
void setFillColor(const QColor &c)
Definition annotationtextitem.cpp:152
bool backgroundEnabled() const
Definition annotationtextitem.h:121
QColor backgroundOutlineColor() const
Definition annotationtextitem.h:123
double outlineWidth
Definition annotationtextitem.h:70
void haloEnabledChanged(bool)
bool outlineEnabled() const
Definition annotationtextitem.h:113
void setX(double v)
Definition annotationtextitem.cpp:111
double backgroundCornerRadius
Definition annotationtextitem.h:91
QJsonObject toJson() const
Definition annotationtextitem.cpp:35
double y
Definition annotationtextitem.h:52
QString id() const
Definition annotationtextitem.h:100
double outlineWidth() const
Definition annotationtextitem.h:115
void fontChanged(const QFont &)
void setFont(const QFont &f)
Definition annotationtextitem.cpp:144
QColor backgroundOutlineColor
Definition annotationtextitem.h:88
void setText(const QString &t)
Definition annotationtextitem.cpp:103
void setHaloColor(const QColor &c)
Definition annotationtextitem.cpp:192
void haloRadiusChanged(double)
QColor backgroundFillColor() const
Definition annotationtextitem.h:122
double backgroundCornerRadius() const
Definition annotationtextitem.h:126
QColor outlineColor
Definition annotationtextitem.h:69
DiagramType t
Definition diagramspec.cpp:20
ArrowPlacement p
Definition linesymbollayer.cpp:27
int w
Definition mesh2dresultsexport.cpp:387
QVector< int > v
pool vertex indices
Definition pslgminsize.cpp:159
QVector< int > parent
union-find
Definition pslgminsize.cpp:176