VTK: Interaction/Widgets/vtkTextRepresentation.h Source File

| VTK 9.3.1

vtkTextRepresentation.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
27 #ifndef vtkTextRepresentation_h
28 #define vtkTextRepresentation_h
29
30 #include "vtkBorderRepresentation.h"
31 #include "vtkInteractionWidgetsModule.h" // For export macro
32
33 VTK_ABI_NAMESPACE_BEGIN
34 class vtkRenderer;
35 class vtkTextActor;
36 class vtkTextProperty;
37 class vtkTextRepresentationObserver;
38
39 class VTKINTERACTIONWIDGETS_EXPORT vtkTextRepresentation : public vtkBorderRepresentation
40 {
41 public:
45 static vtkTextRepresentation* New();
46
48
51 vtkTypeMacro(vtkTextRepresentation, vtkBorderRepresentation);
52 void PrintSelf(ostream& os, vtkIndent indent) override;
54
56
60 void SetTextActor(vtkTextActor* textActor);
61 vtkGetObjectMacro(TextActor, vtkTextActor);
63
65
68 void SetText(const char* text);
69 const char* GetText();
71
75 void BuildRepresentation() override;
76 void GetSize(double size[2]) override
77 {
78 size[0] = 2.0;
79 size[1] = 2.0;
80 }
81
83
87 void GetActors2D(vtkPropCollection*) override;
88 void ReleaseGraphicsResources(vtkWindow*) override;
89 int RenderOverlay(vtkViewport*) override;
90 int RenderOpaqueGeometry(vtkViewport*) override;
91 int RenderTranslucentPolygonalGeometry(vtkViewport*) override;
92 vtkTypeBool HasTranslucentPolygonalGeometry() override;
94
106 void SetWindowLocation(int enumLocation) override;
107
109
113 void SetPosition(double x, double y) override;
114 void SetPosition(double pos[2]) override { this->SetPosition(pos[0], pos[1]); }
116
118
121 void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
122 void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
124
126
131 vtkSetClampMacro(PaddingLeft, int, 0, 4000);
132 vtkGetMacro(PaddingLeft, int);
134
136
141 vtkSetClampMacro(PaddingRight, int, 0, 4000);
142 vtkGetMacro(PaddingRight, int);
144
146
151 vtkSetClampMacro(PaddingTop, int, 0, 4000);
152 vtkGetMacro(PaddingTop, int);
154
156
161 vtkSetClampMacro(PaddingBottom, int, 0, 4000);
162 vtkGetMacro(PaddingBottom, int);
164
166
171 void SetPadding(int padding);
173
174 protected:
175 vtkTextRepresentation();
176 ~vtkTextRepresentation() override;
177
178 // Initialize text actor
179 virtual void InitializeTextActor();
180
181 // Check and adjust boundaries according to the size of the text
182 virtual void CheckTextBoundary();
183
184 // the text to manage
185 vtkTextActor* TextActor;
186 vtkTextProperty* TextProperty;
187
188 // observer to observe internal TextActor and TextProperty
189 vtkTextRepresentationObserver* Observer;
190
191 int PaddingLeft = 0;
192 int PaddingRight = 0;
193 int PaddingTop = 0;
194 int PaddingBottom = 0;
195
196 private:
197 vtkTextRepresentation(const vtkTextRepresentation&) = delete;
198 void operator=(const vtkTextRepresentation&) = delete;
199 };
200
201 VTK_ABI_NAMESPACE_END
202 #endif
vtkBorderRepresentation
represent a vtkBorderWidget
Definition: vtkBorderRepresentation.h:61
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:61
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:37
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:71
vtkTextActor
An actor that displays text.
Definition: vtkTextActor.h:55
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:35
vtkTextRepresentation
represent text for vtkTextWidget
Definition: vtkTextRepresentation.h:40
vtkTextRepresentation::GetSize
void GetSize(double size[2]) override
Subclasses should implement these methods.
Definition: vtkTextRepresentation.h:76
vtkTextRepresentation::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
These methods are necessary to make this representation behave as a vtkProp.
vtkTextRepresentation::InitializeTextActor
virtual void InitializeTextActor()
vtkTextRepresentation::vtkTextRepresentation
vtkTextRepresentation()
vtkTextRepresentation::CheckTextBoundary
virtual void CheckTextBoundary()
vtkTextRepresentation::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
These methods are necessary to make this representation behave as a vtkProp.
vtkTextRepresentation::RenderOverlay
int RenderOverlay(vtkViewport *) override
These methods are necessary to make this representation behave as a vtkProp.
vtkTextRepresentation::GetText
const char * GetText()
Get/Set the text string display by this representation.
vtkTextRepresentation::HasTranslucentPolygonalGeometry
vtkTypeBool HasTranslucentPolygonalGeometry() override
These methods are necessary to make this representation behave as a vtkProp.
vtkTextRepresentation::SetTextActor
void SetTextActor(vtkTextActor *textActor)
Specify the vtkTextActor to manage.
vtkTextRepresentation::New
static vtkTextRepresentation * New()
Instantiate class.
vtkTextRepresentation::TextActor
vtkTextActor * TextActor
Definition: vtkTextRepresentation.h:185
vtkTextRepresentation::SetText
void SetText(const char *text)
Get/Set the text string display by this representation.
vtkTextRepresentation::SetPadding
void SetPadding(int padding)
Set the padding between the text and the left/right/top/bottom border, in pixels unit.
vtkTextRepresentation::SetPosition
void SetPosition(double x, double y) override
Set the text position, by overriding the same function of vtkBorderRepresentation so that the Modifie...
vtkTextRepresentation::BuildRepresentation
void BuildRepresentation() override
Satisfy the superclasses API.
vtkTextRepresentation::SetPosition
void SetPosition(double pos[2]) override
Set the text position, by overriding the same function of vtkBorderRepresentation so that the Modifie...
Definition: vtkTextRepresentation.h:114
vtkTextRepresentation::ExecuteTextActorModifiedEvent
void ExecuteTextActorModifiedEvent(vtkObject *obj, unsigned long enumEvent, void *p)
Internal.
vtkTextRepresentation::ExecuteTextPropertyModifiedEvent
void ExecuteTextPropertyModifiedEvent(vtkObject *obj, unsigned long enumEvent, void *p)
Internal.
vtkTextRepresentation::GetActors2D
void GetActors2D(vtkPropCollection *) override
These methods are necessary to make this representation behave as a vtkProp.
vtkTextRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard VTK methods.
vtkTextRepresentation::TextProperty
vtkTextProperty * TextProperty
Definition: vtkTextRepresentation.h:186
vtkTextRepresentation::SetWindowLocation
void SetWindowLocation(int enumLocation) override
Set the text position, by enumeration ( vtkBorderRepresentation::AnyLocation = 0, vtkBorderRepresenta...
vtkTextRepresentation::Observer
vtkTextRepresentationObserver * Observer
Definition: vtkTextRepresentation.h:189
vtkTextRepresentation::~vtkTextRepresentation
~vtkTextRepresentation() override
vtkTextRepresentation::RenderOpaqueGeometry
int RenderOpaqueGeometry(vtkViewport *) override
These methods are necessary to make this representation behave as a vtkProp.
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:54
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkX3D::size
@ size
Definition: vtkX3D.h:253
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:64
vtkBorderRepresentation.h