VTK  9.3.20240419
vtkCornerAnnotation.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
66 #ifndef vtkCornerAnnotation_h
67 #define vtkCornerAnnotation_h
68 
69 #include "vtkActor2D.h"
70 #include "vtkRenderingAnnotationModule.h" // For export macro
71 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
72 
73 VTK_ABI_NAMESPACE_BEGIN
74 class vtkTextMapper;
76 class vtkImageActor;
77 class vtkTextProperty;
78 
79 class VTKRENDERINGANNOTATION_EXPORT VTK_MARSHALAUTO vtkCornerAnnotation : public vtkActor2D
80 {
81 public:
83  void PrintSelf(ostream& os, vtkIndent indent) override;
84 
90 
92 
95  int RenderOpaqueGeometry(vtkViewport* viewport) override;
96  int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
97  int RenderOverlay(vtkViewport* viewport) override;
99 
104 
106 
111  vtkSetMacro(MaximumLineHeight, double);
112  vtkGetMacro(MaximumLineHeight, double);
114 
116 
120  vtkSetMacro(MinimumFontSize, int);
121  vtkGetMacro(MinimumFontSize, int);
122  vtkSetMacro(MaximumFontSize, int);
123  vtkGetMacro(MaximumFontSize, int);
125 
127 
136  vtkSetMacro(LinearFontScaleFactor, double);
137  vtkGetMacro(LinearFontScaleFactor, double);
138  vtkSetMacro(NonlinearFontScaleFactor, double);
139  vtkGetMacro(NonlinearFontScaleFactor, double);
141 
148 
150 
155  {
156  LowerLeft = 0,
163  UpperEdge
164  };
165  static const int NumTextPositions = 8;
167 
169 
173  void SetText(int i, const char* text);
174  const char* GetText(int i);
178 
180 
184  vtkGetObjectMacro(ImageActor, vtkImageActor);
186 
188 
193  vtkGetObjectMacro(WindowLevel, vtkImageMapToWindowLevelColors);
195 
197 
200  vtkSetMacro(LevelShift, double);
201  vtkGetMacro(LevelShift, double);
203 
205 
208  vtkSetMacro(LevelScale, double);
209  vtkGetMacro(LevelScale, double);
211 
213 
217  vtkGetObjectMacro(TextProperty, vtkTextProperty);
219 
221 
224  vtkBooleanMacro(ShowSliceAndImage, vtkTypeBool);
225  vtkSetMacro(ShowSliceAndImage, vtkTypeBool);
226  vtkGetMacro(ShowSliceAndImage, vtkTypeBool);
228 
229 protected:
232 
234 
236 
238  double LevelShift;
239  double LevelScale;
242 
243  char* CornerText[NumTextPositions];
244 
245  int FontSize;
246  vtkActor2D* TextActor[NumTextPositions];
248  int LastSize[2];
249  vtkTextMapper* TextMapper[NumTextPositions];
250 
253 
256 
258 
263 
265 
268  virtual void SetTextActorsPosition(const int vsize[2]);
271 
272 private:
273  vtkCornerAnnotation(const vtkCornerAnnotation&) = delete;
274  void operator=(const vtkCornerAnnotation&) = delete;
275 };
276 
277 VTK_ABI_NAMESPACE_END
278 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:145
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:108
2D text annotation
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:44
abstract specification for Viewports
Definition: vtkViewport.h:65
window superclass for vtkRenderWindow
Definition: vtkWindow.h:48
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_MARSHALAUTO