00001
00002
00003
00004
00005
00006
00007 #ifndef BALL_VIEW_DATATYPE_COLORMAP_H
00008 #define BALL_VIEW_DATATYPE_COLORMAP_H
00009
00010 #ifndef BALL_VIEW_DATATYPE_COLORRGBA_H
00011 # include <BALL/VIEW/DATATYPE/colorRGBA.h>
00012 #endif
00013
00014 #ifndef BALL_MATHS_VECTOR4_H
00015 # include <BALL/MATHS/vector4.h>
00016 #endif
00017
00018 #include <vector>
00019
00020 namespace BALL
00021 {
00022 namespace VIEW
00023 {
00028 class BALL_VIEW_EXPORT ColorMap
00029 : public vector<ColorRGBA>
00030 {
00031 public:
00032
00033 BALL_CREATE(ColorMap)
00034
00035
00038
00042 ColorMap();
00043
00048 ColorMap(Size color_number);
00049
00054 ColorMap(const ColorMap& color_Map);
00055
00061 ColorMap(Size size, const ColorRGBA& color, bool alpha_blending=false);
00062
00065 ColorMap(const ColorMap& color_Map, Index from, Index to, bool alpha_blending=false);
00066
00069 ColorMap(const ColorRGBA* color_array, Size array_size, bool alpha_blending=false);
00070
00073 virtual ~ColorMap();
00075
00079
00081 void createMapJet(const Size color_number);
00082
00084 void setBaseColors(const ColorRGBA* color_array, Size array_size);
00085
00087 void setNumberOfColors(const Size color_number);
00088
00090 Size getNumberOfColors() const;
00091
00093 void setAlphaBlending(bool blending);
00094
00096 bool getAlphaBlending() const;
00097
00101 Size createMap();
00102
00105 void setMinMaxColors(ColorRGBA min, ColorRGBA max);
00106
00109 void setRange(float min, float max);
00110
00113 ColorRGBA& map(float value);
00114
00117 const ColorRGBA& map(float value) const;
00118
00124 bool setInterpolationBoundaries(const vector<Vector4>& boundaries);
00125
00127
00130
00133 virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
00135
00136 protected:
00137
00138 Size color_number_;
00139 bool alpha_blending_;
00140 ColorRGBA min_color_;
00141 ColorRGBA max_color_;
00142 bool has_min_max_colors_;
00143 float min_;
00144 float max_;
00145
00146 vector<Vector4> interpolation_boundaries_;
00147 };
00148
00149 }
00150 }
00151
00152 #endif // BALL_VIEW_DATATYPE_COLORMAP_H