QWT API (English) 7.0.1
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
qwt3d_color.h
1#ifndef __COLORGENERATOR_H__
2#define __COLORGENERATOR_H__
3
4#include <qstring.h>
5#include "qwt3d_global.h"
6#include "qwt3d_types.h"
7
8namespace Qwt3D {
9
26class QWT3D_EXPORT Color
27{
28public:
29 // Implement your color model here
30 virtual Qwt3D::RGBA operator()(double x, double y,
31 double z) const = 0;
32 virtual Qwt3D::RGBA operator()(Qwt3D::Triple const &t) const
33 {
34 return this->operator()(t.x, t.y, t.z);
35 }
36 // Should create a color vector usable by ColorLegend. The default implementation returns its argument
37 virtual Qwt3D::ColorVector &createVector(Qwt3D::ColorVector &vec) { return vec; }
38
39 void destroy() const { delete this; }
40
41protected:
42 virtual ~Color() { }
43};
44
45class Plot3D;
46
59class QWT3D_EXPORT StandardColor : public Color
60{
61public:
62 // Initializes with data and set up a ColorVector with a size of 100 z values (default)
63 explicit StandardColor(Qwt3D::Plot3D *data, unsigned size = 100);
64 // Receives z-dependent color from ColorVector
65 Qwt3D::RGBA operator()(double x, double y,
66 double z) const;
67 void setColorVector(Qwt3D::ColorVector const &cv);
68 // Resets the standard colors
69 void reset(unsigned size = 100);
70 // Sets unitary alpha value for all colors
71 void setAlpha(double a);
72 // Creates color vector for ColorLegend - essentially a copy from the internal vector
73 Qwt3D::ColorVector &createVector(Qwt3D::ColorVector &vec)
74 {
75 vec = colors_;
76 return vec;
77 }
78
79protected:
80 Qwt3D::ColorVector colors_;
81 Qwt3D::Plot3D *data_;
82};
83
84} // ns
85
86#endif
Abstract base class for color functors.
Definition qwt3d_color.h:27
Base class for all plotting widgets.
Definition qwt3d_plot.h:31
Standard color model for Plot3D - implements the data driven operator()(double x, double y,...
Definition qwt3d_color.h:60
Red-Green-Blue-Alpha value .
Definition qwt3d_types.h:480
Triple [x,y,z].
Definition qwt3d_types.h:240