source: pacpusframework/branches/2.0-beta1/include/extlib/qwtplot3d/qwt3d_color.h@ 89

Last change on this file since 89 was 89, checked in by morasjul, 11 years ago

PACPUS 2.0 Beta deployed in new branch

Major changes:
-Add communication interface between components
-Add examples for communications interface (TestComponents)
-Move to Qt5 support

  • Property svn:executable set to *
File size: 2.1 KB
Line 
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{
10
11//! Abstract base class for color functors
12/*!
13Use your own color model by providing an implementation of operator()(double x, double y, double z).
14Colors destructor has been declared \c protected, in order to use only heap based objects. Plot3D
15will handle the objects destruction.
16See StandardColor for an example
17*/
18class QWT3D_EXPORT Color
19{
20public:
21 virtual Qwt3D::RGBA operator()(double x, double y, double z) const = 0; //!< Implement your color model here
22 virtual Qwt3D::RGBA operator()(Qwt3D::Triple const& t) const {return this->operator()(t.x,t.y,t.z);}
23 //! Should create a color vector usable by ColorLegend. The default implementation returns his argument
24 virtual Qwt3D::ColorVector& createVector(Qwt3D::ColorVector& vec) { return vec; }
25
26 void destroy() const { delete this;}
27
28protected:
29 virtual ~Color(){} //!< Allow heap based objects only
30};
31
32
33
34class Plot3D;
35//! Standard color model for Plot3D - implements the data driven operator()(double x, double y, double z)
36/*!
37The class has a ColorVector representing z values, which will be used by operator()(double x, double y, double z)
38*/
39class QWT3D_EXPORT StandardColor : public Color
40{
41public:
42 //! Initializes with data and set up a ColorVector with a size of 100 z values (default);
43 explicit StandardColor(Qwt3D::Plot3D* data, unsigned size = 100);
44 Qwt3D::RGBA operator()(double x, double y, double z) const; //!< Receives z-dependend color from ColorVector
45 void setColorVector(Qwt3D::ColorVector const& cv);
46 void reset(unsigned size=100); //!< Resets the standard colors;
47 void setAlpha(double a); //!< Sets unitary alpha value for all colors
48 /**
49 \brief Creates color vector
50
51 Creates a color vector used by ColorLegend. This is essentially a copy from the internal used vector.
52 \return The vector created
53 */
54 Qwt3D::ColorVector& createVector(Qwt3D::ColorVector& vec) {vec = colors_; return vec;}
55
56protected:
57 Qwt3D::ColorVector colors_;
58 Qwt3D::Plot3D* data_;
59};
60
61} // ns
62
63#endif
Note: See TracBrowser for help on using the repository browser.