VTK  9.1.0
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 =========================================================================*/
75 #ifndef vtkCornerAnnotation_h
76 #define vtkCornerAnnotation_h
77 
78 #include "vtkActor2D.h"
79 #include "vtkRenderingAnnotationModule.h" // For export macro
80 
81 class vtkTextMapper;
83 class vtkImageActor;
84 class vtkTextProperty;
85 
86 class VTKRENDERINGANNOTATION_EXPORT vtkCornerAnnotation : public vtkActor2D
87 {
88 public:
90  void PrintSelf(ostream& os, vtkIndent indent) override;
91 
97 
99 
102  int RenderOpaqueGeometry(vtkViewport* viewport) override;
103  int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
104  int RenderOverlay(vtkViewport* viewport) override;
106 
111 
113 
118  vtkSetMacro(MaximumLineHeight, double);
119  vtkGetMacro(MaximumLineHeight, double);
121 
123 
127  vtkSetMacro(MinimumFontSize, int);
128  vtkGetMacro(MinimumFontSize, int);
129  vtkSetMacro(MaximumFontSize, int);
130  vtkGetMacro(MaximumFontSize, int);
132 
134 
143  vtkSetMacro(LinearFontScaleFactor, double);
144  vtkGetMacro(LinearFontScaleFactor, double);
145  vtkSetMacro(NonlinearFontScaleFactor, double);
146  vtkGetMacro(NonlinearFontScaleFactor, double);
148 
155 
157 
162  {
163  LowerLeft = 0,
170  UpperEdge
171  };
172  static const int NumTextPositions = 8;
174 
176 
180  void SetText(int i, const char* text);
181  const char* GetText(int i);
185 
187 
191  vtkGetObjectMacro(ImageActor, vtkImageActor);
193 
195 
200  vtkGetObjectMacro(WindowLevel, vtkImageMapToWindowLevelColors);
202 
204 
207  vtkSetMacro(LevelShift, double);
208  vtkGetMacro(LevelShift, double);
210 
212 
215  vtkSetMacro(LevelScale, double);
216  vtkGetMacro(LevelScale, double);
218 
220 
224  vtkGetObjectMacro(TextProperty, vtkTextProperty);
226 
228 
231  vtkBooleanMacro(ShowSliceAndImage, vtkTypeBool);
232  vtkSetMacro(ShowSliceAndImage, vtkTypeBool);
233  vtkGetMacro(ShowSliceAndImage, vtkTypeBool);
235 
236 protected:
239 
241 
243 
245  double LevelShift;
246  double LevelScale;
249 
250  char* CornerText[NumTextPositions];
251 
252  int FontSize;
253  vtkActor2D* TextActor[NumTextPositions];
255  int LastSize[2];
256  vtkTextMapper* TextMapper[NumTextPositions];
257 
260 
263 
265 
270 
272 
275  virtual void SetTextActorsPosition(const int vsize[2]);
278 
279 private:
280  vtkCornerAnnotation(const vtkCornerAnnotation&) = delete;
281  void operator=(const vtkCornerAnnotation&) = delete;
282 };
283 
284 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:149
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:113
2D text annotation
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:52
abstract specification for Viewports
Definition: vtkViewport.h:47
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
int vtkTypeBool
Definition: vtkABI.h:69