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=========================================================================*/
39#ifndef vtkTextRepresentation_h
40#define vtkTextRepresentation_h
41
43#include "vtkInteractionWidgetsModule.h" // For export macro
44
45class vtkRenderer;
46class vtkTextActor;
47class vtkTextProperty;
48class vtkTextRepresentationObserver;
49
50class VTKINTERACTIONWIDGETS_EXPORT vtkTextRepresentation : public vtkBorderRepresentation
51{
52public:
57
59
63 void PrintSelf(ostream& os, vtkIndent indent) override;
65
67
71 void SetTextActor(vtkTextActor* textActor);
72 vtkGetObjectMacro(TextActor, vtkTextActor);
74
76
79 void SetText(const char* text);
80 const char* GetText();
82
86 void BuildRepresentation() override;
87 void GetSize(double size[2]) override
88 {
89 size[0] = 2.0;
90 size[1] = 2.0;
91 }
92
94
105
117 void SetWindowLocation(int enumLocation) override;
118
120
124 void SetPosition(double x, double y) override;
125 void SetPosition(double pos[2]) override { this->SetPosition(pos[0], pos[1]); }
127
129
132 void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
133 void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
135
137
142 vtkSetClampMacro(PaddingLeft, int, 0, 4000);
143 vtkGetMacro(PaddingLeft, int);
145
147
152 vtkSetClampMacro(PaddingRight, int, 0, 4000);
153 vtkGetMacro(PaddingRight, int);
155
157
162 vtkSetClampMacro(PaddingTop, int, 0, 4000);
163 vtkGetMacro(PaddingTop, int);
165
167
172 vtkSetClampMacro(PaddingBottom, int, 0, 4000);
173 vtkGetMacro(PaddingBottom, int);
175
177
182 void SetPadding(int padding);
184
185protected:
188
189 // Initialize text actor
190 virtual void InitializeTextActor();
191
192 // Check and adjust boundaries according to the size of the text
193 virtual void CheckTextBoundary();
194
195 // the text to manage
198
199 // observer to observe internal TextActor and TextProperty
200 vtkTextRepresentationObserver* Observer;
201
202 int PaddingLeft = 0;
203 int PaddingRight = 0;
204 int PaddingTop = 0;
205 int PaddingBottom = 0;
206
207private:
209 void operator=(const vtkTextRepresentation&) = delete;
210};
211
212#endif
represent a vtkBorderWidget
a simple class to control print indentation
Definition vtkIndent.h:49
abstract base class for most VTK objects
Definition vtkObject.h:72
an ordered list of Props
abstract specification for renderers
Definition vtkRenderer.h:82
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:69