23#ifndef OPENSWMM_RENDER_CATEGORIZEDRENDERER_H
24#define OPENSWMM_RENDER_CATEGORIZEDRENDERER_H
63 [[nodiscard]]
const QList<Category> &
categories()
const {
return m_categories; }
75 [[nodiscard]] QString
rendererId()
const override {
return QStringLiteral(
"categorized"); }
77 const QVariantMap &attrs)
const override;
79 [[nodiscard]] QJsonObject
toJson()
const override;
80 void fromJson(
const QJsonObject &j)
override;
81 [[nodiscard]] std::unique_ptr<IFeatureRenderer>
clone()
const override;
93 [[nodiscard]] QColor
colorForClass(
const QString &classKey)
const override;
94 void setColorForClass(
const QString &classKey,
const QColor &color)
override;
98 QString m_classifyAttribute;
99 QList<Category> m_categories;
Distinct symbol per unique value of a string / enum attribute.
Definition categorizedrenderer.h:41
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 categorizedrenderer.cpp:95
const QList< Category > & categories() const
Definition categorizedrenderer.h:63
void setCategories(QList< Category > cats)
Definition categorizedrenderer.cpp:17
void setFallbackSymbol(SymbolStyle s)
Definition categorizedrenderer.h:72
QString rendererId() const override
Stable string id ("single", "graduated", "categorized", "rule"). Used as the discriminator in JSON ro...
Definition categorizedrenderer.h:75
void setClassifyAttribute(QString name)
Definition categorizedrenderer.h:61
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 categorizedrenderer.cpp:112
QList< LegendSymbolItem > legendSymbolItems() const override
Returns one LegendSymbolItem per visible legend row. Drives the legend dock, the on-canvas legend ove...
Definition categorizedrenderer.cpp:38
SymbolStyle symbolFor(const FeatureRef &f, const QVariantMap &attrs) const override
Returns the SymbolStyle to paint for one feature.
Definition categorizedrenderer.cpp:27
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 categorizedrenderer.cpp:102
~CategorizedRenderer() override=default
bool supportsClassEdit(ClassEditKind kind) const override
True if this renderer can mutate kind on a per-class basis. Defaults to false so opt-in is explicit.
Definition categorizedrenderer.h:89
QString classifyAttribute() const
Name of the attribute key (in QVariantMap attrs) to look up.
Definition categorizedrenderer.h:60
void setSymbolForClass(const QString &classKey, const SymbolStyle &style) override
Wholesale-replace the SymbolStyle for classKey. No-op when supportsClassEdit(Symbol) is false.
Definition categorizedrenderer.cpp:121
void addCategory(Category c)
Definition categorizedrenderer.cpp:22
CategorizedRenderer()=default
QJsonObject toJson() const override
Serialises this renderer to a JSON object. The "id" field equals rendererId(); remaining keys are ren...
Definition categorizedrenderer.cpp:56
const SymbolStyle & fallbackSymbol() const
Symbol returned when a feature's attribute value does not match any category. Defaults to an empty Sy...
Definition categorizedrenderer.h:71
void fromJson(const QJsonObject &j) override
Restores this renderer from a JSON object previously produced by toJson(). Implementations should tol...
Definition categorizedrenderer.cpp:77
Abstract interface — every vector layer's paint path goes here.
Definition ifeaturerenderer.h:85
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
TokenKind kind
Definition queryparser.cpp:34
QString name
Definition sectionmodelbuilders.cpp:474
One named category and its symbol.
Definition categorizedrenderer.h:48
SymbolStyle symbol
Definition categorizedrenderer.h:51
QString value
Definition categorizedrenderer.h:49
QString label
Definition categorizedrenderer.h:50
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