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
labelpainter.h
Go to the documentation of this file.
1
21#ifndef OPENSWMM_RENDER_LABELPAINTER_H
22#define OPENSWMM_RENDER_LABELPAINTER_H
23
24#include "render/labelconfig.h"
25
26#include <QPointF>
27#include <QRectF>
28#include <QSizeF>
29#include <QString>
30
31class QPainter;
32
33namespace OpenSWMM::Render
34{
35
41{
42public:
50 [[nodiscard]] static bool scaleVisible(const LabelConfig &cfg,
51 double scaleDenominator);
52
58 [[nodiscard]] static QPointF placementOffset(const LabelConfig &cfg,
59 const QSizeF &textSize);
60
65 [[nodiscard]] static QRectF labelRect(const LabelConfig &cfg,
66 const QPointF &anchor,
67 const QSizeF &textSize);
68
76 static void drawLabel(QPainter &p, const QPointF &topLeft,
77 const QString &text, const LabelConfig &cfg);
78
84 static QRectF drawLabelAt(QPainter &p, const QPointF &anchor,
85 const QString &text, const LabelConfig &cfg);
86};
87
88} // namespace OpenSWMM::Render
89
90#endif // OPENSWMM_RENDER_LABELPAINTER_H
Stateless label-drawing helpers shared by every paint path.
Definition labelpainter.h:41
static void drawLabel(QPainter &p, const QPointF &topLeft, const QString &text, const LabelConfig &cfg)
Draw text with the TOP-LEFT of its box at topLeft (screen px), using cfg.effectiveFont(): background ...
Definition labelpainter.cpp:55
static bool scaleVisible(const LabelConfig &cfg, double scaleDenominator)
Whether a label is visible at the given canvas scale denominator (the "1:N" map scale)....
Definition labelpainter.cpp:20
static QRectF labelRect(const LabelConfig &cfg, const QPointF &anchor, const QSizeF &textSize)
The text box rect (screen px) placed at anchor per the configured placement. Top-left = anchor + plac...
Definition labelpainter.cpp:49
static QPointF placementOffset(const LabelConfig &cfg, const QSizeF &textSize)
Offset (screen px) from the feature anchor to the TOP-LEFT of the text box for the configured placeme...
Definition labelpainter.cpp:33
static QRectF drawLabelAt(QPainter &p, const QPointF &anchor, const QString &text, const LabelConfig &cfg)
Convenience overload — places the text at anchor per the configured placement and draws it....
Definition labelpainter.cpp:98
Shared label-configuration value-type used by every layer that paints text labels.
ArrowPlacement p
Definition linesymbollayer.cpp:27
Definition gisrasterlayer.h:40
QString text
Definition queryparser.cpp:35
Per-layer label rendering parameters.
Definition labelconfig.h:47