VTK  9.2.6
vtkCornerAnnotation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCornerAnnotation.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
48 #ifndef vtkCornerAnnotation_h
49 #define vtkCornerAnnotation_h
50 
51 #include "vtkActor2D.h"
52 #include "vtkRenderingAnnotationModule.h" // For export macro
53 
54 class vtkTextMapper;
56 class vtkImageActor;
57 class vtkTextProperty;
58 
59 class VTKRENDERINGANNOTATION_EXPORT vtkCornerAnnotation : public vtkActor2D
60 {
61 public:
63  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
70 
72 
75  int RenderOpaqueGeometry(vtkViewport* viewport) override;
76  int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
77  int RenderOverlay(vtkViewport* viewport) override;
79 
84 
86 
91  vtkSetMacro(MaximumLineHeight, double);
92  vtkGetMacro(MaximumLineHeight, double);
94 
96 
100  vtkSetMacro(MinimumFontSize, int);
101  vtkGetMacro(MinimumFontSize, int);
102  vtkSetMacro(MaximumFontSize, int);
103  vtkGetMacro(MaximumFontSize, int);
105 
107 
116  vtkSetMacro(LinearFontScaleFactor, double);
117  vtkGetMacro(LinearFontScaleFactor, double);
118  vtkSetMacro(NonlinearFontScaleFactor, double);
119  vtkGetMacro(NonlinearFontScaleFactor, double);
121 
128 
130 
135  {
136  LowerLeft = 0,
143  UpperEdge
144  };
145  static const int NumTextPositions = 8;
147 
149 
153  void SetText(int i, const char* text);
154  const char* GetText(int i);
158 
160 
164  vtkGetObjectMacro(ImageActor, vtkImageActor);
166 
168 
173  vtkGetObjectMacro(WindowLevel, vtkImageMapToWindowLevelColors);
175 
177 
180  vtkSetMacro(LevelShift, double);
181  vtkGetMacro(LevelShift, double);
183 
185 
188  vtkSetMacro(LevelScale, double);
189  vtkGetMacro(LevelScale, double);
191 
193 
197  vtkGetObjectMacro(TextProperty, vtkTextProperty);
199 
201 
204  vtkBooleanMacro(ShowSliceAndImage, vtkTypeBool);
205  vtkSetMacro(ShowSliceAndImage, vtkTypeBool);
206  vtkGetMacro(ShowSliceAndImage, vtkTypeBool);
208 
209 protected:
212 
214 
216 
218  double LevelShift;
219  double LevelScale;
222 
223  char* CornerText[NumTextPositions];
224 
225  int FontSize;
226  vtkActor2D* TextActor[NumTextPositions];
228  int LastSize[2];
229  vtkTextMapper* TextMapper[NumTextPositions];
230 
233 
236 
238 
243 
245 
248  virtual void SetTextActorsPosition(const int vsize[2]);
251 
252 private:
253  vtkCornerAnnotation(const vtkCornerAnnotation&) = delete;
254  void operator=(const vtkCornerAnnotation&) = delete;
255 };
256 
257 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:55
text annotation in four corners
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Draw the scalar bar and annotation text to the screen.
virtual void SetTextActorsPosition(const int vsize[2])
Set text actor positions given a viewport size and justification.
virtual void SetTextActorsJustification()
Set text actor positions given a viewport size and justification.
TextPosition
Position used to get or set the corner annotation text.
@ LowerEdge
Uses the lower edge center.
@ UpperLeft
Uses the upper left corner.
@ LeftEdge
Uses the left edge center.
@ UpperRight
Uses the upper right corner.
@ RightEdge
Uses the right edge center.
@ LowerRight
Uses the lower right corner.
static vtkCornerAnnotation * New()
Instantiate object with a rectangle in normaled view coordinates of (0.2,0.85, 0.8,...
~vtkCornerAnnotation() override
virtual void SetTextProperty(vtkTextProperty *p)
Set/Get the text property of all corners.
int RenderOpaqueGeometry(vtkViewport *viewport) override
Draw the scalar bar and annotation text to the screen.
vtkImageActor * ImageActor
vtkImageMapToWindowLevelColors * WindowLevel
void SetWindowLevel(vtkImageMapToWindowLevelColors *)
Set an instance of vtkImageMapToWindowLevelColors to use for looking at window level changes.
void SetText(int i, const char *text)
Set/Get the text to be displayed for each corner.
virtual void TextReplace(vtkImageActor *ia, vtkImageMapToWindowLevelColors *wl)
Search for replaceable tokens and replace.
void SetImageActor(vtkImageActor *)
Set an image actor to look at for slice information.
vtkTextProperty * TextProperty
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkImageActor * LastImageActor
void ClearAllTexts()
Set/Get the text to be displayed for each corner.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
int RenderOverlay(vtkViewport *viewport) override
Draw the scalar bar and annotation text to the screen.
void CopyAllTextsFrom(vtkCornerAnnotation *ca)
Set/Get the text to be displayed for each corner.
const char * GetText(int i)
Set/Get the text to be displayed for each corner.
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
draw an image in a rendered 3D scene
Definition: vtkImageActor.h:58
Map an image through a lookup table and/or a window/level.
a simple class to control print indentation
Definition: vtkIndent.h:49
2D text annotation
Definition: vtkTextMapper.h:60
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:45
abstract specification for Viewports
Definition: vtkViewport.h:65
window superclass for vtkRenderWindow
Definition: vtkWindow.h:48
int vtkTypeBool
Definition: vtkABI.h:69