VTK  9.6.1
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
17
18#ifndef vtkTextRepresentation_h
19#define vtkTextRepresentation_h
20
22#include "vtkInteractionWidgetsModule.h" // For export macro
23#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
24
25VTK_ABI_NAMESPACE_BEGIN
26class vtkRenderer;
27class vtkTextActor;
28class vtkTextProperty;
29class vtkTextRepresentationObserver;
30
31class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkTextRepresentation
33{
34public:
39
41
45 void PrintSelf(ostream& os, vtkIndent indent) override;
47
49
53 void SetTextActor(vtkTextActor* textActor);
54 vtkGetObjectMacro(TextActor, vtkTextActor);
56
58
62 void SetText(const char* text);
64 const char* GetText();
66
70 void BuildRepresentation() override;
71 void GetSize(double size[2]) override
72 {
73 size[0] = 2.0;
74 size[1] = 2.0;
75 }
76
78
84 int RenderOverlay(vtkViewport*) override;
89
101 void SetWindowLocation(int enumLocation) override;
102
104
109 void SetPosition(double x, double y) override;
111 void SetPosition(double pos[2]) override { this->SetPosition(pos[0], pos[1]); }
113
115
118 void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
119 void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
121
123
128 vtkSetClampMacro(PaddingLeft, int, 0, 4000);
129 vtkGetMacro(PaddingLeft, int);
131
133
138 vtkSetClampMacro(PaddingRight, int, 0, 4000);
139 vtkGetMacro(PaddingRight, int);
141
143
148 vtkSetClampMacro(PaddingTop, int, 0, 4000);
149 vtkGetMacro(PaddingTop, int);
151
153
158 vtkSetClampMacro(PaddingBottom, int, 0, 4000);
159 vtkGetMacro(PaddingBottom, int);
161
163
168 void SetPadding(int padding);
170
171protected:
174
175 // Initialize text actor
176 virtual void InitializeTextActor();
177
178 // Check and adjust boundaries according to the size of the text
179 virtual void CheckTextBoundary();
180
181 // the text to manage
184
185 // observer to observe internal TextActor and TextProperty
186 vtkTextRepresentationObserver* Observer;
187
188 int PaddingLeft = 0;
190 int PaddingTop = 0;
192
193private:
195 void operator=(const vtkTextRepresentation&) = delete;
196};
197
198VTK_ABI_NAMESPACE_END
199#endif
a simple class to control print indentation
Definition vtkIndent.h:29
abstract base class for most VTK objects
Definition vtkObject.h:53
an ordered list of Props
abstract specification for renderers
Definition vtkRenderer.h:64
An actor that displays text.
represent text properties.
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:47
window superclass for vtkRenderWindow
Definition vtkWindow.h:29
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_MARSHAL_EXCLUDE_REASON_IS_REDUNDANT
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)