00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00023 #ifndef __vtkKWColorPresetSelector_h
00024 #define __vtkKWColorPresetSelector_h
00025
00026 #include "vtkKWMenuButtonWithLabel.h"
00027
00028 class vtkColorTransferFunction;
00029 class vtkKWColorPresetSelectorInternals;
00030
00031
00032
00033 class KWWIDGETS_EXPORT vtkKWColorPresetSelector : public vtkKWMenuButtonWithLabel
00034 {
00035 public:
00036 static vtkKWColorPresetSelector* New();
00037 vtkTypeRevisionMacro(vtkKWColorPresetSelector,vtkKWMenuButtonWithLabel);
00038 void PrintSelf(ostream& os, vtkIndent indent);
00039
00041
00043 virtual void SetColorTransferFunction(vtkColorTransferFunction *p);
00044 vtkGetObjectMacro(ColorTransferFunction,vtkColorTransferFunction);
00046
00048
00054 vtkGetVector2Macro(ScalarRange, double);
00055 vtkSetVector2Macro(ScalarRange, double);
00056 vtkGetMacro(ApplyPresetBetweenEndPoints, int);
00057 vtkSetMacro(ApplyPresetBetweenEndPoints, int);
00058 vtkBooleanMacro(ApplyPresetBetweenEndPoints, int);
00060
00062
00069 virtual int AddPreset(
00070 const char *name, vtkColorTransferFunction *func, double range[2]);
00072
00074
00075 virtual int RemovePreset(const char *name);
00076 virtual int RemoveAllPresets();
00078
00080
00082 virtual int AddSolidRGBPreset(const char *name, double rgb[3]);
00083 virtual int AddSolidRGBPreset(const char *name,double r,double g, double b);
00084 virtual int AddSolidHSVPreset(const char *name, double hsv[3]);
00085 virtual int AddSolidHSVPreset(const char *name,double h,double s, double v);
00087
00089
00091 virtual int AddGradientRGBPreset(
00092 const char *name, double rgb1[3], double rgb2[3]);
00093 virtual int AddGradientRGBPreset(
00094 const char *name,
00095 double r1, double g1, double b1,
00096 double r2, double g2, double b2);
00097 virtual int AddGradientHSVPreset(
00098 const char *name, double hsv1[3], double hsv2[3]);
00099 virtual int AddGradientHSVPreset(
00100 const char *name,
00101 double h1, double s1, double v1,
00102 double h2, double s2, double v2);
00104
00106
00109 virtual int AddFlagRGBPreset(
00110 const char *name, int nb_colors, double **rgb, int repeat);
00112
00114
00116 vtkGetMacro(PreviewSize, int);
00117 virtual void SetPreviewSize(int);
00119
00121
00122 vtkGetMacro(HideSolidColorPresets, int);
00123 vtkBooleanMacro(HideSolidColorPresets, int);
00124 virtual void SetHideSolidColorPresets(int);
00126
00128
00129 vtkGetMacro(HideGradientPresets, int);
00130 vtkBooleanMacro(HideGradientPresets, int);
00131 virtual void SetHideGradientPresets(int);
00133
00135 virtual void Create(vtkKWApplication *app);
00136
00138
00139 virtual void SetPresetSelectedCommand(
00140 vtkObject *object, const char *method);
00142
00144 virtual void PresetSelectedCallback(const char *name);
00145
00146 protected:
00147 vtkKWColorPresetSelector();
00148 ~vtkKWColorPresetSelector();
00149
00150 double ScalarRange[2];
00151 vtkColorTransferFunction *ColorTransferFunction;
00152 char *PresetSelectedCommand;
00153 int PreviewSize;
00154 int HideSolidColorPresets;
00155 int HideGradientPresets;
00156 int ApplyPresetBetweenEndPoints;
00157
00158
00159
00160 vtkKWColorPresetSelectorInternals *Internals;
00161
00163
00165 virtual int HasPreset(const char *name);
00166 virtual int AllocatePreset(const char *name);
00168
00170
00172 virtual vtkColorTransferFunction* GetPresetColorTransferFunction(
00173 const char *name);
00175
00177 virtual void CreateDefaultPresets();
00178
00180
00181 virtual int MapColorTransferFunction(
00182 vtkColorTransferFunction *source, double source_range[2],
00183 vtkColorTransferFunction *target, double target_range[2]);
00185
00187
00188 virtual int CreateColorTransferFunctionPreview(
00189 vtkColorTransferFunction *func, const char *img_name);
00191
00193 virtual void PopulatePresetMenu();
00194
00195 private:
00196 vtkKWColorPresetSelector(const vtkKWColorPresetSelector&);
00197 void operator=(const vtkKWColorPresetSelector&);
00198 };
00199
00200 #endif
00201