VTK  9.5.20251210
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
76
77#ifndef vtkTextRepresentation_h
78#define vtkTextRepresentation_h
79
81#include "vtkInteractionWidgetsModule.h" // For export macro
82#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
83
84VTK_ABI_NAMESPACE_BEGIN
85class vtkRenderer;
86class vtkTextActor;
87class vtkTextProperty;
88class vtkTextRepresentationObserver;
89
90class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkTextRepresentation
92{
93public:
98
100
104 void PrintSelf(ostream& os, vtkIndent indent) override;
106
108
112 void SetTextActor(vtkTextActor* textActor);
113 vtkGetObjectMacro(TextActor, vtkTextActor);
115
117
121 void SetText(const char* text);
123 const char* GetText();
125
129 void BuildRepresentation() override;
130 void GetSize(double size[2]) override
131 {
132 size[0] = 2.0;
133 size[1] = 2.0;
134 }
135
137
148
160 void SetWindowLocation(int enumLocation) override;
161
163
168 void SetPosition(double x, double y) override;
170 void SetPosition(double pos[2]) override { this->SetPosition(pos[0], pos[1]); }
172
174
177 void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
178 void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
180
182
187 vtkSetClampMacro(PaddingLeft, int, 0, 4000);
188 vtkGetMacro(PaddingLeft, int);
190
192
197 vtkSetClampMacro(PaddingRight, int, 0, 4000);
198 vtkGetMacro(PaddingRight, int);
200
202
207 vtkSetClampMacro(PaddingTop, int, 0, 4000);
208 vtkGetMacro(PaddingTop, int);
210
212
217 vtkSetClampMacro(PaddingBottom, int, 0, 4000);
218 vtkGetMacro(PaddingBottom, int);
220
222
227 void SetPadding(int padding);
229
230protected:
233
234 // Initialize text actor
235 virtual void InitializeTextActor();
236
237 // Check and adjust boundaries according to the size of the text
238 virtual void CheckTextBoundary();
239
240 // the text to manage
243
244 // observer to observe internal TextActor and TextProperty
245 vtkTextRepresentationObserver* Observer;
246
247 int PaddingLeft = 0;
249 int PaddingTop = 0;
251
252private:
254 void operator=(const vtkTextRepresentation&) = delete;
255};
256
257VTK_ABI_NAMESPACE_END
258#endif
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.
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: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)