VTK  9.2.6
vtkTextRepresentation.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkTextRepresentation.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
49#ifndef vtkTextRepresentation_h
50#define vtkTextRepresentation_h
51
53#include "vtkInteractionWidgetsModule.h" // For export macro
54
55class vtkRenderer;
56class vtkTextActor;
57class vtkTextProperty;
58class vtkTextRepresentationObserver;
59
60class VTKINTERACTIONWIDGETS_EXPORT vtkTextRepresentation : public vtkBorderRepresentation
61{
62public:
67
69
73 void PrintSelf(ostream& os, vtkIndent indent) override;
75
77
81 void SetTextActor(vtkTextActor* textActor);
82 vtkGetObjectMacro(TextActor, vtkTextActor);
84
86
89 void SetText(const char* text);
90 const char* GetText();
92
96 void BuildRepresentation() override;
97 void GetSize(double size[2]) override
98 {
99 size[0] = 2.0;
100 size[1] = 2.0;
101 }
102
104
115
127 void SetWindowLocation(int enumLocation) override;
128
130
134 void SetPosition(double x, double y) override;
135 void SetPosition(double pos[2]) override { this->SetPosition(pos[0], pos[1]); }
137
139
142 void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
143 void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
145
147
152 vtkSetClampMacro(PaddingLeft, int, 0, 4000);
153 vtkGetMacro(PaddingLeft, int);
155
157
162 vtkSetClampMacro(PaddingRight, int, 0, 4000);
163 vtkGetMacro(PaddingRight, int);
165
167
172 vtkSetClampMacro(PaddingTop, int, 0, 4000);
173 vtkGetMacro(PaddingTop, int);
175
177
182 vtkSetClampMacro(PaddingBottom, int, 0, 4000);
183 vtkGetMacro(PaddingBottom, int);
185
187
192 void SetPadding(int padding);
194
195protected:
198
199 // Initialize text actor
200 virtual void InitializeTextActor();
201
202 // Check and adjust boundaries according to the size of the text
203 virtual void CheckTextBoundary();
204
205 // the text to manage
208
209 // observer to observe internal TextActor and TextProperty
210 vtkTextRepresentationObserver* Observer;
211
212 int PaddingLeft = 0;
213 int PaddingRight = 0;
214 int PaddingTop = 0;
215 int PaddingBottom = 0;
216
217private:
219 void operator=(const vtkTextRepresentation&) = delete;
220};
221
222#endif
represent a vtkBorderWidget
a simple class to control print indentation
Definition: vtkIndent.h:119
abstract base class for most VTK objects
Definition: vtkObject.h:82
an ordered list of Props
abstract specification for renderers
Definition: vtkRenderer.h:182
An actor that displays text.
Definition: vtkTextActor.h:166
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.
vtkTextProperty * TextProperty
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:56
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
@ size
Definition: vtkX3D.h:259
int vtkTypeBool
Definition: vtkABI.h:69