26#ifndef OPENSWMM_RENDER_SINGLEBANDPSEUDOCOLORRENDERER_H
27#define OPENSWMM_RENDER_SINGLEBANDPSEUDOCOLORRENDERER_H
49 using Stop = QPair<double, QColor>;
60 [[nodiscard]]
double minValue()
const {
return m_minValue; }
61 [[nodiscard]]
double maxValue()
const {
return m_maxValue; }
68 [[nodiscard]]
const QList<Stop> &
stops()
const {
return m_stops; }
75 [[nodiscard]]
bool clampMin()
const {
return m_clampMin; }
82 [[nodiscard]]
bool clampMax()
const {
return m_clampMax; }
97 return QStringLiteral(
"singlebandpseudocolor");
100 bool isNoData =
false)
const override;
102 [[nodiscard]] QJsonObject
toJson()
const override;
103 void fromJson(
const QJsonObject &j)
override;
104 [[nodiscard]] std::unique_ptr<IRasterRenderer>
clone()
const override;
107 double m_minValue = 0.0;
108 double m_maxValue = 1.0;
110 bool m_clampMin =
false;
111 bool m_clampMax =
false;
Abstract interface — every raster layer's paint path goes here.
Definition irasterrenderer.h:66
Continuous colour ramp for single-band raster data.
Definition singlebandpseudocolorrenderer.h:44
SingleBandPseudoColorRenderer()=default
bool clampMin() const
When true, values strictly below minValue render as transparent instead of clamping to the first stop...
Definition singlebandpseudocolorrenderer.h:75
QList< LegendSymbolItem > legendSymbolItems() const override
Returns one LegendSymbolItem per visible legend row. Drives the legend dock, the on-canvas legend ove...
Definition singlebandpseudocolorrenderer.cpp:200
QJsonObject toJson() const override
Serialises this renderer to a JSON object. The "id" field equals rendererId(); remaining keys are ren...
Definition singlebandpseudocolorrenderer.cpp:225
QColor colorForValue(double value, bool isNoData=false) const override
Returns the display colour for one raw pixel value.
Definition singlebandpseudocolorrenderer.cpp:144
double minValue() const
The numeric range covered by the ramp. Values outside [minValue, maxValue] are clamped to the nearest...
Definition singlebandpseudocolorrenderer.h:60
void setClampMin(bool clamp)
Definition singlebandpseudocolorrenderer.h:76
~SingleBandPseudoColorRenderer() override=default
void setRange(double minValue, double maxValue)
Definition singlebandpseudocolorrenderer.cpp:133
void setStops(QList< Stop > stops)
Definition singlebandpseudocolorrenderer.cpp:139
QPair< double, QColor > Stop
One ramp stop — a normalised position in [0,1] paired with a colour.
Definition singlebandpseudocolorrenderer.h:49
QString rendererId() const override
Stable string id ("singlebandpseudocolor", "singlebandgray", "paletted", "hillshade",...
Definition singlebandpseudocolorrenderer.h:95
void fromJson(const QJsonObject &j) override
Restores this renderer from a JSON object previously produced by toJson(). Implementations should tol...
Definition singlebandpseudocolorrenderer.cpp:238
const QList< Stop > & stops() const
Stops in ascending-position order. Callers must keep this invariant; setStops() does not sort.
Definition singlebandpseudocolorrenderer.h:68
double maxValue() const
Definition singlebandpseudocolorrenderer.h:61
void setClampMax(bool clamp)
Definition singlebandpseudocolorrenderer.h:83
void setInterp(RampInterp i)
Definition singlebandpseudocolorrenderer.h:92
bool clampMax() const
When true, values strictly above maxValue render as transparent instead of clamping to the last stop'...
Definition singlebandpseudocolorrenderer.h:82
RampInterp interp() const
Colour-space used between adjacent stops (Rgb / HsvShort / HsvLong). Carried so the renderer reproduc...
Definition singlebandpseudocolorrenderer.h:91
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 singlebandpseudocolorrenderer.cpp:249
RasterColorRamp — gradient mapping from a normalised value in [0,1] to a display QColor.
RampInterp
Colour-space used when interpolating between two adjacent ramp stops.
Definition colorramp.h:60
size_t i
Definition contourjob.cpp:27
Sister interface to IFeatureRenderer for single-band raster layers.
Definition gisrasterlayer.h:40