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=========================================================================*/
46#ifndef vtkTextRepresentation_h
47#define vtkTextRepresentation_h
48
50#include "vtkInteractionWidgetsModule.h" // For export macro
51
52class vtkRenderer;
53class vtkTextActor;
54class vtkTextProperty;
55class vtkTextRepresentationObserver;
56
57class VTKINTERACTIONWIDGETS_EXPORT vtkTextRepresentation : public vtkBorderRepresentation
58{
59public:
64
66
70 void PrintSelf(ostream& os, vtkIndent indent) override;
72
74
78 void SetTextActor(vtkTextActor* textActor);
79 vtkGetObjectMacro(TextActor, vtkTextActor);
81
83
86 void SetText(const char* text);
87 const char* GetText();
89
93 void BuildRepresentation() override;
94 void GetSize(double size[2]) override
95 {
96 size[0] = 2.0;
97 size[1] = 2.0;
98 }
99
101
112
113 enum
114 {
115 AnyLocation = 0,
121 UpperCenter
122 };
123
125
136 virtual void SetWindowLocation(int enumLocation);
137 vtkGetMacro(WindowLocation, int);
139
141
145 void SetPosition(double x, double y) override;
146 void SetPosition(double pos[2]) override { this->SetPosition(pos[0], pos[1]); }
148
150
153 void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
154 void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
156
158
163 vtkSetClampMacro(PaddingLeft, int, 0, 4000);
164 vtkGetMacro(PaddingLeft, int);
166
168
173 vtkSetClampMacro(PaddingRight, int, 0, 4000);
174 vtkGetMacro(PaddingRight, int);
176
178
183 vtkSetClampMacro(PaddingTop, int, 0, 4000);
184 vtkGetMacro(PaddingTop, int);
186
188
193 vtkSetClampMacro(PaddingBottom, int, 0, 4000);
194 vtkGetMacro(PaddingBottom, int);
196
198
203 void SetPadding(int padding);
205
206protected:
209
210 // Initialize text actor
211 virtual void InitializeTextActor();
212
213 // Check and adjust boundaries according to the size of the text
214 virtual void CheckTextBoundary();
215
216 // the text to manage
219
220 // Window location by enumeration
222 virtual void UpdateWindowLocation();
223
224 // observer to observe internal TextActor and TextProperty
225 vtkTextRepresentationObserver* Observer;
226
227 int PaddingLeft = 0;
228 int PaddingRight = 0;
229 int PaddingTop = 0;
230 int PaddingBottom = 0;
231
232private:
234 void operator=(const vtkTextRepresentation&) = delete;
235};
236
237#endif
represent a vtkBorderWidget
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract base class for most VTK objects
Definition: vtkObject.h:73
an ordered list of Props
abstract specification for renderers
Definition: vtkRenderer.h:173
An actor that displays text.
Definition: vtkTextActor.h:160
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:47
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
@ size
Definition: vtkX3D.h:259
int vtkTypeBool
Definition: vtkABI.h:69