00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00078 #ifndef __vtkScalarBarActor_h
00079 #define __vtkScalarBarActor_h
00080 
00081 #include "vtkActor2D.h"
00082 #include "vtkScalarsToColors.h"
00083 #include "vtkPolyDataMapper2D.h"
00084 #include "vtkTextMapper.h"
00085 
00086 #define VTK_ORIENT_HORIZONTAL 0
00087 #define VTK_ORIENT_VERTICAL 1
00088 
00089 class VTK_EXPORT vtkScalarBarActor : public vtkActor2D
00090 {
00091 public:
00092   vtkTypeMacro(vtkScalarBarActor,vtkActor2D);
00093   void PrintSelf(ostream& os, vtkIndent indent);
00094 
00099   static vtkScalarBarActor *New();
00100 
00101 
00103   int RenderOpaqueGeometry(vtkViewport* viewport);
00104   int RenderTranslucentGeometry(vtkViewport*) { return 0; };
00105   int RenderOverlay(vtkViewport* viewport);
00106 
00110   virtual void ReleaseGraphicsResources(vtkWindow *);
00111 
00115   vtkSetObjectMacro(LookupTable,vtkScalarsToColors);
00116   vtkGetObjectMacro(LookupTable,vtkScalarsToColors);
00117 
00121   vtkSetClampMacro(MaximumNumberOfColors, int, 2, VTK_LARGE_INTEGER);
00122   vtkGetMacro(MaximumNumberOfColors, int);
00123   
00125   vtkSetClampMacro(NumberOfLabels, int, 0, 64);
00126   vtkGetMacro(NumberOfLabels, int);
00127   
00129   vtkSetClampMacro(Orientation,int,VTK_ORIENT_HORIZONTAL, VTK_ORIENT_VERTICAL);
00130   vtkGetMacro(Orientation, int);
00131   void SetOrientationToHorizontal()
00132        {this->SetOrientation(VTK_ORIENT_HORIZONTAL);};
00133   void SetOrientationToVertical() {this->SetOrientation(VTK_ORIENT_VERTICAL);};
00134 
00136   vtkSetMacro(Bold, int);
00137   vtkGetMacro(Bold, int);
00138   vtkBooleanMacro(Bold, int);
00139 
00141   vtkSetMacro(Italic, int);
00142   vtkGetMacro(Italic, int);
00143   vtkBooleanMacro(Italic, int);
00144 
00147   vtkSetMacro(Shadow, int);
00148   vtkGetMacro(Shadow, int);
00149   vtkBooleanMacro(Shadow, int);
00150 
00154   vtkSetMacro(FontFamily, int);
00155   vtkGetMacro(FontFamily, int);
00156   void SetFontFamilyToArial() {this->SetFontFamily(VTK_ARIAL);};
00157   void SetFontFamilyToCourier() {this->SetFontFamily(VTK_COURIER);};
00158   void SetFontFamilyToTimes() {this->SetFontFamily(VTK_TIMES);};
00159 
00161   vtkSetStringMacro(LabelFormat);
00162   vtkGetStringMacro(LabelFormat);
00163 
00165   vtkSetStringMacro(Title);
00166   vtkGetStringMacro(Title);
00167 
00170   void ShallowCopy(vtkProp *prop);
00171 
00172 protected:
00173   vtkScalarBarActor();
00174   ~vtkScalarBarActor();
00175   vtkScalarBarActor(const vtkScalarBarActor&) {};
00176   void operator=(const vtkScalarBarActor&) {};
00177 
00178   vtkScalarsToColors *LookupTable;
00179   int   MaximumNumberOfColors;
00180   int   NumberOfLabels;
00181   int   NumberOfLabelsBuilt;
00182   int   Orientation;
00183   char  *Title;
00184 
00185   int Bold;
00186   int   Italic;
00187   int   Shadow;
00188   int   FontFamily;
00189   char  *LabelFormat;
00190 
00191 private:
00192   vtkTextMapper *TitleMapper;
00193   vtkActor2D    *TitleActor;
00194 
00195   vtkTextMapper **TextMappers;
00196   vtkActor2D    **TextActors;
00197 
00198   vtkPolyData         *ScalarBar;
00199   vtkPolyDataMapper2D *ScalarBarMapper;
00200   vtkActor2D          *ScalarBarActor;
00201 
00202   vtkTimeStamp  BuildTime;
00203   int LastSize[2];
00204   int LastOrigin[2];
00205 
00206   void SizeTitle(int *titleSize, int *size, vtkViewport *viewport);
00207   void AllocateAndSizeLabels(int *labelSize, int *size,
00208                              vtkViewport *viewport, float *range);
00209 };
00210 
00211 
00212 #endif
00213