VTK  9.5.20250718
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
37#ifndef vtkTextRepresentation_h
38#define vtkTextRepresentation_h
39
41#include "vtkInteractionWidgetsModule.h" // For export macro
42#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
43
44VTK_ABI_NAMESPACE_BEGIN
45class vtkRenderer;
46class vtkTextActor;
47class vtkTextProperty;
48class vtkTextRepresentationObserver;
49
50class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkTextRepresentation
52{
53public:
58
60
64 void PrintSelf(ostream& os, vtkIndent indent) override;
66
68
72 void SetTextActor(vtkTextActor* textActor);
73 vtkGetObjectMacro(TextActor, vtkTextActor);
75
77
81 void SetText(const char* text);
83 const char* GetText();
85
89 void BuildRepresentation() override;
90 void GetSize(double size[2]) override
91 {
92 size[0] = 2.0;
93 size[1] = 2.0;
94 }
95
97
108
120 void SetWindowLocation(int enumLocation) override;
121
123
128 void SetPosition(double x, double y) override;
130 void SetPosition(double pos[2]) override { this->SetPosition(pos[0], pos[1]); }
132
134
137 void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
138 void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
140
142
147 vtkSetClampMacro(PaddingLeft, int, 0, 4000);
148 vtkGetMacro(PaddingLeft, int);
150
152
157 vtkSetClampMacro(PaddingRight, int, 0, 4000);
158 vtkGetMacro(PaddingRight, int);
160
162
167 vtkSetClampMacro(PaddingTop, int, 0, 4000);
168 vtkGetMacro(PaddingTop, int);
170
172
177 vtkSetClampMacro(PaddingBottom, int, 0, 4000);
178 vtkGetMacro(PaddingBottom, int);
180
182
187 void SetPadding(int padding);
189
190protected:
193
194 // Initialize text actor
195 virtual void InitializeTextActor();
196
197 // Check and adjust boundaries according to the size of the text
198 virtual void CheckTextBoundary();
199
200 // the text to manage
203
204 // observer to observe internal TextActor and TextProperty
205 vtkTextRepresentationObserver* Observer;
206
207 int PaddingLeft = 0;
208 int PaddingRight = 0;
209 int PaddingTop = 0;
210 int PaddingBottom = 0;
211
212private:
214 void operator=(const vtkTextRepresentation&) = delete;
215};
216
217VTK_ABI_NAMESPACE_END
218#endif
represent a vtkBorderWidget
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
an ordered list of Props
abstract specification for renderers
An actor that displays text.
represent text properties.
represent text for vtkTextWidget
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 SetPadding(int padding)
Set the padding between the text and the left/right/top/bottom border, in pixels unit.
static vtkTextRepresentation * New()
Instantiate class.
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...
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:66
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_MARSHAL_EXCLUDE_REASON_IS_REDUNDANT
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)