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
colorramp.h File Reference

RasterColorRamp — gradient mapping from a normalised value in [0,1] to a display QColor. More...

#include <QColor>
#include <QGradientStops>
#include <QJsonObject>
#include <QMetaType>
#include <QString>
#include <QStringList>
Include dependency graph for colorramp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  RasterColorRamp
 Gradient mapping from a normalised value in [0,1] to a QColor. More...
 

Enumerations

enum class  RampInterp : int {
  Rgb = 0 ,
  HsvShort = 1 ,
  HsvLong = 2
}
 Colour-space used when interpolating between two adjacent ramp stops. More...
 

Detailed Description

RasterColorRamp — gradient mapping from a normalised value in [0,1] to a display QColor.

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
Date
2026
License\n GPL-3.0-or-later

Slice BB-α (2026-05-24): the struct's previous home was layers/gisrasterlayer.h; it has been relocated here so any code that needs a ramp (raster rendering, GraduatedRenderer, the color-ramp combobox / editor) can include it without pulling in GDAL transitively. The struct stays at global scope to keep the ~20 existing call sites (Q_DECLARE_METATYPE, GISRasterLayer, SWMMResultsLayer, ColorRampEditorDialog, …) compiling unchanged.

Extensions over the previous form:

  • interp field selects RGB vs HSV-short-arc vs HSV-long-arc interpolation between adjacent stops. Defaults to RGB to preserve existing built-in visuals; the editor sets HSV-short as the default for user-authored ramps per user request.
  • 12 built-in named ramps reachable via builtin(name) — Viridis / Plasma / Magma / Inferno / Cividis / Turbo / RdBu / RdYlGn / Spectral / BrBG / legacy-SWMM-5interval / legacy-SWMM-pollutant. Plus the pre-existing grayscale and viridis static factories.
  • toJson / fromJson round-trip for .oswp persistence and for the PreferencesManager custom-ramp library.

Cross-slice: GUI_IMPLEMENTATION_PLAN.md §L.BB-α.

Enumeration Type Documentation

◆ RampInterp

enum class RampInterp : int
strong

Colour-space used when interpolating between two adjacent ramp stops.

  • Rgb — linear interpolation in RGBA-F. Standard for published palettes (Viridis, Plasma, etc.) whose RGB tuples were authored assuming RGB interpolation between them. Default for built-in ramps.
  • HsvShort — interpolate in HSV space, taking the shorter arc on the hue wheel (e.g. red → blue goes via magenta, not via green). Saturation and value interpolate linearly. Default for user-authored custom ramps per the Slice BB-α user request — produces smoother transitions when the stops are chosen by hand rather than from a perceptually-tuned LUT.
  • HsvLong — interpolate via the longer arc on the hue wheel. Useful for rainbow-style ramps where the user wants to traverse the whole wheel between two stops.
Enumerator
Rgb 
HsvShort 
HsvLong