VTK  9.2.5
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 =========================================================================*/
78 #ifndef vtkCornerAnnotation_h
79 #define vtkCornerAnnotation_h
80 
81 #include "vtkActor2D.h"
82 #include "vtkRenderingAnnotationModule.h" // For export macro
83 
84 class vtkTextMapper;
86 class vtkImageActor;
87 class vtkTextProperty;
88 
89 class VTKRENDERINGANNOTATION_EXPORT vtkCornerAnnotation : public vtkActor2D
90 {
91 public:
93  void PrintSelf(ostream& os, vtkIndent indent) override;
94 
100 
102 
105  int RenderOpaqueGeometry(vtkViewport* viewport) override;
106  int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
107  int RenderOverlay(vtkViewport* viewport) override;
109 
114 
116 
121  vtkSetMacro(MaximumLineHeight, double);
122  vtkGetMacro(MaximumLineHeight, double);
124 
126 
130  vtkSetMacro(MinimumFontSize, int);
131  vtkGetMacro(MinimumFontSize, int);
132  vtkSetMacro(MaximumFontSize, int);
133  vtkGetMacro(MaximumFontSize, int);
135 
137 
146  vtkSetMacro(LinearFontScaleFactor, double);
147  vtkGetMacro(LinearFontScaleFactor, double);
148  vtkSetMacro(NonlinearFontScaleFactor, double);
149  vtkGetMacro(NonlinearFontScaleFactor, double);
151 
158 
160 
165  {
166  LowerLeft = 0,
173  UpperEdge
174  };
175  static const int NumTextPositions = 8;
177 
179 
183  void SetText(int i, const char* text);
184  const char* GetText(int i);
188 
190 
194  vtkGetObjectMacro(ImageActor, vtkImageActor);
196 
198 
203  vtkGetObjectMacro(WindowLevel, vtkImageMapToWindowLevelColors);
205 
207 
210  vtkSetMacro(LevelShift, double);
211  vtkGetMacro(LevelShift, double);
213 
215 
218  vtkSetMacro(LevelScale, double);
219  vtkGetMacro(LevelScale, double);
221 
223 
227  vtkGetObjectMacro(TextProperty, vtkTextProperty);
229 
231 
234  vtkBooleanMacro(ShowSliceAndImage, vtkTypeBool);
235  vtkSetMacro(ShowSliceAndImage, vtkTypeBool);
236  vtkGetMacro(ShowSliceAndImage, vtkTypeBool);
238 
239 protected:
242 
244 
246 
248  double LevelShift;
249  double LevelScale;
252 
253  char* CornerText[NumTextPositions];
254 
255  int FontSize;
256  vtkActor2D* TextActor[NumTextPositions];
258  int LastSize[2];
259  vtkTextMapper* TextMapper[NumTextPositions];
260 
263 
266 
268 
273 
275 
278  virtual void SetTextActorsPosition(const int vsize[2]);
281 
282 private:
283  vtkCornerAnnotation(const vtkCornerAnnotation&) = delete;
284  void operator=(const vtkCornerAnnotation&) = delete;
285 };
286 
287 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:155
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
Map an image through a lookup table and/or a window/level.
a simple class to control print indentation
Definition: vtkIndent.h:119
2D text annotation
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:55
abstract specification for Viewports
Definition: vtkViewport.h:56
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
int vtkTypeBool
Definition: vtkABI.h:69