VTK  9.3.0
vtkTextRepresentation.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
18#ifndef vtkTextRepresentation_h
19#define vtkTextRepresentation_h
20
22#include "vtkInteractionWidgetsModule.h" // For export macro
23
24VTK_ABI_NAMESPACE_BEGIN
25class vtkRenderer;
26class vtkTextActor;
27class vtkTextProperty;
28class vtkTextRepresentationObserver;
29
30class VTKINTERACTIONWIDGETS_EXPORT vtkTextRepresentation : public vtkBorderRepresentation
31{
32public:
37
39
43 void PrintSelf(ostream& os, vtkIndent indent) override;
45
47
51 void SetTextActor(vtkTextActor* textActor);
52 vtkGetObjectMacro(TextActor, vtkTextActor);
54
56
59 void SetText(const char* text);
60 const char* GetText();
62
66 void BuildRepresentation() override;
67 void GetSize(double size[2]) override
68 {
69 size[0] = 2.0;
70 size[1] = 2.0;
71 }
72
74
80 int RenderOverlay(vtkViewport*) override;
85
97 void SetWindowLocation(int enumLocation) override;
98
100
104 void SetPosition(double x, double y) override;
105 void SetPosition(double pos[2]) override { this->SetPosition(pos[0], pos[1]); }
107
109
112 void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
113 void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
115
117
122 vtkSetClampMacro(PaddingLeft, int, 0, 4000);
123 vtkGetMacro(PaddingLeft, int);
125
127
132 vtkSetClampMacro(PaddingRight, int, 0, 4000);
133 vtkGetMacro(PaddingRight, int);
135
137
142 vtkSetClampMacro(PaddingTop, int, 0, 4000);
143 vtkGetMacro(PaddingTop, int);
145
147
152 vtkSetClampMacro(PaddingBottom, int, 0, 4000);
153 vtkGetMacro(PaddingBottom, int);
155
157
162 void SetPadding(int padding);
164
165protected:
168
169 // Initialize text actor
170 virtual void InitializeTextActor();
171
172 // Check and adjust boundaries according to the size of the text
173 virtual void CheckTextBoundary();
174
175 // the text to manage
178
179 // observer to observe internal TextActor and TextProperty
180 vtkTextRepresentationObserver* Observer;
181
182 int PaddingLeft = 0;
183 int PaddingRight = 0;
184 int PaddingTop = 0;
185 int PaddingBottom = 0;
186
187private:
189 void operator=(const vtkTextRepresentation&) = delete;
190};
191
192VTK_ABI_NAMESPACE_END
193#endif
represent a vtkBorderWidget
a simple class to control print indentation
Definition vtkIndent.h:29
abstract base class for most VTK objects
Definition vtkObject.h:49
an ordered list of Props
abstract specification for renderers
Definition vtkRenderer.h:59
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:45
window superclass for vtkRenderWindow
Definition vtkWindow.h:25
int vtkTypeBool
Definition vtkABI.h:64