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=========================================================================*/
29
30#ifndef vtkTextRepresentation_h
31#define vtkTextRepresentation_h
32
34#include "vtkInteractionWidgetsModule.h" // For export macro
35
36class vtkRenderer;
37class vtkTextActor;
38class vtkTextProperty;
39class vtkTextRepresentationObserver;
40
41class VTKINTERACTIONWIDGETS_EXPORT vtkTextRepresentation : public vtkBorderRepresentation
42{
43public:
48
50
54 void PrintSelf(ostream& os, vtkIndent indent) override;
56
58
62 void SetTextActor(vtkTextActor* textActor);
63 vtkGetObjectMacro(TextActor, vtkTextActor);
65
67
70 void SetText(const char* text);
71 const char* GetText();
73
77 void BuildRepresentation() override;
78 void GetSize(double size[2]) override
79 {
80 size[0] = 2.0;
81 size[1] = 2.0;
82 }
83
85
91 int RenderOverlay(vtkViewport*) override;
96
108 void SetWindowLocation(int enumLocation) override;
109
111
115 void SetPosition(double x, double y) override;
116 void SetPosition(double pos[2]) override { this->SetPosition(pos[0], pos[1]); }
118
120
123 void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
124 void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
126
128
133 vtkSetClampMacro(PaddingLeft, int, 0, 4000);
134 vtkGetMacro(PaddingLeft, int);
136
138
143 vtkSetClampMacro(PaddingRight, int, 0, 4000);
144 vtkGetMacro(PaddingRight, int);
146
148
153 vtkSetClampMacro(PaddingTop, int, 0, 4000);
154 vtkGetMacro(PaddingTop, int);
156
158
163 vtkSetClampMacro(PaddingBottom, int, 0, 4000);
164 vtkGetMacro(PaddingBottom, int);
166
168
173 void SetPadding(int padding);
175
176protected:
179
180 // Initialize text actor
181 virtual void InitializeTextActor();
182
183 // Check and adjust boundaries according to the size of the text
184 virtual void CheckTextBoundary();
185
186 // the text to manage
189
190 // observer to observe internal TextActor and TextProperty
191 vtkTextRepresentationObserver* Observer;
192
193 int PaddingLeft = 0;
195 int PaddingTop = 0;
197
198private:
200 void operator=(const vtkTextRepresentation&) = delete;
201};
202
203#endif
a simple class to control print indentation
Definition vtkIndent.h:40
abstract base class for most VTK objects
Definition vtkObject.h:63
an ordered list of Props
abstract specification for renderers
Definition vtkRenderer.h:73
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:56
window superclass for vtkRenderWindow
Definition vtkWindow.h:39
int vtkTypeBool
Definition vtkABI.h:69