00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __vtkKWColorPresetMenu_h
00022 #define __vtkKWColorPresetMenu_h
00023
00024 #include "vtkKWMenuButtonWithLabel.h"
00025
00026 class vtkColorTransferFunction;
00027 class vtkKWColorPresetMenuInternals;
00028
00029 class KWWidgets_EXPORT vtkKWColorPresetMenu : public vtkKWMenuButtonWithLabel
00030 {
00031 public:
00032 static vtkKWColorPresetMenu* New();
00033 vtkTypeRevisionMacro(vtkKWColorPresetMenu,vtkKWMenuButtonWithLabel);
00034 void PrintSelf(ostream& os, vtkIndent indent);
00035
00036
00037
00038
00039 virtual void SetColorTransferFunction(vtkColorTransferFunction *p);
00040 vtkGetObjectMacro(ColorTransferFunction,vtkColorTransferFunction);
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 vtkGetVector2Macro(ScalarRange, double);
00051 vtkSetVector2Macro(ScalarRange, double);
00052 vtkGetMacro(ApplyPresetBetweenEndPoints, int);
00053 vtkSetMacro(ApplyPresetBetweenEndPoints, int);
00054 vtkBooleanMacro(ApplyPresetBetweenEndPoints, int);
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 virtual int AddPreset(
00066 const char *name, vtkColorTransferFunction *func, double range[2]);
00067
00068
00069
00070
00071 virtual int RemovePreset(const char *name);
00072 virtual int RemoveAllPresets();
00073
00074
00075
00076
00077 virtual int AddSolidRGBPreset(const char *name, double rgb[3]);
00078 virtual int AddSolidRGBPreset(const char *name, double r,double g, double b);
00079 virtual int AddSolidHSVPreset(const char *name, double hsv[3]);
00080 virtual int AddSolidHSVPreset(const char *name, double h,double s, double v);
00081
00082
00083
00084
00085
00086 virtual int AddGradientRGBPreset(
00087 const char *name, double rgb1[3], double rgb2[3]);
00088 virtual int AddGradientRGBPreset(
00089 const char *name,
00090 double r1, double g1, double b1,
00091 double r2, double g2, double b2);
00092 virtual int AddGradientHSVPreset(
00093 const char *name, double hsv1[3], double hsv2[3]);
00094 virtual int AddGradientHSVPreset(
00095 const char *name,
00096 double h1, double s1, double v1,
00097 double h2, double s2, double v2);
00098
00099
00100
00101
00102
00103
00104 virtual int AddFlagRGBPreset(
00105 const char *name, int nb_colors, double **rgb, int repeat);
00106
00107
00108
00109
00110 vtkGetMacro(PreviewSize, int);
00111 virtual void SetPreviewSize(int);
00112
00113
00114
00115 vtkGetMacro(SolidColorPresetsVisibility, int);
00116 vtkBooleanMacro(SolidColorPresetsVisibility, int);
00117 virtual void SetSolidColorPresetsVisibility(int);
00118
00119
00120
00121 vtkGetMacro(GradientPresetsVisibility, int);
00122 vtkBooleanMacro(GradientPresetsVisibility, int);
00123 virtual void SetGradientPresetsVisibility(int);
00124
00125
00126
00127 vtkGetMacro(PresetNameVisibility, int);
00128 vtkBooleanMacro(PresetNameVisibility, int);
00129 virtual void SetPresetNameVisibility(int);
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140 virtual void SetPresetSelectedCommand(vtkObject *object, const char *method);
00141
00142
00143
00144 virtual void PresetSelectedCallback(const char *name);
00145
00146 protected:
00147 vtkKWColorPresetMenu();
00148 ~vtkKWColorPresetMenu();
00149
00150
00151
00152 virtual void CreateWidget();
00153
00154 double ScalarRange[2];
00155 vtkColorTransferFunction *ColorTransferFunction;
00156 int PreviewSize;
00157 int SolidColorPresetsVisibility;
00158 int GradientPresetsVisibility;
00159 int ApplyPresetBetweenEndPoints;
00160 int PresetNameVisibility;
00161
00162 char *PresetSelectedCommand;
00163 virtual void InvokePresetSelectedCommand(const char *name);
00164
00165
00166
00167 vtkKWColorPresetMenuInternals *Internals;
00168
00169
00170
00171
00172
00173 virtual int HasPreset(const char *name);
00174 virtual int AllocatePreset(const char *name);
00175
00176
00177
00178
00179 virtual vtkColorTransferFunction* GetPresetColorTransferFunction(
00180 const char *name);
00181
00182
00183
00184 virtual void CreateDefaultPresets();
00185
00186
00187
00188
00189 virtual int MapColorTransferFunction(
00190 vtkColorTransferFunction *source, double source_range[2],
00191 vtkColorTransferFunction *target, double target_range[2]);
00192
00193
00194
00195 virtual int CreateColorTransferFunctionPreview(
00196 vtkColorTransferFunction *func, const char *img_name);
00197
00198
00199
00200 virtual void PopulatePresetMenu();
00201
00202 private:
00203 vtkKWColorPresetMenu(const vtkKWColorPresetMenu&);
00204 void operator=(const vtkKWColorPresetMenu&);
00205 };
00206
00207 #endif
00208