QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt3d_color.h
1#ifndef QWT3D_COLOR_H
2#define QWT3D_COLOR_H
3
4#include <qstring.h>
5#include "qwt3d_global.h"
6#include "qwt3d_types.h"
7
8namespace Qwt3D
9{
10
18class QWT3D_EXPORT Color
19{
20public:
21 // Implement your color model here
22 virtual Qwt3D::RGBA operator()(double x, double y, double z) const = 0;
23 virtual Qwt3D::RGBA operator()(Qwt3D::Triple const& t) const
24 {
25 return this->operator()(t.x, t.y, t.z);
26 }
27 // Should create a color vector usable by ColorLegend. The default implementation returns its argument
28 virtual Qwt3D::ColorVector& createVector(Qwt3D::ColorVector& vec)
29 {
30 return vec;
31 }
32
33 void destroy() const
34 {
35 delete this;
36 }
37
38protected:
39 virtual ~Color()
40 {
41 }
42};
43
44class Plot3D;
45
51class QWT3D_EXPORT StandardColor : public Color
52{
53 QWT_DECLARE_PRIVATE(StandardColor)
54
55public:
56 // Initializes with data and set up a ColorVector with a size of 100 z values (default)
57 explicit StandardColor(Qwt3D::Plot3D* data, unsigned size = 100);
58 ~StandardColor() override;
59 // Receives z-dependent color from ColorVector
60 Qwt3D::RGBA operator()(double x, double y, double z) const override;
61 void setColorVector(Qwt3D::ColorVector const& cv);
62 // Resets the standard colors
63 void reset(unsigned size = 100);
64 // Sets unitary alpha value for all colors
65 void setAlpha(double a);
66 // Creates color vector for ColorLegend - essentially a copy from the internal vector
67 Qwt3D::ColorVector& createVector(Qwt3D::ColorVector& vec) override;
68
69 // Set colormap from a preset name (e.g. "viridis", "plasma", "jet")
70 void setPreset(const QString& presetName, unsigned size = 100);
71};
72
73} // ns
74
75#endif
Abstract base class for color functors
Definition qwt3d_color.h:19
Base class for all plotting widgets
Definition qwt3d_plot.h:22
Standard color model for Plot3D - implements the data driven operator()(double x, double y,...
Definition qwt3d_color.h:52
Red-Green-Blue-Alpha value
Definition qwt3d_types.h:364
Triple [x,y,z]
Definition qwt3d_types.h:170