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
multibandcolorrenderer.h
Go to the documentation of this file.
1
20#ifndef OPENSWMM_RENDER_MULTIBANDCOLORRENDERER_H
21#define OPENSWMM_RENDER_MULTIBANDCOLORRENDERER_H
22
24
25namespace OpenSWMM::Render
26{
27
33{
34public:
37 MultiBandColorRenderer(int red, int green, int blue, int alpha = 0);
38 ~MultiBandColorRenderer() override = default;
39
40 [[nodiscard]] int redBand() const { return m_red; }
41 [[nodiscard]] int greenBand() const { return m_green; }
42 [[nodiscard]] int blueBand() const { return m_blue; }
43 [[nodiscard]] int alphaBand() const { return m_alpha; }
44 void setBands(int red, int green, int blue, int alpha = 0);
45
46 // IRasterRenderer.
47 [[nodiscard]] QString rendererId() const override
48 {
49 return QStringLiteral("multibandcolor");
50 }
51 [[nodiscard]] QColor colorForValue(double value,
52 bool isNoData = false) const override;
53 [[nodiscard]] QList<LegendSymbolItem> legendSymbolItems() const override;
54 [[nodiscard]] QJsonObject toJson() const override;
55 void fromJson(const QJsonObject &j) override;
56 [[nodiscard]] std::unique_ptr<IRasterRenderer> clone() const override;
57
58private:
59 int m_red = 1;
60 int m_green = 2;
61 int m_blue = 3;
62 int m_alpha = 0;
63};
64
65} // namespace OpenSWMM::Render
66
67#endif // OPENSWMM_RENDER_MULTIBANDCOLORRENDERER_H
Abstract interface — every raster layer's paint path goes here.
Definition irasterrenderer.h:66
RGB(A) composite from three (or four) raster bands.
Definition multibandcolorrenderer.h:33
QList< LegendSymbolItem > legendSymbolItems() const override
Returns one LegendSymbolItem per visible legend row. Drives the legend dock, the on-canvas legend ove...
Definition multibandcolorrenderer.cpp:39
QJsonObject toJson() const override
Serialises this renderer to a JSON object. The "id" field equals rendererId(); remaining keys are ren...
Definition multibandcolorrenderer.cpp:51
std::unique_ptr< IRasterRenderer > clone() const override
Deep copy. Owning layers / map presets / undo stack call this when they need a renderer snapshot deco...
Definition multibandcolorrenderer.cpp:70
QColor colorForValue(double value, bool isNoData=false) const override
Returns the display colour for one raw pixel value.
Definition multibandcolorrenderer.cpp:32
int greenBand() const
Definition multibandcolorrenderer.h:41
void fromJson(const QJsonObject &j) override
Restores this renderer from a JSON object previously produced by toJson(). Implementations should tol...
Definition multibandcolorrenderer.cpp:62
int redBand() const
Definition multibandcolorrenderer.h:40
QString rendererId() const override
Stable string id ("singlebandpseudocolor", "singlebandgray", "paletted", "hillshade",...
Definition multibandcolorrenderer.h:47
int blueBand() const
Definition multibandcolorrenderer.h:42
int alphaBand() const
Definition multibandcolorrenderer.h:43
void setBands(int red, int green, int blue, int alpha=0)
Definition multibandcolorrenderer.cpp:24
Sister interface to IFeatureRenderer for single-band raster layers.
Definition gisrasterlayer.h:40