VTK  9.3.20240423
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
43VTK_ABI_NAMESPACE_BEGIN
44class vtkRenderer;
45class vtkTextActor;
46class vtkTextProperty;
47class vtkTextRepresentationObserver;
48
49class VTKINTERACTIONWIDGETS_EXPORT vtkTextRepresentation : public vtkBorderRepresentation
50{
51public:
56
58
62 void PrintSelf(ostream& os, vtkIndent indent) override;
64
66
70 void SetTextActor(vtkTextActor* textActor);
71 vtkGetObjectMacro(TextActor, vtkTextActor);
73
75
78 void SetText(const char* text);
79 const char* GetText();
81
85 void BuildRepresentation() override;
86 void GetSize(double size[2]) override
87 {
88 size[0] = 2.0;
89 size[1] = 2.0;
90 }
91
93
99 int RenderOverlay(vtkViewport*) override;
104
116 void SetWindowLocation(int enumLocation) override;
117
119
123 void SetPosition(double x, double y) override;
124 void SetPosition(double pos[2]) override { this->SetPosition(pos[0], pos[1]); }
126
128
131 void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
132 void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
134
136
141 vtkSetClampMacro(PaddingLeft, int, 0, 4000);
142 vtkGetMacro(PaddingLeft, int);
144
146
151 vtkSetClampMacro(PaddingRight, int, 0, 4000);
152 vtkGetMacro(PaddingRight, int);
154
156
161 vtkSetClampMacro(PaddingTop, int, 0, 4000);
162 vtkGetMacro(PaddingTop, int);
164
166
171 vtkSetClampMacro(PaddingBottom, int, 0, 4000);
172 vtkGetMacro(PaddingBottom, int);
174
176
181 void SetPadding(int padding);
183
184protected:
187
188 // Initialize text actor
189 virtual void InitializeTextActor();
190
191 // Check and adjust boundaries according to the size of the text
192 virtual void CheckTextBoundary();
193
194 // the text to manage
197
198 // observer to observe internal TextActor and TextProperty
199 vtkTextRepresentationObserver* Observer;
200
201 int PaddingLeft = 0;
202 int PaddingRight = 0;
203 int PaddingTop = 0;
204 int PaddingBottom = 0;
205
206private:
208 void operator=(const vtkTextRepresentation&) = delete;
209};
210
211VTK_ABI_NAMESPACE_END
212#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
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:65
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
int vtkTypeBool
Definition vtkABI.h:64