VTK  9.6.20260416
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#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
123
124VTK_ABI_NAMESPACE_BEGIN
125class vtkRenderer;
126class vtkTextActor;
127class vtkTextProperty;
128class vtkTextRepresentationObserver;
129
130class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkTextRepresentation
132{
133public:
138
140
144 void PrintSelf(ostream& os, vtkIndent indent) override;
146
148
152 void SetTextActor(vtkTextActor* textActor);
153 vtkGetObjectMacro(TextActor, vtkTextActor);
155
157
161 void SetText(const char* text);
163 const char* GetText();
165
169 void BuildRepresentation() override;
170 void GetSize(double size[2]) override
171 {
172 size[0] = 2.0;
173 size[1] = 2.0;
174 }
175
177
188
200 void SetWindowLocation(int enumLocation) override;
201
203
208 void SetPosition(double x, double y) override;
210 void SetPosition(double pos[2]) override { this->SetPosition(pos[0], pos[1]); }
212
214
217 void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
218 void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
220
222
227 vtkSetClampMacro(PaddingLeft, int, 0, 4000);
228 vtkGetMacro(PaddingLeft, int);
230
232
237 vtkSetClampMacro(PaddingRight, int, 0, 4000);
238 vtkGetMacro(PaddingRight, int);
240
242
247 vtkSetClampMacro(PaddingTop, int, 0, 4000);
248 vtkGetMacro(PaddingTop, int);
250
252
257 vtkSetClampMacro(PaddingBottom, int, 0, 4000);
258 vtkGetMacro(PaddingBottom, int);
260
262
267 void SetPadding(int padding);
269
270protected:
273
274 // Initialize text actor
275 virtual void InitializeTextActor();
276
277 // Check and adjust boundaries according to the size of the text
278 virtual void CheckTextBoundary();
279
280 // the text to manage
283
284 // observer to observe internal TextActor and TextProperty
285 vtkTextRepresentationObserver* Observer;
286
287 int PaddingLeft = 0;
289 int PaddingTop = 0;
291
292private:
294 void operator=(const vtkTextRepresentation&) = delete;
295};
296
297VTK_ABI_NAMESPACE_END
298#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:61
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_MARSHAL_EXCLUDE_REASON_IS_REDUNDANT
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)