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 vtkProperty2D; 00066 class vtkScalarsToColors; 00067 class vtkTextMapper; 00068 class vtkTextProperty; 00069 class vtkTexture; 00070 00071 #define VTK_ORIENT_HORIZONTAL 0 00072 #define VTK_ORIENT_VERTICAL 1 00073 00074 class VTK_RENDERING_EXPORT vtkScalarBarActor : public vtkActor2D 00075 { 00076 public: 00077 vtkTypeMacro(vtkScalarBarActor,vtkActor2D); 00078 void PrintSelf(ostream& os, vtkIndent indent); 00079 00083 static vtkScalarBarActor *New(); 00084 00086 00087 int RenderOpaqueGeometry(vtkViewport* viewport); 00088 virtual int RenderTranslucentPolygonalGeometry(vtkViewport*) { return 0; }; 00089 int RenderOverlay(vtkViewport* viewport); 00091 00093 virtual int HasTranslucentPolygonalGeometry(); 00094 00098 virtual void ReleaseGraphicsResources(vtkWindow *); 00099 00101 00104 virtual void SetLookupTable(vtkScalarsToColors*); 00105 vtkGetObjectMacro(LookupTable,vtkScalarsToColors); 00107 00109 00114 vtkSetMacro( UseOpacity, int ); 00115 vtkGetMacro( UseOpacity, int ); 00116 vtkBooleanMacro( UseOpacity, int ); 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 00155 00156 vtkSetStringMacro(LabelFormat); 00157 vtkGetStringMacro(LabelFormat); 00159 00161 00162 vtkSetStringMacro(Title); 00163 vtkGetStringMacro(Title); 00165 00167 00168 vtkSetStringMacro(ComponentTitle); 00169 vtkGetStringMacro(ComponentTitle); 00171 00174 void ShallowCopy(vtkProp *prop); 00175 00177 00178 vtkSetMacro( TextureGridWidth, double ); 00179 vtkGetMacro( TextureGridWidth, double ); 00181 00183 00184 vtkGetObjectMacro( TextureActor, vtkActor2D ); 00186 00187 //BTX 00188 enum { PrecedeScalarBar = 0, SucceedScalarBar }; 00189 //ETX 00190 00192 00196 vtkSetClampMacro( TextPosition, int, PrecedeScalarBar, SucceedScalarBar); 00197 vtkGetMacro( TextPosition, int ); 00198 virtual void SetTextPositionToPrecedeScalarBar() 00199 { this->SetTextPosition( vtkScalarBarActor::PrecedeScalarBar ); } 00200 virtual void SetTextPositionToSucceedScalarBar() 00201 { this->SetTextPosition( vtkScalarBarActor::SucceedScalarBar ); } 00203 00205 00210 vtkSetMacro( MaximumWidthInPixels, int ); 00211 vtkGetMacro( MaximumWidthInPixels, int ); 00212 vtkSetMacro( MaximumHeightInPixels, int ); 00213 vtkGetMacro( MaximumHeightInPixels, int ); 00215 00217 00219 vtkSetMacro( DrawBackground, int ); 00220 vtkGetMacro( DrawBackground, int ); 00221 vtkBooleanMacro( DrawBackground, int ); 00223 00225 00227 vtkSetMacro( DrawFrame, int ); 00228 vtkGetMacro( DrawFrame, int ); 00229 vtkBooleanMacro( DrawFrame, int ); 00231 00233 00234 virtual void SetBackgroundProperty(vtkProperty2D *p); 00235 vtkGetObjectMacro(BackgroundProperty,vtkProperty2D); 00237 00239 00240 virtual void SetFrameProperty(vtkProperty2D *p); 00241 vtkGetObjectMacro(FrameProperty,vtkProperty2D); 00243 00244 protected: 00245 vtkScalarBarActor(); 00246 ~vtkScalarBarActor(); 00247 00248 vtkScalarsToColors *LookupTable; 00249 vtkTextProperty *TitleTextProperty; 00250 vtkTextProperty *LabelTextProperty; 00251 00252 int MaximumNumberOfColors; 00253 int NumberOfLabels; 00254 int NumberOfLabelsBuilt; 00255 int Orientation; 00256 char *Title; 00257 char* ComponentTitle; 00258 char *LabelFormat; 00259 int UseOpacity; // off by default 00260 double TextureGridWidth; 00261 int TextPosition; 00262 00263 vtkTextMapper **TextMappers; 00264 vtkActor2D **TextActors; 00265 virtual void AllocateAndSizeLabels(int *labelSize, int *size, 00266 vtkViewport *viewport, double *range); 00267 00268 vtkTextMapper *TitleMapper; 00269 vtkActor2D *TitleActor; 00270 virtual void SizeTitle(int *titleSize, int *size, vtkViewport *viewport); 00271 00272 vtkPolyData *ScalarBar; 00273 vtkPolyDataMapper2D *ScalarBarMapper; 00274 vtkActor2D *ScalarBarActor; 00275 00276 vtkPolyData *TexturePolyData; 00277 vtkTexture *Texture; 00278 vtkActor2D *TextureActor; 00279 00280 vtkTimeStamp BuildTime; 00281 int LastSize[2]; 00282 int LastOrigin[2]; 00283 00284 int MaximumWidthInPixels; 00285 int MaximumHeightInPixels; 00286 00287 vtkProperty2D *BackgroundProperty; 00288 vtkProperty2D *FrameProperty; 00289 00290 int DrawBackground; // off by default 00291 int DrawFrame; // off by default 00292 00293 vtkPolyData *Background; 00294 vtkPolyDataMapper2D *BackgroundMapper; 00295 vtkActor2D *BackgroundActor; 00296 vtkPolyData *Frame; 00297 vtkPolyDataMapper2D *FrameMapper; 00298 vtkActor2D *FrameActor; 00299 00300 private: 00301 vtkScalarBarActor(const vtkScalarBarActor&); // Not implemented. 00302 void operator=(const vtkScalarBarActor&); // Not implemented. 00303 }; 00304 00305 00306 #endif 00307