Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

GUI/Client/vtkPVColorMap.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   ParaView
00004   Module:    $RCSfile: vtkPVColorMap.h,v $
00005 
00006   Copyright (c) Kitware, Inc.
00007   All rights reserved.
00008   See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00027 #ifndef __vtkPVColorMap_h
00028 #define __vtkPVColorMap_h
00029 
00030 
00031 #include "vtkPVTracedWidget.h"
00032 #include "vtkClientServerID.h" // Needed for LookupTableID
00033 
00034 class vtkKWChangeColorButton;
00035 class vtkKWCheckButton;
00036 class vtkKWEntry;
00037 class vtkKWLabel;
00038 class vtkKWFrame;
00039 class vtkKWFrameWithLabel;
00040 class vtkKWMenuButton;
00041 class vtkKWMenuButton;
00042 class vtkKWPushButton;
00043 class vtkKWScaleWithEntry;
00044 class vtkPVTextPropertyEditor;
00045 class vtkPVApplication;
00046 class vtkPVDataSetAttributesInformation;
00047 class vtkPVRenderView;
00048 class vtkPVColorMapObserver;
00049 class vtkPVSource;
00050 class vtkKWRange;
00051 class vtkTextProperty;
00052 class vtkSMScalarBarWidgetProxy;
00053 class vtkSMLookupTableProxy;
00054 class vtkSMProxy;
00055 
00056 class VTK_EXPORT vtkPVColorMap : public vtkPVTracedWidget
00057 {
00058 public:
00059   static vtkPVColorMap* New();
00060   vtkTypeRevisionMacro(vtkPVColorMap, vtkPVTracedWidget);
00061   void PrintSelf(ostream& os, vtkIndent indent);
00062 
00064   virtual void Create(vtkKWApplication *app);
00065 
00066   vtkPVApplication *GetPVApplication();
00067   
00069 
00070   void SetPVRenderView(vtkPVRenderView *view);
00071   vtkPVRenderView* GetPVRenderView() { return this->PVRenderView;}
00073 
00075 
00078   void SetScalarBarTitle(const char* Name);
00079   void SetScalarBarTitleNoTrace(const char* name);
00080   vtkGetStringMacro(ScalarBarTitle);
00082 
00084 
00087   void SetArrayName(const char* name);
00088   const char* GetArrayName();
00089   int MatchArrayName(const char* name, int numberOfComponents);
00091 
00092   void SetNumberOfVectorComponents(int num);
00093   int GetNumberOfVectorComponents();
00094 
00095 
00097 
00098   void SetScalarBarLabelFormat(const char* Name);
00099   const char* GetScalarBarLabelFormat();
00101 
00105   void CreateParallelTclObjects(vtkPVApplication *pvApp);
00106                 
00108 
00111   void ResetScalarRange();
00112   void ResetScalarRangeInternal();
00113   void ResetScalarRangeInternal(vtkPVSource* source);
00115   
00117 
00118   void SetScalarBarVisibility(int val);
00119   int GetScalarBarVisibility() { return this->ScalarBarVisibility;}  
00121 
00123 
00124   void SetScalarBarPosition1(float x, float y);
00125   void SetScalarBarPosition2(float x, float y);
00126   void SetScalarBarOrientation(int);
00128   
00130 
00131   void SetColorSchemeToRedBlue();
00132   void SetColorSchemeToBlueRed();
00133   void SetColorSchemeToGrayscale();
00134   void SetColorSchemeToLabBlueRed();
00136 
00138 
00139   void SetVectorComponent(int component);
00140   vtkGetMacro(VectorComponent,int);
00142 
00144   void SaveInBatchScript(ofstream *file);
00145 
00146   // --- UI Stuff ---
00147 
00149 
00150   void ScalarBarCheckCallback();
00151   void ScalarRangeWidgetCallback();
00152   void LockCheckCallback();
00154 
00156   void SetScalarRangeLock(int val);
00157 
00161   void BackButtonCallback();
00162 
00165   void ScalarBarTitleEntryCallback();
00166 
00168 
00169   void ScalarBarVectorTitleEntryCallback();
00170   void SetScalarBarVectorTitle(const char* name);
00172 
00175   void ScalarBarLabelFormatEntryCallback();
00176 
00178 
00179   void StartColorButtonCallback(double r, double g, double b);
00180   void EndColorButtonCallback(double r, double g, double b);
00181   void SetStartHSV(double h, double s, double v);
00182   void SetEndHSV(double h, double s, double v);
00184 
00186   void MapConfigureCallback(int width, int height);
00187 
00189 
00190   void NumberOfColorsScaleCallback();
00191   void SetNumberOfColors(int num);
00193 
00195 
00198   vtkSetMacro(VisitedFlag,int);
00199   vtkGetMacro(VisitedFlag,int);
00201 
00203 
00204   virtual void ExecuteEvent(vtkObject* wdg, unsigned long event,  
00205                             void* calldata);
00207 //ETX
00208 
00210 
00211   vtkGetObjectMacro(ScalarBarCheck, vtkKWCheckButton);
00212   vtkGetObjectMacro(TitleTextPropertyWidget, vtkPVTextPropertyEditor);
00213   vtkGetObjectMacro(LabelTextPropertyWidget, vtkPVTextPropertyEditor);
00215 
00216   // Call backs from the vector mode frame.
00217   void VectorModeMagnitudeCallback();
00218   void VectorModeComponentCallback();
00219   void VectorComponentCallback(int component);
00220 
00222 
00224   void IncrementUseCount();
00225   void DecrementUseCount();
00227 
00229   void SaveState(ofstream *file);
00230 
00232   virtual void RenderView();
00233 
00237   void UpdateForSource(vtkPVSource* source);
00238 
00240 
00241   void SetWholeScalarRange(double min, double max);
00242   vtkGetVector2Macro(WholeScalarRange,double);
00244 
00246 
00248   void SetScalarRange(double min, double max);
00249   void SetScalarRangeInternal(double min, double max);
00250   vtkGetVector2Macro(ScalarRange,double);
00252 
00259   virtual void UpdateEnableState();
00260 
00262   void TitleTextPropertyWidgetCallback();
00263 
00265 
00266   virtual void SetTitleColor(double r, double g, double b);
00267   virtual void SetTitleOpacity(double opacity);
00268   virtual void SetTitleFontFamily(int font);
00269   virtual void SetTitleBold(int bold);
00270   virtual void SetTitleItalic(int italic);
00271   virtual void SetTitleShadow(int shadow); 
00273   
00275   void LabelTextPropertyWidgetCallback();
00276 
00278 
00279   virtual void SetLabelColor(double r, double g, double b);
00280   virtual void SetLabelOpacity(double opacity);
00281   virtual void SetLabelFontFamily(int font);
00282   virtual void SetLabelBold(int bold);
00283   virtual void SetLabelItalic(int italic);
00284   virtual void SetLabelShadow(int shadow); 
00286 
00289   vtkSMProxy* GetProxyByName(const char* name);
00290 
00291 protected:
00292   vtkPVColorMap();
00293   ~vtkPVColorMap();
00294 
00295   vtkPVColorMapObserver* ScalarBarObserver;
00296 
00297   void InitializeObservers();
00298   void UpdateVectorComponentMenu();
00299   // Visibility depends on check and UseCount.
00300   void UpdateInternalScalarBarVisibility();
00301   void ComputeScalarRangeForSource(vtkPVSource* pvs, double* range);
00302 
00303   vtkPVRenderView *PVRenderView;
00304 
00305   int Initialized;
00306   int ScalarBarVisibility;
00307   int InternalScalarBarVisibility;
00308   int UserModifiedScalarRange;
00309 
00310   // Keep local ivars to avoid depending on widget values.
00311   double ScalarRange[2];
00312   // WholeScalarRange contain the maximums of the scalarRange widget.
00313   double WholeScalarRange[2];
00314   int ScalarRangeLock;
00315   
00316   // User interaface.
00317   vtkKWFrameWithLabel* ColorMapFrame;
00318   vtkKWLabel*        ArrayNameLabel;
00319   // Stuff for setting the range of the color map.
00320   vtkKWFrame*       ScalarRangeFrame;
00321   vtkKWCheckButton*  ScalarRangeLockCheck;
00322   vtkKWRange*        ScalarRangeWidget;
00323   vtkKWScaleWithEntry* NumberOfColorsScale;
00324   // Stuff for selecting start and end colors.
00325   vtkKWFrame*            ColorEditorFrame;
00326   vtkKWChangeColorButton* StartColorButton;
00327   vtkKWLabel*        Map;
00328   vtkKWChangeColorButton* EndColorButton;
00329 
00330   vtkKWFrameWithLabel* VectorFrame;
00331   vtkKWMenuButton*   VectorModeMenu;
00332   vtkKWMenuButton*   VectorComponentMenu;
00333   vtkKWEntry*        ScalarBarVectorTitleEntry;
00334 
00335   vtkKWFrameWithLabel* ScalarBarFrame;
00336   vtkKWCheckButton*  ScalarBarCheck;
00337   vtkKWFrame*        ScalarBarTitleFrame;
00338   vtkKWLabel*        ScalarBarTitleLabel;
00339   vtkKWEntry*        ScalarBarTitleEntry;
00340   vtkKWFrame*        ScalarBarLabelFormatFrame;
00341   vtkKWLabel*        ScalarBarLabelFormatLabel;
00342   vtkKWEntry*        ScalarBarLabelFormatEntry;
00343   
00344   vtkPVTextPropertyEditor *TitleTextPropertyWidget;
00345   vtkPVTextPropertyEditor *LabelTextPropertyWidget;
00346   
00347   // For the map image.
00348   unsigned char *MapData;
00349   int MapDataSize;
00350   int MapWidth;
00351   int MapHeight;
00352   void UpdateMap(int width, int height);
00353   void UpdateMap();
00354 
00355   vtkKWMenuButton* PresetsMenuButton;  
00356   vtkKWPushButton*   BackButton;
00357 
00358   vtkSMScalarBarWidgetProxy *ScalarBarProxy;
00359   char *ScalarBarProxyName;
00360   vtkSetStringMacro(ScalarBarProxyName);
00361 
00362   vtkSMLookupTableProxy* LookupTableProxy;
00363   char* LookupTableProxyName;
00364   vtkSetStringMacro(LookupTableProxyName);
00365 
00366   // TextProperty dummies for the label and title property
00367   vtkTextProperty* LabelTextProperty;
00368   vtkTextProperty* TitleTextProperty;
00369 
00370   // For creating a proper title for the scalar bar.
00371   char *ScalarBarTitle;
00372   char *ScalarBarVectorTitle;
00373   char *VectorMagnitudeTitle;
00374   char **VectorComponentTitles;
00375   int NumberOfVectorComponents;
00376   int VectorComponent;
00377   void UpdateScalarBarTitle();
00378   char* ArrayName; 
00379 
00380 
00382   void SetTitleColorInternal(double r, double g, double b);
00383  
00385   void SetTitleOpacityInternal(double opacity);
00386 
00388   void SetTitleFontFamilyInternal(int font);
00389 
00391   void SetTitleBoldInternal(int bold);
00392 
00394   void SetTitleItalicInternal(int italic);
00395 
00397   void SetTitleShadowInternal(int shadow);
00398 
00400   void SetLabelColorInternal(double r, double g, double b);
00401  
00403   void SetLabelOpacityInternal(double opacity);
00404 
00406   void SetLabelFontFamilyInternal(int font);
00407 
00409   void SetLabelBoldInternal(int bold);
00410 
00412   void SetLabelItalicInternal(int italic);
00413 
00415   void SetLabelShadowInternal(int shadow);
00416 
00418   void SetTitleInternal(const char* name);
00419   
00421 
00422   int GetVectorModeInternal();
00423   void SetVectorModeInternal(int mode);
00425 
00427 
00428   const char* GetLabelFormatInternal();
00429   void SetLabelFormatInternal(const char* format);
00431 
00433 
00434   const char* GetArrayNameInternal();
00435   void SetArrayNameInternal(const char* name);
00437 
00439 
00440   void GetHueRangeInternal(double range[2]);
00441   void GetSaturationRangeInternal(double range[2]);
00442   void GetValueRangeInternal(double range[2]);
00443   void SetHSVRangesInternal(double hrange[2],
00444     double srange[2], double vrange[2]);
00445   //void SetSaturationRangeInternal(double range[2]);
00446   //void SetValueRangeInternal(double range[2]);
00448  
00450 
00451   void SetNumberOfColorsInternal(int num);
00452   int GetNumberOfColorsInternal();
00454   
00456 
00457   void GetLabelTextPropertyInternal();
00458   void GetTitleTextPropertyInternal();
00460   
00461   void SetVisibilityInternal(int visible);
00462   void SetVectorComponentInternal(int component);
00463 
00465 
00468   void SetPosition1Internal(double x, double y);
00469   void GetPosition1Internal(double pos[2]);
00471   
00473 
00476   void SetPosition2Internal(double x, double y);
00477   void GetPosition2Internal(double pos[2]);
00479  
00481 
00484   void SetOrientationInternal(int orientation);
00485   int GetOrientationInternal();
00487 
00488   // Leaving this name for this function for the timebeing
00489   // till we can move the code from SetScalarRangeInternal
00490   // somewhere. All ...Internal methods push values onto 
00491   // proxies.
00492   void SetScalarBarWidgetScalarRangeInternal(double min, double max);
00493   
00494   // For Saving into a tcl script.
00495   int VisitedFlag;
00496 
00497   // For determining how many data objects are using the color map.
00498   //  This is used to make the scalar bar invisible when not used.
00499   int UseCount;
00500 
00501   void ComputeScalarRange(
00502     vtkPVDataSetAttributesInformation* attrInfo, double* range);
00503 
00504 private:
00505   vtkPVColorMap(const vtkPVColorMap&); // Not implemented
00506   void operator=(const vtkPVColorMap&); // Not implemented
00507 };
00508 
00509 #endif

Generated on Tue May 30 12:31:38 2006 for ParaView by doxygen 1.3.5