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
singlesymbolrenderer.h
Go to the documentation of this file.
1
17#ifndef OPENSWMM_RENDER_SINGLESYMBOLRENDERER_H
18#define OPENSWMM_RENDER_SINGLESYMBOLRENDERER_H
19
20#include "render/datadefined.h"
22
23namespace OpenSWMM::Render
24{
25
31{
32public:
34 explicit SingleSymbolRenderer(SymbolStyle symbol, QString label = {});
35 ~SingleSymbolRenderer() override = default;
36
40 [[nodiscard]] const SymbolStyle &symbol() const { return m_symbol; }
42
46 [[nodiscard]] const QString &legendLabel() const { return m_legendLabel; }
47 void setLegendLabel(QString label) { m_legendLabel = std::move(label); }
48
57 [[nodiscard]] const DataDefinedScalar &sizeData() const { return m_sizeData; }
58 void setSizeData(DataDefinedScalar d) { m_sizeData = std::move(d); }
59
60 // IFeatureRenderer.
61 [[nodiscard]] QString rendererId() const override { return QStringLiteral("single"); }
62 [[nodiscard]] SymbolStyle symbolFor(const FeatureRef &f,
63 const QVariantMap &attrs) const override;
64 [[nodiscard]] QList<LegendSymbolItem> legendSymbolItems() const override;
65 [[nodiscard]] QJsonObject toJson() const override;
66 void fromJson(const QJsonObject &j) override;
67 [[nodiscard]] std::unique_ptr<IFeatureRenderer> clone() const override;
68
69 // ── Per-class editing (Slice BB Phase 8.6.16) ──────────────────────
70 // Only one class ("single"). All four kinds mutate the stored m_symbol
71 // directly — there is no override hash because there is only one row.
72 [[nodiscard]] bool supportsClassEdit(ClassEditKind /*kind*/) const override { return true; }
73 [[nodiscard]] QColor colorForClass(const QString &classKey) const override;
74 [[nodiscard]] qreal sizeForClass(const QString &classKey) const override;
75 void setColorForClass(const QString &classKey, const QColor &color) override;
76 void setSizeForClass(const QString &classKey, qreal size) override;
77 void setWidthForClass(const QString &classKey, qreal width) override;
78 void setSymbolForClass(const QString &classKey, const SymbolStyle &style) override;
79
80private:
81 SymbolStyle m_symbol;
82 QString m_legendLabel;
83 DataDefinedScalar m_sizeData;
84};
85
86} // namespace OpenSWMM::Render
87
88#endif // OPENSWMM_RENDER_SINGLESYMBOLRENDERER_H
Abstract interface — every vector layer's paint path goes here.
Definition ifeaturerenderer.h:85
One SymbolStyle for the whole layer.
Definition singlesymbolrenderer.h:31
QList< LegendSymbolItem > legendSymbolItems() const override
Returns one LegendSymbolItem per visible legend row. Drives the legend dock, the on-canvas legend ove...
Definition singlesymbolrenderer.cpp:49
void setSymbol(SymbolStyle s)
Definition singlesymbolrenderer.cpp:20
qreal sizeForClass(const QString &classKey) const override
Read the current marker / line size for classKey. Returns a negative value when the renderer has no e...
Definition singlesymbolrenderer.cpp:113
void setLegendLabel(QString label)
Definition singlesymbolrenderer.h:47
std::unique_ptr< IFeatureRenderer > clone() const override
Deep copy. Owning layers / map presets / undo stack call this when they need a renderer snapshot deco...
Definition singlesymbolrenderer.cpp:81
const QString & legendLabel() const
Label drawn next to the swatch in the legend (default "").
Definition singlesymbolrenderer.h:46
void setSizeData(DataDefinedScalar d)
Definition singlesymbolrenderer.h:58
SymbolStyle symbolFor(const FeatureRef &f, const QVariantMap &attrs) const override
Returns the SymbolStyle to paint for one feature.
Definition singlesymbolrenderer.cpp:25
QString rendererId() const override
Stable string id ("single", "graduated", "categorized", "rule"). Used as the discriminator in JSON ro...
Definition singlesymbolrenderer.h:61
void setWidthForClass(const QString &classKey, qreal width) override
Override the line width for classKey. No-op when supportsClassEdit(Width) is false.
Definition singlesymbolrenderer.cpp:140
void fromJson(const QJsonObject &j) override
Restores this renderer from a JSON object previously produced by toJson(). Implementations should tol...
Definition singlesymbolrenderer.cpp:71
QColor colorForClass(const QString &classKey) const override
Read the current colour for classKey. Returns an invalid QColor when the renderer has no explicit val...
Definition singlesymbolrenderer.cpp:105
bool supportsClassEdit(ClassEditKind) const override
True if this renderer can mutate kind on a per-class basis. Defaults to false so opt-in is explicit.
Definition singlesymbolrenderer.h:72
const DataDefinedScalar & sizeData() const
Slice BI Phase 8.13.43-α — data-defined size/width override. When set, symbolFor evaluates the overri...
Definition singlesymbolrenderer.h:57
void setSizeForClass(const QString &classKey, qreal size) override
Override the marker size for classKey (points / squares / triangles…). No-op when supportsClassEdit(S...
Definition singlesymbolrenderer.cpp:134
const SymbolStyle & symbol() const
The single style applied to every feature.
Definition singlesymbolrenderer.h:40
QJsonObject toJson() const override
Serialises this renderer to a JSON object. The "id" field equals rendererId(); remaining keys are ren...
Definition singlesymbolrenderer.cpp:59
void setColorForClass(const QString &classKey, const QColor &color) override
Override the colour for the class identified by classKey. Has no effect when supportsClassEdit(Color)...
Definition singlesymbolrenderer.cpp:128
void setSymbolForClass(const QString &classKey, const SymbolStyle &style) override
Wholesale-replace the SymbolStyle for classKey. No-op when supportsClassEdit(Symbol) is false.
Definition singlesymbolrenderer.cpp:146
Slice BI Phase 8.13.7-α / 8.13.43-α — typed-struct carve-out of the BI.2 string-expression data-defin...
const char * label
Human label for the filter entry.
Definition gdaldrivers.cpp:22
The single seam every layer paint path goes through.
double s
Scene px per model length unit.
Definition inletdrawingview.cpp:82
Definition gisrasterlayer.h:40
ClassEditKind
Categories of per-class mutation that a renderer may support.
Definition ifeaturerenderer.h:64
Maps one numeric attribute to a scalar output range.
Definition datadefined.h:57
Identifies one feature in one layer for the renderer pipeline.
Definition featureref.h:35
Stack of SymbolLayer paint passes (bottom-up) plus an overall opacity.
Definition symbolstyle.h:39