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
116
117#ifndef vtkTextRepresentation_h
118#define vtkTextRepresentation_h
119
121#include "vtkInteractionWidgetsModule.h" // For export macro
122
123VTK_ABI_NAMESPACE_BEGIN
124class vtkRenderer;
125class vtkTextActor;
126class vtkTextProperty;
127class vtkTextRepresentationObserver;
128
129class VTKINTERACTIONWIDGETS_EXPORT vtkTextRepresentation : public vtkBorderRepresentation
130{
131public:
136
138
142 void PrintSelf(ostream& os, vtkIndent indent) override;
144
146
150 void SetTextActor(vtkTextActor* textActor);
151 vtkGetObjectMacro(TextActor, vtkTextActor);
153
155
158 void SetText(const char* text);
159 const char* GetText();
161
165 void BuildRepresentation() override;
166 void GetSize(double size[2]) override
167 {
168 size[0] = 2.0;
169 size[1] = 2.0;
170 }
171
173
184
196 void SetWindowLocation(int enumLocation) override;
197
199
203 void SetPosition(double x, double y) override;
204 void SetPosition(double pos[2]) override { this->SetPosition(pos[0], pos[1]); }
206
208
211 void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
212 void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
214
216
221 vtkSetClampMacro(PaddingLeft, int, 0, 4000);
222 vtkGetMacro(PaddingLeft, int);
224
226
231 vtkSetClampMacro(PaddingRight, int, 0, 4000);
232 vtkGetMacro(PaddingRight, int);
234
236
241 vtkSetClampMacro(PaddingTop, int, 0, 4000);
242 vtkGetMacro(PaddingTop, int);
244
246
251 vtkSetClampMacro(PaddingBottom, int, 0, 4000);
252 vtkGetMacro(PaddingBottom, int);
254
256
261 void SetPadding(int padding);
263
264protected:
267
268 // Initialize text actor
269 virtual void InitializeTextActor();
270
271 // Check and adjust boundaries according to the size of the text
272 virtual void CheckTextBoundary();
273
274 // the text to manage
277
278 // observer to observe internal TextActor and TextProperty
279 vtkTextRepresentationObserver* Observer;
280
281 int PaddingLeft = 0;
283 int PaddingTop = 0;
285
286private:
288 void operator=(const vtkTextRepresentation&) = delete;
289};
290
291VTK_ABI_NAMESPACE_END
292#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