VTK  9.7.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
18 #ifndef vtkTextRepresentation_h
19 #define vtkTextRepresentation_h
20 
22 #include "vtkInteractionWidgetsModule.h" // For export macro
23 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
24 
25 VTK_ABI_NAMESPACE_BEGIN
26 class vtkRenderer;
27 class vtkTextActor;
28 class vtkTextProperty;
29 class vtkTextRepresentationObserver;
30 
31 class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkTextRepresentation
33 {
34 public:
38  static vtkTextRepresentation* New();
39 
41 
45  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
49 
53  void SetTextActor(vtkTextActor* textActor);
54  vtkGetObjectMacro(TextActor, vtkTextActor);
56 
58 
62  void SetText(const char* text);
64  const char* GetText();
66 
70  void BuildRepresentation() override;
71  void GetSize(double size[2]) override
72  {
73  size[0] = 2.0;
74  size[1] = 2.0;
75  }
76 
78 
82  void GetActors2D(vtkPropCollection*) override;
83  void ReleaseGraphicsResources(vtkWindow*) override;
84  int RenderOverlay(vtkViewport*) override;
85  int RenderOpaqueGeometry(vtkViewport*) override;
89 
101  void SetWindowLocation(int enumLocation) override;
102 
104 
109  void SetPosition(double x, double y) override;
111  void SetPosition(double pos[2]) override { this->SetPosition(pos[0], pos[1]); }
113 
115 
118  void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
119  void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
121 
123 
128  vtkSetClampMacro(PaddingLeft, int, 0, 4000);
129  vtkGetMacro(PaddingLeft, int);
131 
133 
138  vtkSetClampMacro(PaddingRight, int, 0, 4000);
139  vtkGetMacro(PaddingRight, int);
141 
143 
148  vtkSetClampMacro(PaddingTop, int, 0, 4000);
149  vtkGetMacro(PaddingTop, int);
151 
153 
158  vtkSetClampMacro(PaddingBottom, int, 0, 4000);
159  vtkGetMacro(PaddingBottom, int);
161 
163 
168  void SetPadding(int padding);
170 
171 protected:
173  ~vtkTextRepresentation() override;
174 
175  // Initialize text actor
176  virtual void InitializeTextActor();
177 
178  // Check and adjust boundaries according to the size of the text
179  virtual void CheckTextBoundary();
180 
181  // the text to manage
184 
185  // observer to observe internal TextActor and TextProperty
186  vtkTextRepresentationObserver* Observer;
187 
188  int PaddingLeft = 0;
189  int PaddingRight = 0;
190  int PaddingTop = 0;
191  int PaddingBottom = 0;
192 
193 private:
195  void operator=(const vtkTextRepresentation&) = delete;
196 };
197 
198 VTK_ABI_NAMESPACE_END
199 #endif
int RenderOverlay(vtkViewport *) override
These methods are necessary to make this representation behave as a vtkProp.
abstract base class for most VTK objects
Definition: vtkObject.h:52
vtkTypeBool HasTranslucentPolygonalGeometry() override
These methods are necessary to make this representation behave as a vtkProp.
abstract specification for Viewports
Definition: vtkViewport.h:46
vtkTextProperty * TextProperty
vtkTextRepresentationObserver * Observer
#define VTK_MARSHAL_EXCLUDE_REASON_IS_REDUNDANT
int RenderOpaqueGeometry(vtkViewport *) override
These methods are necessary to make this representation behave as a vtkProp.
void GetActors2D(vtkPropCollection *) override
These methods are necessary to make this representation behave as a vtkProp.
abstract specification for renderers
Definition: vtkRenderer.h:63
represent text for vtkTextWidget
static vtkBorderRepresentation * New()
Instantiate this class.
an ordered list of Props
void PrintSelf(ostream &os, vtkIndent indent) override
Define standard methods.
int vtkTypeBool
Definition: vtkABI.h:64
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
An actor that displays text.
Definition: vtkTextActor.h:48
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
These methods are necessary to make this representation behave as a vtkProp.
a simple class to control print indentation
Definition: vtkIndent.h:28
void ReleaseGraphicsResources(vtkWindow *) override
These methods are necessary to make this representation behave as a vtkProp.
represent a vtkBorderWidget
represent text properties.
#define VTK_MARSHALEXCLUDE(reason)
#define VTK_MARSHALAUTO
virtual void SetWindowLocation(int enumLocation)
Set the representation position, by enumeration ( AnyLocation = 0, LowerLeftCorner, LowerRightCorner, LowerCenter, UpperLeftCorner, UpperRightCorner, UpperCenter) related to the render window.
void SetPosition(double pos[2]) override
Set the text position, by overriding the same function of vtkBorderRepresentation so that the Modifie...