Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class 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 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm 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 =========================================================================*/
00058 #ifndef __vtkScalarBarActor_h
00059 #define __vtkScalarBarActor_h
00060 
00061 #include "vtkActor2D.h"
00062 
00063 class vtkPolyData;
00064 class vtkPolyDataMapper2D;
00065 class vtkScalarsToColors;
00066 class vtkTextMapper;
00067 class vtkTextProperty;
00068 
00069 #define VTK_ORIENT_HORIZONTAL 0
00070 #define VTK_ORIENT_VERTICAL 1
00071 
00072 class VTK_RENDERING_EXPORT vtkScalarBarActor : public vtkActor2D
00073 {
00074 public:
00075   vtkTypeRevisionMacro(vtkScalarBarActor,vtkActor2D);
00076   void PrintSelf(ostream& os, vtkIndent indent);
00077 
00081   static vtkScalarBarActor *New();
00082 
00084 
00085   int RenderOpaqueGeometry(vtkViewport* viewport);
00086   int RenderTranslucentGeometry(vtkViewport*) { return 0; };
00087   int RenderOverlay(vtkViewport* viewport);
00089 
00093   virtual void ReleaseGraphicsResources(vtkWindow *);
00094 
00096 
00099   virtual void SetLookupTable(vtkScalarsToColors*);
00100   vtkGetObjectMacro(LookupTable,vtkScalarsToColors);
00102 
00104 
00107   vtkSetClampMacro(MaximumNumberOfColors, int, 2, VTK_LARGE_INTEGER);
00108   vtkGetMacro(MaximumNumberOfColors, int);
00110   
00112 
00113   vtkSetClampMacro(NumberOfLabels, int, 0, 64);
00114   vtkGetMacro(NumberOfLabels, int);
00116   
00118 
00119   vtkSetClampMacro(Orientation,int,VTK_ORIENT_HORIZONTAL, VTK_ORIENT_VERTICAL);
00120   vtkGetMacro(Orientation, int);
00121   void SetOrientationToHorizontal()
00122        {this->SetOrientation(VTK_ORIENT_HORIZONTAL);};
00123   void SetOrientationToVertical() {this->SetOrientation(VTK_ORIENT_VERTICAL);};
00125 
00127 
00128   virtual void SetTitleTextProperty(vtkTextProperty *p);
00129   vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
00131   
00133 
00134   virtual void SetLabelTextProperty(vtkTextProperty *p);
00135   vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
00137     
00139 
00140   vtkSetStringMacro(LabelFormat);
00141   vtkGetStringMacro(LabelFormat);
00143 
00145 
00146   vtkSetStringMacro(Title);
00147   vtkGetStringMacro(Title);
00149 
00152   void ShallowCopy(vtkProp *prop);
00153 
00154 protected:
00155   vtkScalarBarActor();
00156   ~vtkScalarBarActor();
00157 
00158   vtkScalarsToColors *LookupTable;
00159   vtkTextProperty *TitleTextProperty;
00160   vtkTextProperty *LabelTextProperty;
00161 
00162   int   MaximumNumberOfColors;
00163   int   NumberOfLabels;
00164   int   NumberOfLabelsBuilt;
00165   int   Orientation;
00166   char  *Title;
00167   char  *LabelFormat;
00168 
00169   vtkTextMapper **TextMappers;
00170   virtual void AllocateAndSizeLabels(int *labelSize, int *size,
00171                                      vtkViewport *viewport, double *range);
00172 
00173 private:
00174   vtkTextMapper *TitleMapper;
00175   vtkActor2D    *TitleActor;
00176 
00177   vtkActor2D    **TextActors;
00178 
00179   vtkPolyData         *ScalarBar;
00180   vtkPolyDataMapper2D *ScalarBarMapper;
00181   vtkActor2D          *ScalarBarActor;
00182 
00183   vtkTimeStamp  BuildTime;
00184   int LastSize[2];
00185   int LastOrigin[2];
00186 
00187   void SizeTitle(int *titleSize, int *size, vtkViewport *viewport);
00188 
00189 private:
00190   vtkScalarBarActor(const vtkScalarBarActor&);  // Not implemented.
00191   void operator=(const vtkScalarBarActor&);  // Not implemented.
00192 };
00193 
00194 
00195 #endif
00196