VTK  9.5.2
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
83VTK_ABI_NAMESPACE_BEGIN
84class vtkRenderer;
85class vtkTextActor;
86class vtkTextProperty;
87class vtkTextRepresentationObserver;
88
89class VTKINTERACTIONWIDGETS_EXPORT vtkTextRepresentation : public vtkBorderRepresentation
90{
91public:
96
98
102 void PrintSelf(ostream& os, vtkIndent indent) override;
104
106
110 void SetTextActor(vtkTextActor* textActor);
111 vtkGetObjectMacro(TextActor, vtkTextActor);
113
115
118 void SetText(const char* text);
119 const char* GetText();
121
125 void BuildRepresentation() override;
126 void GetSize(double size[2]) override
127 {
128 size[0] = 2.0;
129 size[1] = 2.0;
130 }
131
133
144
156 void SetWindowLocation(int enumLocation) override;
157
159
163 void SetPosition(double x, double y) override;
164 void SetPosition(double pos[2]) override { this->SetPosition(pos[0], pos[1]); }
166
168
171 void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
172 void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
174
176
181 vtkSetClampMacro(PaddingLeft, int, 0, 4000);
182 vtkGetMacro(PaddingLeft, int);
184
186
191 vtkSetClampMacro(PaddingRight, int, 0, 4000);
192 vtkGetMacro(PaddingRight, int);
194
196
201 vtkSetClampMacro(PaddingTop, int, 0, 4000);
202 vtkGetMacro(PaddingTop, int);
204
206
211 vtkSetClampMacro(PaddingBottom, int, 0, 4000);
212 vtkGetMacro(PaddingBottom, int);
214
216
221 void SetPadding(int padding);
223
224protected:
227
228 // Initialize text actor
229 virtual void InitializeTextActor();
230
231 // Check and adjust boundaries according to the size of the text
232 virtual void CheckTextBoundary();
233
234 // the text to manage
237
238 // observer to observe internal TextActor and TextProperty
239 vtkTextRepresentationObserver* Observer;
240
241 int PaddingLeft = 0;
243 int PaddingTop = 0;
245
246private:
248 void operator=(const vtkTextRepresentation&) = delete;
249};
250
251VTK_ABI_NAMESPACE_END
252#endif
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:159
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:45
int vtkTypeBool
Definition vtkABI.h:64