VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkScalarBarActor.h 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 class vtkTexture; 00069 00070 #define VTK_ORIENT_HORIZONTAL 0 00071 #define VTK_ORIENT_VERTICAL 1 00072 00073 class VTK_RENDERING_EXPORT vtkScalarBarActor : public vtkActor2D 00074 { 00075 public: 00076 vtkTypeMacro(vtkScalarBarActor,vtkActor2D); 00077 void PrintSelf(ostream& os, vtkIndent indent); 00078 00082 static vtkScalarBarActor *New(); 00083 00085 00086 int RenderOpaqueGeometry(vtkViewport* viewport); 00087 virtual int RenderTranslucentPolygonalGeometry(vtkViewport*) { return 0; }; 00088 int RenderOverlay(vtkViewport* viewport); 00090 00092 virtual int HasTranslucentPolygonalGeometry(); 00093 00097 virtual void ReleaseGraphicsResources(vtkWindow *); 00098 00100 00103 virtual void SetLookupTable(vtkScalarsToColors*); 00104 vtkGetObjectMacro(LookupTable,vtkScalarsToColors); 00106 00108 00113 vtkSetMacro( UseOpacity, int ); 00114 vtkGetMacro( UseOpacity, int ); 00115 vtkBooleanMacro( UseOpacity, int ); 00117 00119 00122 vtkSetClampMacro(MaximumNumberOfColors, int, 2, VTK_LARGE_INTEGER); 00123 vtkGetMacro(MaximumNumberOfColors, int); 00125 00127 00128 vtkSetClampMacro(NumberOfLabels, int, 0, 64); 00129 vtkGetMacro(NumberOfLabels, int); 00131 00133 00134 vtkSetClampMacro(Orientation,int,VTK_ORIENT_HORIZONTAL, VTK_ORIENT_VERTICAL); 00135 vtkGetMacro(Orientation, int); 00136 void SetOrientationToHorizontal() 00137 {this->SetOrientation(VTK_ORIENT_HORIZONTAL);}; 00138 void SetOrientationToVertical() {this->SetOrientation(VTK_ORIENT_VERTICAL);}; 00140 00142 00143 virtual void SetTitleTextProperty(vtkTextProperty *p); 00144 vtkGetObjectMacro(TitleTextProperty,vtkTextProperty); 00146 00148 00149 virtual void SetLabelTextProperty(vtkTextProperty *p); 00150 vtkGetObjectMacro(LabelTextProperty,vtkTextProperty); 00152 00154 00155 vtkSetStringMacro(LabelFormat); 00156 vtkGetStringMacro(LabelFormat); 00158 00160 00161 vtkSetStringMacro(Title); 00162 vtkGetStringMacro(Title); 00164 00166 00167 vtkSetStringMacro(ComponentTitle); 00168 vtkGetStringMacro(ComponentTitle); 00170 00173 void ShallowCopy(vtkProp *prop); 00174 00176 00177 vtkSetMacro( TextureGridWidth, double ); 00178 vtkGetMacro( TextureGridWidth, double ); 00180 00182 00183 vtkGetObjectMacro( TextureActor, vtkActor2D ); 00185 00186 //BTX 00187 enum { PrecedeScalarBar = 0, SucceedScalarBar }; 00188 //ETX 00189 00191 00195 vtkSetClampMacro( TextPosition, int, PrecedeScalarBar, SucceedScalarBar); 00196 vtkGetMacro( TextPosition, int ); 00197 virtual void SetTextPositionToPrecedeScalarBar() 00198 { this->SetTextPosition( vtkScalarBarActor::PrecedeScalarBar ); } 00199 virtual void SetTextPositionToSucceedScalarBar() 00200 { this->SetTextPosition( vtkScalarBarActor::SucceedScalarBar ); } 00202 00204 00209 vtkSetMacro( MaximumWidthInPixels, int ); 00210 vtkGetMacro( MaximumWidthInPixels, int ); 00211 vtkSetMacro( MaximumHeightInPixels, int ); 00212 vtkGetMacro( MaximumHeightInPixels, int ); 00214 00215 protected: 00216 vtkScalarBarActor(); 00217 ~vtkScalarBarActor(); 00218 00219 vtkScalarsToColors *LookupTable; 00220 vtkTextProperty *TitleTextProperty; 00221 vtkTextProperty *LabelTextProperty; 00222 00223 int MaximumNumberOfColors; 00224 int NumberOfLabels; 00225 int NumberOfLabelsBuilt; 00226 int Orientation; 00227 char *Title; 00228 char* ComponentTitle; 00229 char *LabelFormat; 00230 int UseOpacity; // off by default 00231 double TextureGridWidth; 00232 int TextPosition; 00233 00234 vtkTextMapper **TextMappers; 00235 vtkActor2D **TextActors; 00236 virtual void AllocateAndSizeLabels(int *labelSize, int *size, 00237 vtkViewport *viewport, double *range); 00238 00239 vtkTextMapper *TitleMapper; 00240 vtkActor2D *TitleActor; 00241 virtual void SizeTitle(int *titleSize, int *size, vtkViewport *viewport); 00242 00243 vtkPolyData *ScalarBar; 00244 vtkPolyDataMapper2D *ScalarBarMapper; 00245 vtkActor2D *ScalarBarActor; 00246 00247 vtkPolyData *TexturePolyData; 00248 vtkTexture *Texture; 00249 vtkActor2D *TextureActor; 00250 00251 vtkTimeStamp BuildTime; 00252 int LastSize[2]; 00253 int LastOrigin[2]; 00254 00255 int MaximumWidthInPixels; 00256 int MaximumHeightInPixels; 00257 00258 private: 00259 vtkScalarBarActor(const vtkScalarBarActor&); // Not implemented. 00260 void operator=(const vtkScalarBarActor&); // Not implemented. 00261 }; 00262 00263 00264 #endif 00265