VTK  9.2.6
vtkTextRepresentation.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkTextRepresentation.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=========================================================================*/
27#ifndef vtkTextRepresentation_h
28#define vtkTextRepresentation_h
29
31#include "vtkInteractionWidgetsModule.h" // For export macro
32
33class vtkRenderer;
34class vtkTextActor;
35class vtkTextProperty;
36class vtkTextRepresentationObserver;
37
38class VTKINTERACTIONWIDGETS_EXPORT vtkTextRepresentation : public vtkBorderRepresentation
39{
40public:
45
47
51 void PrintSelf(ostream& os, vtkIndent indent) override;
53
55
59 void SetTextActor(vtkTextActor* textActor);
60 vtkGetObjectMacro(TextActor, vtkTextActor);
62
64
67 void SetText(const char* text);
68 const char* GetText();
70
74 void BuildRepresentation() override;
75 void GetSize(double size[2]) override
76 {
77 size[0] = 2.0;
78 size[1] = 2.0;
79 }
80
82
88 int RenderOverlay(vtkViewport*) override;
93
105 void SetWindowLocation(int enumLocation) override;
106
108
112 void SetPosition(double x, double y) override;
113 void SetPosition(double pos[2]) override { this->SetPosition(pos[0], pos[1]); }
115
117
120 void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
121 void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
123
125
130 vtkSetClampMacro(PaddingLeft, int, 0, 4000);
131 vtkGetMacro(PaddingLeft, int);
133
135
140 vtkSetClampMacro(PaddingRight, int, 0, 4000);
141 vtkGetMacro(PaddingRight, int);
143
145
150 vtkSetClampMacro(PaddingTop, int, 0, 4000);
151 vtkGetMacro(PaddingTop, int);
153
155
160 vtkSetClampMacro(PaddingBottom, int, 0, 4000);
161 vtkGetMacro(PaddingBottom, int);
163
165
170 void SetPadding(int padding);
172
173protected:
176
177 // Initialize text actor
178 virtual void InitializeTextActor();
179
180 // Check and adjust boundaries according to the size of the text
181 virtual void CheckTextBoundary();
182
183 // the text to manage
186
187 // observer to observe internal TextActor and TextProperty
188 vtkTextRepresentationObserver* Observer;
189
190 int PaddingLeft = 0;
191 int PaddingRight = 0;
192 int PaddingTop = 0;
193 int PaddingBottom = 0;
194
195private:
197 void operator=(const vtkTextRepresentation&) = delete;
198};
199
200#endif
represent a vtkBorderWidget
a simple class to control print indentation
Definition vtkIndent.h:34
abstract base class for most VTK objects
Definition vtkObject.h:57
an ordered list of Props
abstract specification for renderers
Definition vtkRenderer.h:67
An actor that displays text.
represent text properties.
represent text for vtkTextWidget
void GetSize(double size[2]) override
Subclasses should implement these methods.
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
These methods are necessary to make this representation behave as a vtkProp.
virtual void InitializeTextActor()
virtual void CheckTextBoundary()
void ReleaseGraphicsResources(vtkWindow *) override
These methods are necessary to make this representation behave as a vtkProp.
int RenderOverlay(vtkViewport *) override
These methods are necessary to make this representation behave as a vtkProp.
vtkTypeBool HasTranslucentPolygonalGeometry() override
These methods are necessary to make this representation behave as a vtkProp.
void SetTextActor(vtkTextActor *textActor)
Specify the vtkTextActor to manage.
void SetText(const char *text)
Get/Set the text string display by this representation.
void SetPadding(int padding)
Set the padding between the text and the left/right/top/bottom border, in pixels unit.
void SetPosition(double x, double y) override
Set the text position, by overriding the same function of vtkBorderRepresentation so that the Modifie...
static vtkTextRepresentation * New()
Instantiate class.
void BuildRepresentation() override
Satisfy the superclasses API.
void SetPosition(double pos[2]) override
Set the text position, by overriding the same function of vtkBorderRepresentation so that the Modifie...
void ExecuteTextActorModifiedEvent(vtkObject *obj, unsigned long enumEvent, void *p)
Internal.
void ExecuteTextPropertyModifiedEvent(vtkObject *obj, unsigned long enumEvent, void *p)
Internal.
void GetActors2D(vtkPropCollection *) override
These methods are necessary to make this representation behave as a vtkProp.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard VTK methods.
void SetWindowLocation(int enumLocation) override
Set the text position, by enumeration ( vtkBorderRepresentation::AnyLocation = 0, vtkBorderRepresenta...
const char * GetText()
Get/Set the text string display by this representation.
vtkTextRepresentationObserver * Observer
~vtkTextRepresentation() override
int RenderOpaqueGeometry(vtkViewport *) override
These methods are necessary to make this representation behave as a vtkProp.
abstract specification for Viewports
Definition vtkViewport.h:50
window superclass for vtkRenderWindow
Definition vtkWindow.h:39
int vtkTypeBool
Definition vtkABI.h:69