QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
Qwt3DStandardColor Class Reference

Standard color model for Qwt3DPlot - implements the data driven operator()(double x, double y, double z) More...

#include <qwt3d_color.h>

Inheritance diagram for Qwt3DStandardColor:
Qwt3DColor

Classes

class  PrivateData
 

Public Member Functions

 Qwt3DStandardColor (unsigned size=100)
 Constructs a Qwt3DStandardColor object.
 
RGBA operator() (double x, double y, double z) const override
 Returns the color for a given z value.
 
void setColorVector (ColorVector const &cv)
 Assigns a new ColorVector.
 
void reset (unsigned size=100)
 
void setAlpha (double a)
 Sets the alpha value for all colors.
 
ColorVector & createVector (ColorVector &vec) override
 Creates color vector for Qwt3DColorLegend - essentially a copy from the internal vector.
 
void setPreset (const QString &presetName, unsigned size=100)
 Set colormap from a preset name.
 
QString presetName () const
 返回当前 preset 名称
 
unsigned colorCount () const
 返回颜色向量中的颜色数量
 
double alpha () const
 返回上次 setAlpha() 设置的 alpha 值
 
- Public Member Functions inherited from Qwt3DColor
virtual RGBA operator() (Triple const &t) const
 
void destroy () const
 
void setActiveRange (double zMin, double zMax)
 Sets the active z-range used for color normalization (pushed by the owning Qwt3DPlotItem before VBO/legend build)
 

Additional Inherited Members

- Protected Member Functions inherited from Qwt3DColor
double activeZMin () const
 Lower bound of the active z-range (default 0.0)
 
double activeZMax () const
 Upper bound of the active z-range (default 1.0)
 

Detailed Description

Standard color model for Qwt3DPlot - implements the data driven operator()(double x, double y, double z)

The class has a ColorVector representing z values, which will be used by operator()(double x, double y, double z)

Constructor & Destructor Documentation

◆ Qwt3DStandardColor()

Qwt3DStandardColor::Qwt3DStandardColor ( unsigned  size = 100)
explicit

Constructs a Qwt3DStandardColor object.

Parameters
sizeNumber of color entries in the color vector

Creates a standard color mapping with the specified size and resets the color vector to default gradient values. The z-range used for color normalization is pushed in by the owning Qwt3DPlotItem via setActiveRange() (defaults to [0, 1] until set).

Resets the color vector to the default colormap

Parameters
sizeNumber of color entries to generate

Creates a color vector of the given size sampled from the viridis colormap, the modern perceptually-uniform default.

Member Function Documentation

◆ alpha()

double Qwt3DStandardColor::alpha ( ) const

返回上次 setAlpha() 设置的 alpha 值

Returns
alpha 值(0.0 ~ 1.0),默认 1.0

◆ colorCount()

unsigned Qwt3DStandardColor::colorCount ( ) const

返回颜色向量中的颜色数量

Returns
颜色数量

◆ createVector()

ColorVector & Qwt3DStandardColor::createVector ( ColorVector &  vec)
overridevirtual

Creates color vector for Qwt3DColorLegend - essentially a copy from the internal vector.

Parameters
vecThe vector to fill
Returns
Reference to the filled color vector

Reimplemented from Qwt3DColor.

◆ operator()()

RGBA Qwt3DStandardColor::operator() ( double  x,
double  y,
double  z 
) const
overridevirtual

Returns the color for a given z value.

Parameters
zThe z coordinate value for color lookup
Returns
RGBA color corresponding to the z value

Maps the z value to a color index based on the active z-range pushed in by the owning Qwt3DPlotItem via setActiveRange().

Implements Qwt3DColor.

◆ presetName()

QString Qwt3DStandardColor::presetName ( ) const

返回当前 preset 名称

Returns
preset 名称字符串,如果通过 setColorVector() 设置则返回空字符串

◆ setAlpha()

void Qwt3DStandardColor::setAlpha ( double  a)

Sets the alpha value for all colors.

Parameters
aAlpha value (0.0 to 1.0)

Silent mutation: call Qwt3DSurface::invalidateColors() to rebuild.

◆ setColorVector()

void Qwt3DStandardColor::setColorVector ( ColorVector const &  cv)

Assigns a new ColorVector.

Parameters
cvThe new color vector (also overwrites the constructor's size argument)

This is a silent mutation: the owning Qwt3DPlotItem is not notified. Call Qwt3DSurface::invalidateColors() afterwards to trigger a VBO rebuild.

◆ setPreset()

void Qwt3DStandardColor::setPreset ( const QString &  presetName,
unsigned  size = 100 
)

Set colormap from a preset name.

Parameters
presetNameName of the colormap preset (e.g. "viridis", "plasma", "jet")
sizeNumber of color stops to sample from the colormap

Uses QwtColorMapPreset to create a QwtLinearColorMap and samples it at the specified number of points to fill the internal color vector.


The documentation for this class was generated from the following files: