VTK
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 =========================================================================*/
30 #ifndef vtkTextRepresentation_h
31 #define vtkTextRepresentation_h
32 
33 #include "vtkInteractionWidgetsModule.h" // For export macro
35 
36 class vtkRenderer;
37 class vtkTextActor;
38 class vtkTextProperty;
39 class vtkTextRepresentationObserver;
40 
41 class VTKINTERACTIONWIDGETS_EXPORT vtkTextRepresentation : public vtkBorderRepresentation
42 {
43 public:
47  static vtkTextRepresentation *New();
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  {size[0]=2.0; size[1]=2.0;}
80 
82 
86  void GetActors2D(vtkPropCollection*) override;
87  void ReleaseGraphicsResources(vtkWindow*) override;
88  int RenderOverlay(vtkViewport*) override;
89  int RenderOpaqueGeometry(vtkViewport*) override;
91  int HasTranslucentPolygonalGeometry() override;
93 
94  enum
95  {
96  AnyLocation = 0,
102  UpperCenter
103  };
104 
106 
117  virtual void SetWindowLocation(int enumLocation);
118  vtkGetMacro(WindowLocation, int);
120 
122 
126  void SetPosition(double x, double y) override;
127  void SetPosition(double pos[2]) override
128  { this->SetPosition(pos[0], pos[1]);};
130 
132 
135  void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
136  void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
138 
139 protected:
141  ~vtkTextRepresentation() override;
142 
143  // Initialize text actor
144  virtual void InitializeTextActor();
145 
146  // Check and adjust boundaries according to the size of the text
147  virtual void CheckTextBoundary();
148 
149  // the text to manage
152 
153  // Window location by enumeration
155  virtual void UpdateWindowLocation();
156 
157  // observer to observe internal TextActor and TextProperty
158  vtkTextRepresentationObserver *Observer;
159 
160 private:
162  void operator=(const vtkTextRepresentation&) = delete;
163 };
164 
165 #endif
int RenderOverlay(vtkViewport *) override
These methods are necessary to make this representation behave as a vtkProp.
int HasTranslucentPolygonalGeometry() override
These methods are necessary to make this representation behave as a vtkProp.
abstract base class for most VTK objects
Definition: vtkObject.h:59
virtual void SetPosition(float x[2])
Specify opposite corners of the box defining the boundary of the widget.
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkTextProperty * TextProperty
vtkTextRepresentationObserver * Observer
void GetSize(double size[2]) override
Subclasses should implement these methods.
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.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
An actor that displays text.
Definition: vtkTextActor.h:56
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
These methods are necessary to make this representation behave as a vtkProp.
void BuildRepresentation() override
Subclasses should implement these methods.
a simple class to control print indentation
Definition: vtkIndent.h:39
void ReleaseGraphicsResources(vtkWindow *) override
These methods are necessary to make this representation behave as a vtkProp.
represent a vtkBorderWidget
represent text properties.
void SetPosition(double pos[2]) override
Set the text position, by overiding the same function of vtkBorderRepresentation so that the Modified...