VTK  9.1.0
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=========================================================================*/
36#ifndef vtkTextRepresentation_h
37#define vtkTextRepresentation_h
38
40#include "vtkInteractionWidgetsModule.h" // For export macro
41
42class vtkRenderer;
43class vtkTextActor;
44class vtkTextProperty;
45class vtkTextRepresentationObserver;
46
47class VTKINTERACTIONWIDGETS_EXPORT vtkTextRepresentation : public vtkBorderRepresentation
48{
49public:
54
56
60 void PrintSelf(ostream& os, vtkIndent indent) override;
62
64
68 void SetTextActor(vtkTextActor* textActor);
69 vtkGetObjectMacro(TextActor, vtkTextActor);
71
73
76 void SetText(const char* text);
77 const char* GetText();
79
83 void BuildRepresentation() override;
84 void GetSize(double size[2]) override
85 {
86 size[0] = 2.0;
87 size[1] = 2.0;
88 }
89
91
97 int RenderOverlay(vtkViewport*) override;
102
103 enum
104 {
105 AnyLocation = 0,
111 UpperCenter
112 };
113
115
126 virtual void SetWindowLocation(int enumLocation);
127 vtkGetMacro(WindowLocation, int);
129
131
135 void SetPosition(double x, double y) override;
136 void SetPosition(double pos[2]) override { this->SetPosition(pos[0], pos[1]); }
138
140
143 void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
144 void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
146
148
153 vtkSetClampMacro(PaddingLeft, int, 0, 4000);
154 vtkGetMacro(PaddingLeft, int);
156
158
163 vtkSetClampMacro(PaddingRight, int, 0, 4000);
164 vtkGetMacro(PaddingRight, int);
166
168
173 vtkSetClampMacro(PaddingTop, int, 0, 4000);
174 vtkGetMacro(PaddingTop, int);
176
178
183 vtkSetClampMacro(PaddingBottom, int, 0, 4000);
184 vtkGetMacro(PaddingBottom, int);
186
188
193 void SetPadding(int padding);
195
196protected:
199
200 // Initialize text actor
201 virtual void InitializeTextActor();
202
203 // Check and adjust boundaries according to the size of the text
204 virtual void CheckTextBoundary();
205
206 // the text to manage
209
210 // Window location by enumeration
212 virtual void UpdateWindowLocation();
213
214 // observer to observe internal TextActor and TextProperty
215 vtkTextRepresentationObserver* Observer;
216
217 int PaddingLeft = 0;
218 int PaddingRight = 0;
219 int PaddingTop = 0;
220 int PaddingBottom = 0;
221
222private:
224 void operator=(const vtkTextRepresentation&) = delete;
225};
226
227#endif
represent a vtkBorderWidget
a simple class to control print indentation
Definition: vtkIndent.h:43
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.
Definition: vtkTextActor.h:60
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.
virtual void UpdateWindowLocation()
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
const char * GetText()
Get/Set the text string display by this representation.
virtual void SetWindowLocation(int enumLocation)
Set the text position, by enumeration ( AnyLocation = 0, LowerLeftCorner, LowerRightCorner,...
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:45
@ size
Definition: vtkX3D.h:259
int vtkTypeBool
Definition: vtkABI.h:69