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

Rendering/vtkScalarBarActor.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkScalarBarActor.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00074 #ifndef __vtkScalarBarActor_h
00075 #define __vtkScalarBarActor_h
00076 
00077 #include "vtkActor2D.h"
00078 
00079 class vtkPolyData;
00080 class vtkPolyDataMapper2D;
00081 class vtkScalarsToColors;
00082 class vtkTextMapper;
00083 class vtkTextProperty;
00084 
00085 #define VTK_ORIENT_HORIZONTAL 0
00086 #define VTK_ORIENT_VERTICAL 1
00087 
00088 class VTK_RENDERING_EXPORT vtkScalarBarActor : public vtkActor2D
00089 {
00090 public:
00091   vtkTypeRevisionMacro(vtkScalarBarActor,vtkActor2D);
00092   void PrintSelf(ostream& os, vtkIndent indent);
00093 
00097   static vtkScalarBarActor *New();
00098 
00100 
00101   int RenderOpaqueGeometry(vtkViewport* viewport);
00102   int RenderTranslucentGeometry(vtkViewport*) { return 0; };
00103   int RenderOverlay(vtkViewport* viewport);
00105 
00109   virtual void ReleaseGraphicsResources(vtkWindow *);
00110 
00112 
00115   virtual void SetLookupTable(vtkScalarsToColors*);
00116   vtkGetObjectMacro(LookupTable,vtkScalarsToColors);
00118 
00120 
00123   vtkSetClampMacro(MaximumNumberOfColors, int, 2, VTK_LARGE_INTEGER);
00124   vtkGetMacro(MaximumNumberOfColors, int);
00126   
00128 
00129   vtkSetClampMacro(NumberOfLabels, int, 0, 64);
00130   vtkGetMacro(NumberOfLabels, int);
00132   
00134 
00135   vtkSetClampMacro(Orientation,int,VTK_ORIENT_HORIZONTAL, VTK_ORIENT_VERTICAL);
00136   vtkGetMacro(Orientation, int);
00137   void SetOrientationToHorizontal()
00138        {this->SetOrientation(VTK_ORIENT_HORIZONTAL);};
00139   void SetOrientationToVertical() {this->SetOrientation(VTK_ORIENT_VERTICAL);};
00141 
00143 
00144   virtual void SetTitleTextProperty(vtkTextProperty *p);
00145   vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
00147   
00149 
00150   virtual void SetLabelTextProperty(vtkTextProperty *p);
00151   vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
00153     
00154 #ifndef VTK_REMOVE_LEGACY_CODE
00155 
00156 
00161   virtual void SetFontFamily(int val);
00162   virtual int GetFontFamily();
00163   void SetFontFamilyToArial()   { this->SetFontFamily(VTK_ARIAL);  };
00164   void SetFontFamilyToCourier() { this->SetFontFamily(VTK_COURIER);};
00165   void SetFontFamilyToTimes()   { this->SetFontFamily(VTK_TIMES);  };
00167 #endif
00168 
00169 #ifndef VTK_REMOVE_LEGACY_CODE
00170 
00171 
00174   virtual void SetBold(int val);
00175   virtual int GetBold();
00176   vtkBooleanMacro(Bold, int);
00178 #endif
00179 
00180 #ifndef VTK_REMOVE_LEGACY_CODE
00181 
00182 
00185   virtual void SetItalic(int val);
00186   virtual int GetItalic();
00187   vtkBooleanMacro(Italic, int);
00189 #endif
00190 
00191 #ifndef VTK_REMOVE_LEGACY_CODE
00192 
00193 
00196   virtual void SetShadow(int val);
00197   virtual int GetShadow();
00198   vtkBooleanMacro(Shadow, int);
00200 #endif
00201   
00203 
00204   vtkSetStringMacro(LabelFormat);
00205   vtkGetStringMacro(LabelFormat);
00207 
00209 
00210   vtkSetStringMacro(Title);
00211   vtkGetStringMacro(Title);
00213 
00216   void ShallowCopy(vtkProp *prop);
00217 
00218 protected:
00219   vtkScalarBarActor();
00220   ~vtkScalarBarActor();
00221 
00222   vtkScalarsToColors *LookupTable;
00223   vtkTextProperty *TitleTextProperty;
00224   vtkTextProperty *LabelTextProperty;
00225 
00226   int   MaximumNumberOfColors;
00227   int   NumberOfLabels;
00228   int   NumberOfLabelsBuilt;
00229   int   Orientation;
00230   char  *Title;
00231   char  *LabelFormat;
00232 
00233   vtkTextMapper **TextMappers;
00234   virtual void AllocateAndSizeLabels(int *labelSize, int *size,
00235                                      vtkViewport *viewport, float *range);
00236 
00237 private:
00238   vtkTextMapper *TitleMapper;
00239   vtkActor2D    *TitleActor;
00240 
00241   vtkActor2D    **TextActors;
00242 
00243   vtkPolyData         *ScalarBar;
00244   vtkPolyDataMapper2D *ScalarBarMapper;
00245   vtkActor2D          *ScalarBarActor;
00246 
00247   vtkTimeStamp  BuildTime;
00248   int LastSize[2];
00249   int LastOrigin[2];
00250 
00251   void SizeTitle(int *titleSize, int *size, vtkViewport *viewport);
00252 
00253 private:
00254   vtkScalarBarActor(const vtkScalarBarActor&);  // Not implemented.
00255   void operator=(const vtkScalarBarActor&);  // Not implemented.
00256 };
00257 
00258 
00259 #endif
00260