00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00023 #ifndef __vtkKWColorPresetMenu_h
00024 #define __vtkKWColorPresetMenu_h
00025
00026 #include "vtkKWMenuButtonWithLabel.h"
00027
00028 class vtkColorTransferFunction;
00029 class vtkKWColorPresetMenuInternals;
00030
00031 class KWWidgets_EXPORT vtkKWColorPresetMenu : public vtkKWMenuButtonWithLabel
00032 {
00033
00034 public:
00035 static vtkKWColorPresetMenu* New();
00036 vtkTypeRevisionMacro(vtkKWColorPresetMenu,vtkKWMenuButtonWithLabel);
00037 void PrintSelf(ostream& os, vtkIndent indent);
00038
00040
00042 virtual void SetColorTransferFunction(vtkColorTransferFunction *p);
00043 vtkGetObjectMacro(ColorTransferFunction,vtkColorTransferFunction);
00045
00047
00053 vtkGetVector2Macro(ScalarRange, double);
00054 vtkSetVector2Macro(ScalarRange, double);
00055 vtkGetMacro(ApplyPresetBetweenEndPoints, int);
00056 vtkSetMacro(ApplyPresetBetweenEndPoints, int);
00057 vtkBooleanMacro(ApplyPresetBetweenEndPoints, int);
00059
00061
00068 virtual int AddPreset(
00069 const char *name, vtkColorTransferFunction *func, double range[2]);
00071
00073
00074 virtual int RemovePreset(const char *name);
00075 virtual int RemoveAllPresets();
00077
00079
00081 virtual int AddSolidRGBPreset(const char *name, double rgb[3]);
00082 virtual int AddSolidRGBPreset(const char *name, double r,double g, double b);
00083 virtual int AddSolidHSVPreset(const char *name, double hsv[3]);
00084 virtual int AddSolidHSVPreset(const char *name, double h,double s, double v);
00086
00088
00090 virtual int AddGradientRGBPreset(
00091 const char *name, double rgb1[3], double rgb2[3]);
00092 virtual int AddGradientRGBPreset(
00093 const char *name,
00094 double r1, double g1, double b1,
00095 double r2, double g2, double b2);
00096 virtual int AddGradientHSVPreset(
00097 const char *name, double hsv1[3], double hsv2[3]);
00098 virtual int AddGradientHSVPreset(
00099 const char *name,
00100 double h1, double s1, double v1,
00101 double h2, double s2, double v2);
00103
00105
00108 virtual int AddFlagRGBPreset(
00109 const char *name, int nb_colors, double **rgb, int repeat);
00111
00113
00115 vtkGetMacro(PreviewSize, int);
00116 virtual void SetPreviewSize(int);
00118
00120
00121 vtkGetMacro(SolidColorPresetsVisibility, int);
00122 vtkBooleanMacro(SolidColorPresetsVisibility, int);
00123 virtual void SetSolidColorPresetsVisibility(int);
00125
00127
00128 vtkGetMacro(GradientPresetsVisibility, int);
00129 vtkBooleanMacro(GradientPresetsVisibility, int);
00130 virtual void SetGradientPresetsVisibility(int);
00132
00134
00135 vtkGetMacro(PresetNameVisibility, int);
00136 vtkBooleanMacro(PresetNameVisibility, int);
00137 virtual void SetPresetNameVisibility(int);
00139
00147 virtual void SetPresetSelectedCommand(vtkObject *object, const char *method);
00148
00150 virtual void PresetSelectedCallback(const char *name);
00151
00152
00153
00154 protected:
00155 vtkKWColorPresetMenu();
00156 ~vtkKWColorPresetMenu();
00157
00159 virtual void CreateWidget();
00160
00161 double ScalarRange[2];
00162 vtkColorTransferFunction *ColorTransferFunction;
00163 int PreviewSize;
00164 int SolidColorPresetsVisibility;
00165 int GradientPresetsVisibility;
00166 int ApplyPresetBetweenEndPoints;
00167 int PresetNameVisibility;
00168
00169 char *PresetSelectedCommand;
00170 virtual void InvokePresetSelectedCommand(const char *name);
00171
00172
00173
00174 vtkKWColorPresetMenuInternals *Internals;
00175
00177
00179 virtual int HasPreset(const char *name);
00180 virtual int AllocatePreset(const char *name);
00182
00184
00186 virtual vtkColorTransferFunction* GetPresetColorTransferFunction(
00187 const char *name);
00189
00191 virtual void CreateDefaultPresets();
00192
00194
00195 virtual int MapColorTransferFunction(
00196 vtkColorTransferFunction *source, double source_range[2],
00197 vtkColorTransferFunction *target, double target_range[2]);
00199
00201
00202 virtual int CreateColorTransferFunctionPreview(
00203 vtkColorTransferFunction *func, const char *img_name);
00205
00207 virtual void PopulatePresetMenu();
00208
00209
00210
00211 private:
00212 vtkKWColorPresetMenu(const vtkKWColorPresetMenu&);
00213 void operator=(const vtkKWColorPresetMenu&);
00214 };
00215
00216 #endif
00217
00218