VTK
dox/Rendering/Annotation/vtkCornerAnnotation.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkCornerAnnotation.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 =========================================================================*/
00035 #ifndef __vtkCornerAnnotation_h
00036 #define __vtkCornerAnnotation_h
00037 
00038 #include "vtkRenderingAnnotationModule.h" // For export macro
00039 #include "vtkActor2D.h"
00040 
00041 class vtkTextMapper;
00042 class vtkImageMapToWindowLevelColors;
00043 class vtkImageActor;
00044 class vtkTextProperty;
00045 
00046 class VTKRENDERINGANNOTATION_EXPORT vtkCornerAnnotation : public vtkActor2D
00047 {
00048 public:
00049   vtkTypeMacro(vtkCornerAnnotation,vtkActor2D);
00050   void PrintSelf(ostream& os, vtkIndent indent);
00051 
00054   static vtkCornerAnnotation *New();
00055 
00057 
00058   int RenderOpaqueGeometry(vtkViewport* viewport);
00059   virtual int RenderTranslucentPolygonalGeometry(vtkViewport* ) {return 0;};
00060   int RenderOverlay(vtkViewport* viewport);
00062 
00064   virtual int HasTranslucentPolygonalGeometry();
00065 
00067 
00069   vtkSetMacro(MaximumLineHeight,double);
00070   vtkGetMacro(MaximumLineHeight,double);
00072 
00074 
00076   vtkSetMacro(MinimumFontSize,int);
00077   vtkGetMacro(MinimumFontSize,int);
00078   vtkSetMacro(MaximumFontSize,int);
00079   vtkGetMacro(MaximumFontSize,int);
00081 
00083 
00089   vtkSetMacro( LinearFontScaleFactor, double );
00090   vtkGetMacro( LinearFontScaleFactor, double );
00091   vtkSetMacro( NonlinearFontScaleFactor, double );
00092   vtkGetMacro( NonlinearFontScaleFactor, double );
00094 
00098   virtual void ReleaseGraphicsResources(vtkWindow *);
00099 
00101 
00102   void SetText(int i, const char *text);
00103   const char* GetText(int i);
00104   void ClearAllTexts();
00105   void CopyAllTextsFrom(vtkCornerAnnotation *ca);
00107 
00109 
00110   void SetImageActor(vtkImageActor*);
00111   vtkGetObjectMacro(ImageActor,vtkImageActor);
00113 
00115 
00117   void SetWindowLevel(vtkImageMapToWindowLevelColors*);
00118   vtkGetObjectMacro(WindowLevel,vtkImageMapToWindowLevelColors);
00120 
00122 
00123   vtkSetMacro(LevelShift, double);
00124   vtkGetMacro(LevelShift, double);
00126 
00128 
00129   vtkSetMacro(LevelScale, double);
00130   vtkGetMacro(LevelScale, double);
00132 
00134 
00135   virtual void SetTextProperty(vtkTextProperty *p);
00136   vtkGetObjectMacro(TextProperty,vtkTextProperty);
00138 
00140 
00142   vtkBooleanMacro(ShowSliceAndImage, int);
00143   vtkSetMacro(ShowSliceAndImage, int);
00144   vtkGetMacro(ShowSliceAndImage, int);
00146 
00147 protected:
00148   vtkCornerAnnotation();
00149   ~vtkCornerAnnotation();
00150 
00151   double MaximumLineHeight;
00152 
00153   vtkTextProperty *TextProperty;
00154 
00155   vtkImageMapToWindowLevelColors *WindowLevel;
00156   double LevelShift;
00157   double LevelScale;
00158   vtkImageActor *ImageActor;
00159   vtkImageActor *LastImageActor;
00160 
00161   char *CornerText[4];
00162 
00163   int FontSize;
00164   vtkActor2D    *TextActor[4];
00165   vtkTimeStamp   BuildTime;
00166   int            LastSize[2];
00167   vtkTextMapper *TextMapper[4];
00168 
00169   int MinimumFontSize;
00170   int MaximumFontSize;
00171 
00172   double LinearFontScaleFactor;
00173   double NonlinearFontScaleFactor;
00174 
00175   int ShowSliceAndImage;
00176 
00178 
00179   virtual void TextReplace(
00180     vtkImageActor *ia, vtkImageMapToWindowLevelColors *wl);
00182 
00184 
00185   virtual void SetTextActorsPosition(int vsize[2]);
00186   virtual void SetTextActorsJustification();
00188 
00189 private:
00190   vtkCornerAnnotation(const vtkCornerAnnotation&);  // Not implemented.
00191   void operator=(const vtkCornerAnnotation&);  // Not implemented.
00192 };
00193 
00194 
00195 #endif
00196 
00197 
00198