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 "vtkRenderingAnnotationModule.h" // For export macro 00062 #include "vtkActor2D.h" 00063 00064 class vtkColor3ub; 00065 class vtkPolyData; 00066 class vtkPolyDataMapper2D; 00067 class vtkProperty2D; 00068 class vtkScalarsToColors; 00069 class vtkScalarBarActorInternal; 00070 class vtkTextActor; 00071 class vtkTextMapper; 00072 class vtkTextProperty; 00073 class vtkTexture; 00074 00075 #define VTK_ORIENT_HORIZONTAL 0 00076 #define VTK_ORIENT_VERTICAL 1 00077 00078 class VTKRENDERINGANNOTATION_EXPORT vtkScalarBarActor : public vtkActor2D 00079 { 00080 public: 00081 vtkTypeMacro(vtkScalarBarActor,vtkActor2D); 00082 void PrintSelf(ostream& os, vtkIndent indent); 00083 00087 static vtkScalarBarActor* New(); 00088 00090 00091 int RenderOpaqueGeometry(vtkViewport* viewport); 00092 virtual int RenderTranslucentPolygonalGeometry(vtkViewport*) { return 0; }; 00093 int RenderOverlay(vtkViewport* viewport); 00095 00097 virtual int HasTranslucentPolygonalGeometry(); 00098 00102 virtual void ReleaseGraphicsResources(vtkWindow*); 00103 00107 virtual void GetScalarBarRect(int rect[4], vtkViewport* viewport); 00108 00110 00114 virtual void SetLookupTable(vtkScalarsToColors*); 00115 vtkGetObjectMacro(LookupTable,vtkScalarsToColors); 00117 00119 00124 vtkSetMacro( UseOpacity, int ); 00125 vtkGetMacro( UseOpacity, int ); 00126 vtkBooleanMacro( UseOpacity, int ); 00128 00130 00133 vtkSetClampMacro(MaximumNumberOfColors, int, 2, VTK_INT_MAX); 00134 vtkGetMacro(MaximumNumberOfColors, int); 00136 00138 00139 vtkSetClampMacro(NumberOfLabels, int, 0, 64); 00140 vtkGetMacro(NumberOfLabels, int); 00142 00144 00145 vtkSetClampMacro(Orientation,int,VTK_ORIENT_HORIZONTAL, VTK_ORIENT_VERTICAL); 00146 vtkGetMacro(Orientation, int); 00147 void SetOrientationToHorizontal() 00148 {this->SetOrientation(VTK_ORIENT_HORIZONTAL);} 00149 void SetOrientationToVertical() {this->SetOrientation(VTK_ORIENT_VERTICAL);} 00151 00153 00154 virtual void SetTitleTextProperty(vtkTextProperty* p); 00155 vtkGetObjectMacro(TitleTextProperty,vtkTextProperty); 00157 00159 00160 virtual void SetLabelTextProperty(vtkTextProperty* p); 00161 vtkGetObjectMacro(LabelTextProperty,vtkTextProperty); 00163 00165 00166 vtkSetStringMacro(LabelFormat); 00167 vtkGetStringMacro(LabelFormat); 00169 00171 00172 vtkSetStringMacro(Title); 00173 vtkGetStringMacro(Title); 00175 00177 00178 vtkSetStringMacro(ComponentTitle); 00179 vtkGetStringMacro(ComponentTitle); 00181 00184 void ShallowCopy(vtkProp* prop); 00185 00187 00188 vtkSetMacro( TextureGridWidth, double ); 00189 vtkGetMacro( TextureGridWidth, double ); 00191 00193 00194 vtkGetObjectMacro( TextureActor, vtkActor2D ); 00196 00197 //BTX 00198 enum { PrecedeScalarBar = 0, SucceedScalarBar }; 00199 //ETX 00200 00202 00208 vtkSetClampMacro( TextPosition, int, PrecedeScalarBar, SucceedScalarBar); 00209 vtkGetMacro( TextPosition, int ); 00210 virtual void SetTextPositionToPrecedeScalarBar() 00211 { this->SetTextPosition( vtkScalarBarActor::PrecedeScalarBar ); } 00212 virtual void SetTextPositionToSucceedScalarBar() 00213 { this->SetTextPosition( vtkScalarBarActor::SucceedScalarBar ); } 00215 00217 00222 vtkSetMacro( MaximumWidthInPixels, int ); 00223 vtkGetMacro( MaximumWidthInPixels, int ); 00224 vtkSetMacro( MaximumHeightInPixels, int ); 00225 vtkGetMacro( MaximumHeightInPixels, int ); 00227 00229 00231 vtkSetMacro(AnnotationLeaderPadding, double); 00232 vtkGetMacro(AnnotationLeaderPadding, double); 00234 00236 00239 vtkSetMacro(DrawAnnotations, int); 00240 vtkGetMacro(DrawAnnotations, int); 00241 vtkBooleanMacro(DrawAnnotations, int); 00243 00245 00248 vtkSetMacro(DrawNanAnnotation, int); 00249 vtkGetMacro(DrawNanAnnotation, int); 00250 vtkBooleanMacro(DrawNanAnnotation, int); 00252 00254 00259 vtkSetMacro(FixedAnnotationLeaderLineColor, int); 00260 vtkGetMacro(FixedAnnotationLeaderLineColor, int); 00261 vtkBooleanMacro(FixedAnnotationLeaderLineColor, int); 00263 00265 00266 vtkSetStringMacro(NanAnnotation); 00267 vtkGetStringMacro(NanAnnotation); 00269 00271 00276 vtkSetMacro(AnnotationTextScaling,int); 00277 vtkGetMacro(AnnotationTextScaling,int); 00279 00281 00283 vtkSetMacro(DrawBackground, int); 00284 vtkGetMacro(DrawBackground, int); 00285 vtkBooleanMacro(DrawBackground, int); 00287 00289 00291 vtkSetMacro(DrawFrame, int); 00292 vtkGetMacro(DrawFrame, int); 00293 vtkBooleanMacro(DrawFrame, int); 00295 00297 00299 vtkSetMacro(DrawColorBar, int); 00300 vtkGetMacro(DrawColorBar, int); 00301 vtkBooleanMacro(DrawColorBar, int); 00303 00305 00306 vtkSetMacro(DrawTickLabels, int); 00307 vtkGetMacro(DrawTickLabels, int); 00308 vtkBooleanMacro(DrawTickLabels, int); 00310 00312 00313 virtual void SetBackgroundProperty(vtkProperty2D* p); 00314 vtkGetObjectMacro(BackgroundProperty,vtkProperty2D); 00316 00318 00319 virtual void SetFrameProperty(vtkProperty2D* p); 00320 vtkGetObjectMacro(FrameProperty,vtkProperty2D); 00322 00324 00326 vtkGetMacro(TextPad,int); 00327 vtkSetMacro(TextPad,int); 00329 00331 00333 vtkGetMacro(VerticalTitleSeparation,int); 00334 vtkSetMacro(VerticalTitleSeparation,int); 00336 00338 00340 vtkGetMacro(BarRatio,double); 00341 vtkSetClampMacro(BarRatio,double,0.,1.); 00343 00345 00349 vtkGetMacro(TitleRatio,double); 00350 vtkSetClampMacro(TitleRatio,double,0.,1.); 00352 00353 protected: 00354 vtkScalarBarActor(); 00355 ~vtkScalarBarActor(); 00356 00373 virtual void RebuildLayout(vtkViewport* viewport); 00374 00376 virtual void FreeLayoutStorage(); 00377 00383 virtual void ComputeFrame(); 00384 00390 virtual void ComputeScalarBarThickness(); 00391 00395 virtual void LayoutNanSwatch(); 00396 00398 virtual void PrepareTitleText(); 00399 00406 virtual void LayoutTitle(); 00407 00413 virtual void ComputeScalarBarLength(); 00414 00420 virtual void LayoutTicks(); 00421 00425 virtual void LayoutAnnotations(); 00426 00428 virtual void ConfigureAnnotations(); 00429 00432 virtual void ConfigureFrame(); 00433 00435 virtual void DrawBoxes(); 00436 00439 virtual void ConfigureScalarBar(); 00440 00442 virtual void ConfigureTitle(); 00443 00445 virtual void ConfigureTicks(); 00446 00450 virtual void ConfigureNanSwatch(); 00451 00459 virtual void EditAnnotations() { } 00460 00463 virtual void SizeTitle(double* titleSize, int* size, vtkViewport* viewport); 00464 00466 00468 int MapAnnotationLabels( 00469 vtkScalarsToColors* lkup, double start, double delta, double* range); 00471 00473 00475 int PlaceAnnotationsVertically( 00476 double barX, double barY, double barWidth, double barHeight, 00477 double delta, double pad); 00479 00480 00482 int PlaceAnnotationsHorizontally( 00483 double barX, double barY, double barWidth, double barHeight, 00484 double delta, double pad); 00486 00488 00489 int MaximumNumberOfColors; 00490 int NumberOfLabels; 00491 int NumberOfLabelsBuilt; 00492 int Orientation; 00493 int DrawBackground; // off by default 00494 int DrawFrame; // off by default 00495 int DrawColorBar; // on by default 00496 int DrawTickLabels; // on by default 00497 int DrawAnnotations; 00498 int DrawNanAnnotation; 00499 int AnnotationTextScaling; // off by default 00500 int FixedAnnotationLeaderLineColor; 00501 vtkProperty2D* BackgroundProperty; 00502 vtkProperty2D* FrameProperty; 00503 char* Title; 00504 char* ComponentTitle; 00505 char* LabelFormat; 00506 int UseOpacity; // off by default 00507 double TextureGridWidth; 00508 int TextPosition; 00509 char* NanAnnotation; 00510 double AnnotationLeaderPadding; 00511 int MaximumWidthInPixels; 00512 int MaximumHeightInPixels; 00513 int TextPad; 00514 int VerticalTitleSeparation; 00515 double BarRatio; 00516 double TitleRatio; 00518 00520 00521 vtkTimeStamp BuildTime; 00522 int LastSize[2]; 00523 int LastOrigin[2]; 00524 00525 vtkScalarBarActorInternal* P; 00526 00527 vtkScalarsToColors* LookupTable; 00528 00529 vtkTextProperty* TitleTextProperty; 00530 vtkTextProperty* LabelTextProperty; 00531 vtkTextActor* TitleActor; 00532 00533 vtkPolyData* ScalarBar; 00534 vtkPolyDataMapper2D* ScalarBarMapper; 00535 vtkActor2D* ScalarBarActor; 00536 vtkPolyData* TexturePolyData; 00537 vtkTexture* Texture; 00538 vtkActor2D* TextureActor; 00539 00540 vtkPolyData* Background; 00541 vtkPolyDataMapper2D* BackgroundMapper; 00542 vtkActor2D* BackgroundActor; 00543 00544 vtkPolyData* Frame; 00545 vtkPolyDataMapper2D* FrameMapper; 00546 vtkActor2D* FrameActor; 00547 00548 00549 private: 00550 vtkScalarBarActor(const vtkScalarBarActor&); // Not implemented. 00551 void operator=(const vtkScalarBarActor&); // Not implemented. 00552 }; 00553 00554 00555 #endif 00556