VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Rendering/Annotation/vtkScalarBarActor.h
Go to the documentation of this file.
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 class vtkTexturedActor2D;
00075 
00076 #define VTK_ORIENT_HORIZONTAL 0
00077 #define VTK_ORIENT_VERTICAL 1
00078 
00079 class VTKRENDERINGANNOTATION_EXPORT vtkScalarBarActor : public vtkActor2D
00080 {
00081 public:
00082   vtkTypeMacro(vtkScalarBarActor,vtkActor2D);
00083   void PrintSelf(ostream& os, vtkIndent indent);
00084 
00088   static vtkScalarBarActor* New();
00089 
00091 
00092   int RenderOpaqueGeometry(vtkViewport* viewport);
00093   virtual int RenderTranslucentPolygonalGeometry(vtkViewport*) { return 0; };
00094   int RenderOverlay(vtkViewport* viewport);
00096 
00098   virtual int HasTranslucentPolygonalGeometry();
00099 
00103   virtual void ReleaseGraphicsResources(vtkWindow*);
00104 
00108   virtual void GetScalarBarRect(int rect[4], vtkViewport* viewport);
00109 
00111 
00115   virtual void SetLookupTable(vtkScalarsToColors*);
00116   vtkGetObjectMacro(LookupTable,vtkScalarsToColors);
00118 
00120 
00125   vtkSetMacro( UseOpacity, int );
00126   vtkGetMacro( UseOpacity, int );
00127   vtkBooleanMacro( UseOpacity, int );
00129 
00131 
00134   vtkSetClampMacro(MaximumNumberOfColors, int, 2, VTK_INT_MAX);
00135   vtkGetMacro(MaximumNumberOfColors, int);
00137 
00139 
00140   vtkSetClampMacro(NumberOfLabels, int, 0, 64);
00141   vtkGetMacro(NumberOfLabels, int);
00143 
00145 
00146   vtkSetClampMacro(Orientation,int,VTK_ORIENT_HORIZONTAL, VTK_ORIENT_VERTICAL);
00147   vtkGetMacro(Orientation, int);
00148   void SetOrientationToHorizontal()
00149        {this->SetOrientation(VTK_ORIENT_HORIZONTAL);}
00150   void SetOrientationToVertical() {this->SetOrientation(VTK_ORIENT_VERTICAL);}
00152 
00154 
00155   virtual void SetTitleTextProperty(vtkTextProperty* p);
00156   vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
00158 
00160 
00161   virtual void SetLabelTextProperty(vtkTextProperty* p);
00162   vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
00164 
00166 
00167   vtkSetStringMacro(LabelFormat);
00168   vtkGetStringMacro(LabelFormat);
00170 
00172 
00173   vtkSetStringMacro(Title);
00174   vtkGetStringMacro(Title);
00176 
00178 
00179   vtkSetStringMacro(ComponentTitle);
00180   vtkGetStringMacro(ComponentTitle);
00182 
00185   void ShallowCopy(vtkProp* prop);
00186 
00188 
00189   vtkSetMacro( TextureGridWidth, double );
00190   vtkGetMacro( TextureGridWidth, double );
00192 
00194 
00195   vtkGetObjectMacro( TextureActor, vtkTexturedActor2D );
00197 
00198 //BTX
00199   enum { PrecedeScalarBar = 0, SucceedScalarBar };
00200 //ETX
00201 
00203 
00209   vtkSetClampMacro( TextPosition, int, PrecedeScalarBar, SucceedScalarBar);
00210   vtkGetMacro( TextPosition, int );
00211   virtual void SetTextPositionToPrecedeScalarBar()
00212     { this->SetTextPosition( vtkScalarBarActor::PrecedeScalarBar ); }
00213   virtual void SetTextPositionToSucceedScalarBar()
00214     { this->SetTextPosition( vtkScalarBarActor::SucceedScalarBar ); }
00216 
00218 
00223   vtkSetMacro( MaximumWidthInPixels, int );
00224   vtkGetMacro( MaximumWidthInPixels, int );
00225   vtkSetMacro( MaximumHeightInPixels, int );
00226   vtkGetMacro( MaximumHeightInPixels, int );
00228 
00230 
00232   vtkSetMacro(AnnotationLeaderPadding, double);
00233   vtkGetMacro(AnnotationLeaderPadding, double);
00235 
00237 
00240   vtkSetMacro(DrawAnnotations, int);
00241   vtkGetMacro(DrawAnnotations, int);
00242   vtkBooleanMacro(DrawAnnotations, int);
00244 
00246 
00249   vtkSetMacro(DrawNanAnnotation, int);
00250   vtkGetMacro(DrawNanAnnotation, int);
00251   vtkBooleanMacro(DrawNanAnnotation, int);
00253 
00255 
00260   vtkSetMacro(FixedAnnotationLeaderLineColor, int);
00261   vtkGetMacro(FixedAnnotationLeaderLineColor, int);
00262   vtkBooleanMacro(FixedAnnotationLeaderLineColor, int);
00264 
00266 
00267   vtkSetStringMacro(NanAnnotation);
00268   vtkGetStringMacro(NanAnnotation);
00270 
00272 
00277   vtkSetMacro(AnnotationTextScaling,int);
00278   vtkGetMacro(AnnotationTextScaling,int);
00280 
00282 
00284   vtkSetMacro(DrawBackground, int);
00285   vtkGetMacro(DrawBackground, int);
00286   vtkBooleanMacro(DrawBackground, int);
00288 
00290 
00292   vtkSetMacro(DrawFrame, int);
00293   vtkGetMacro(DrawFrame, int);
00294   vtkBooleanMacro(DrawFrame, int);
00296 
00298 
00300   vtkSetMacro(DrawColorBar, int);
00301   vtkGetMacro(DrawColorBar, int);
00302   vtkBooleanMacro(DrawColorBar, int);
00304 
00306 
00307   vtkSetMacro(DrawTickLabels, int);
00308   vtkGetMacro(DrawTickLabels, int);
00309   vtkBooleanMacro(DrawTickLabels, int);
00311 
00313 
00314   virtual void SetBackgroundProperty(vtkProperty2D* p);
00315   vtkGetObjectMacro(BackgroundProperty,vtkProperty2D);
00317 
00319 
00320   virtual void SetFrameProperty(vtkProperty2D* p);
00321   vtkGetObjectMacro(FrameProperty,vtkProperty2D);
00323 
00325 
00327   vtkGetMacro(TextPad,int);
00328   vtkSetMacro(TextPad,int);
00330 
00332 
00334   vtkGetMacro(VerticalTitleSeparation,int);
00335   vtkSetMacro(VerticalTitleSeparation,int);
00337 
00339 
00341   vtkGetMacro(BarRatio,double);
00342   vtkSetClampMacro(BarRatio,double,0.,1.);
00344 
00346 
00350   vtkGetMacro(TitleRatio,double);
00351   vtkSetClampMacro(TitleRatio,double,0.,1.);
00353 
00354 protected:
00355   vtkScalarBarActor();
00356   ~vtkScalarBarActor();
00357 
00374   virtual void RebuildLayout(vtkViewport* viewport);
00375 
00377   virtual void FreeLayoutStorage();
00378 
00384   virtual void ComputeFrame();
00385 
00391   virtual void ComputeScalarBarThickness();
00392 
00396   virtual void LayoutNanSwatch();
00397 
00399   virtual void PrepareTitleText();
00400 
00407   virtual void LayoutTitle();
00408 
00414   virtual void ComputeScalarBarLength();
00415 
00421   virtual void LayoutTicks();
00422 
00426   virtual void LayoutAnnotations();
00427 
00429   virtual void ConfigureAnnotations();
00430 
00433   virtual void ConfigureFrame();
00434 
00436   virtual void DrawBoxes();
00437 
00440   virtual void ConfigureScalarBar();
00441 
00443   virtual void ConfigureTitle();
00444 
00446   virtual void ConfigureTicks();
00447 
00451   virtual void ConfigureNanSwatch();
00452 
00460   virtual void EditAnnotations() { }
00461 
00464   virtual void SizeTitle(double* titleSize, int* size, vtkViewport* viewport);
00465 
00467 
00469   int MapAnnotationLabels(
00470     vtkScalarsToColors* lkup, double start, double delta, const double* range);
00472 
00474 
00476   int PlaceAnnotationsVertically(
00477     double barX, double barY, double barWidth, double barHeight,
00478     double delta, double pad);
00480 
00481 
00483   int PlaceAnnotationsHorizontally(
00484     double barX, double barY, double barWidth, double barHeight,
00485     double delta, double pad);
00487 
00489 
00490   int MaximumNumberOfColors;
00491   int NumberOfLabels;
00492   int NumberOfLabelsBuilt;
00493   int Orientation;
00494   int DrawBackground; // off by default
00495   int DrawFrame; // off by default
00496   int DrawColorBar; // on by default
00497   int DrawTickLabels; // on by default
00498   int DrawAnnotations;
00499   int DrawNanAnnotation;
00500   int AnnotationTextScaling; // off by default
00501   int FixedAnnotationLeaderLineColor;
00502   vtkProperty2D* BackgroundProperty;
00503   vtkProperty2D* FrameProperty;
00504   char* Title;
00505   char* ComponentTitle;
00506   char* LabelFormat;
00507   int UseOpacity; // off by default
00508   double TextureGridWidth;
00509   int TextPosition;
00510   char* NanAnnotation;
00511   double AnnotationLeaderPadding;
00512   int MaximumWidthInPixels;
00513   int MaximumHeightInPixels;
00514   int TextPad;
00515   int VerticalTitleSeparation;
00516   double BarRatio;
00517   double TitleRatio;
00519 
00521 
00522   vtkTimeStamp BuildTime; 
00523   int LastSize[2]; 
00524   int LastOrigin[2]; 
00525 
00526   vtkScalarBarActorInternal* P; 
00527 
00528   vtkScalarsToColors* LookupTable; 
00529 
00530   vtkTextProperty* TitleTextProperty; 
00531   vtkTextProperty* LabelTextProperty; 
00532   vtkTextActor* TitleActor; 
00533 
00534   vtkPolyData* ScalarBar; 
00535   vtkPolyDataMapper2D* ScalarBarMapper; 
00536   vtkActor2D* ScalarBarActor; 
00537   vtkPolyData* TexturePolyData; 
00538   vtkTexture* Texture; 
00539   vtkTexturedActor2D* TextureActor; 
00540 
00541   vtkPolyData* Background; 
00542   vtkPolyDataMapper2D* BackgroundMapper; 
00543   vtkActor2D* BackgroundActor; 
00544 
00545   vtkPolyData* Frame; 
00546   vtkPolyDataMapper2D* FrameMapper; 
00547   vtkActor2D* FrameActor; 
00548 
00549 
00550 private:
00551   vtkScalarBarActor(const vtkScalarBarActor&);  // Not implemented.
00552   void operator=(const vtkScalarBarActor&);  // Not implemented.
00553 };
00554 
00555 
00556 #endif
00557