VTK  9.6.20260608
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
126
127#ifndef vtkTextRepresentation_h
128#define vtkTextRepresentation_h
129
131#include "vtkInteractionWidgetsModule.h" // For export macro
132#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
133
134VTK_ABI_NAMESPACE_BEGIN
135class vtkRenderer;
136class vtkTextActor;
137class vtkTextProperty;
138class vtkTextRepresentationObserver;
139
140class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkTextRepresentation
142{
143public:
148
150
154 void PrintSelf(ostream& os, vtkIndent indent) override;
156
158
162 void SetTextActor(vtkTextActor* textActor);
163 vtkGetObjectMacro(TextActor, vtkTextActor);
165
167
171 void SetText(const char* text);
173 const char* GetText();
175
179 void BuildRepresentation() override;
180 void GetSize(double size[2]) override
181 {
182 size[0] = 2.0;
183 size[1] = 2.0;
184 }
185
187
198
210 void SetWindowLocation(int enumLocation) override;
211
213
218 void SetPosition(double x, double y) override;
220 void SetPosition(double pos[2]) override { this->SetPosition(pos[0], pos[1]); }
222
224
227 void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
228 void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
230
232
237 vtkSetClampMacro(PaddingLeft, int, 0, 4000);
238 vtkGetMacro(PaddingLeft, int);
240
242
247 vtkSetClampMacro(PaddingRight, int, 0, 4000);
248 vtkGetMacro(PaddingRight, int);
250
252
257 vtkSetClampMacro(PaddingTop, int, 0, 4000);
258 vtkGetMacro(PaddingTop, int);
260
262
267 vtkSetClampMacro(PaddingBottom, int, 0, 4000);
268 vtkGetMacro(PaddingBottom, int);
270
272
277 void SetPadding(int padding);
279
280protected:
283
284 // Initialize text actor
285 virtual void InitializeTextActor();
286
287 // Check and adjust boundaries according to the size of the text
288 virtual void CheckTextBoundary();
289
290 // the text to manage
293
294 // observer to observe internal TextActor and TextProperty
295 vtkTextRepresentationObserver* Observer;
296
297 int PaddingLeft = 0;
299 int PaddingTop = 0;
301
302private:
304 void operator=(const vtkTextRepresentation&) = delete;
305};
306
307VTK_ABI_NAMESPACE_END
308#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)