VTK  9.0.1
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 =========================================================================*/
27 #ifndef vtkTextRepresentation_h
28 #define vtkTextRepresentation_h
29 
31 #include "vtkInteractionWidgetsModule.h" // For export macro
32 
33 class vtkRenderer;
34 class vtkTextActor;
35 class vtkTextProperty;
36 class vtkTextRepresentationObserver;
37 
38 class VTKINTERACTIONWIDGETS_EXPORT vtkTextRepresentation : public vtkBorderRepresentation
39 {
40 public:
45 
47 
51  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
55 
59  void SetTextActor(vtkTextActor* textActor);
60  vtkGetObjectMacro(TextActor, vtkTextActor);
62 
64 
67  void SetText(const char* text);
68  const char* GetText();
70 
74  void BuildRepresentation() override;
75  void GetSize(double size[2]) override
76  {
77  size[0] = 2.0;
78  size[1] = 2.0;
79  }
80 
82 
86  void GetActors2D(vtkPropCollection*) override;
88  int RenderOverlay(vtkViewport*) 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 { this->SetPosition(pos[0], pos[1]); }
129 
131 
134  void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
135  void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
137 
138 protected:
141 
142  // Initialize text actor
143  virtual void InitializeTextActor();
144 
145  // Check and adjust boundaries according to the size of the text
146  virtual void CheckTextBoundary();
147 
148  // the text to manage
151 
152  // Window location by enumeration
154  virtual void UpdateWindowLocation();
155 
156  // observer to observe internal TextActor and TextProperty
157  vtkTextRepresentationObserver* Observer;
158 
159 private:
161  void operator=(const vtkTextRepresentation&) = delete;
162 };
163 
164 #endif
vtkTextRepresentation::SetPosition
void SetPosition(double pos[2]) override
Definition: vtkTextRepresentation.h:127
vtkBorderRepresentation
represent a vtkBorderWidget
Definition: vtkBorderRepresentation.h:55
vtkTextRepresentation::GetActors2D
void GetActors2D(vtkPropCollection *) override
These methods are necessary to make this representation behave as a vtkProp.
vtkTextRepresentation::~vtkTextRepresentation
~vtkTextRepresentation() override
vtkTextRepresentation::vtkTextRepresentation
vtkTextRepresentation()
vtkTextRepresentation::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
vtkTextRepresentation::SetWindowLocation
virtual void SetWindowLocation(int enumLocation)
Set the text position, by enumeration ( AnyLocation = 0, LowerLeftCorner, LowerRightCorner,...
vtkTextRepresentation::UpperRightCorner
@ UpperRightCorner
Definition: vtkTextRepresentation.h:101
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:54
vtkTextRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTextRepresentation::Observer
vtkTextRepresentationObserver * Observer
Definition: vtkTextRepresentation.h:157
vtkTextRepresentation::BuildRepresentation
void BuildRepresentation() override
Satisfy the superclasses API.
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
vtkTextRepresentation::SetTextActor
void SetTextActor(vtkTextActor *textActor)
Specify the vtkTextActor to manage.
vtkTextRepresentation::HasTranslucentPolygonalGeometry
vtkTypeBool HasTranslucentPolygonalGeometry() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkTextRepresentation::TextProperty
vtkTextProperty * TextProperty
Definition: vtkTextRepresentation.h:150
vtkBorderRepresentation.h
vtkTextRepresentation::ExecuteTextPropertyModifiedEvent
void ExecuteTextPropertyModifiedEvent(vtkObject *obj, unsigned long enumEvent, void *p)
Internal.
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
represent text for vtkTextWidget
Definition: vtkTextRepresentation.h:39
vtkTextRepresentation::LowerCenter
@ LowerCenter
Definition: vtkTextRepresentation.h:99
vtkTextRepresentation::GetText
const char * GetText()
vtkTextRepresentation::ExecuteTextActorModifiedEvent
void ExecuteTextActorModifiedEvent(vtkObject *obj, unsigned long enumEvent, void *p)
vtkTextRepresentation::RenderOpaqueGeometry
int RenderOpaqueGeometry(vtkViewport *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkTextActor
An actor that displays text.
Definition: vtkTextActor.h:51
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkTextRepresentation::LowerLeftCorner
@ LowerLeftCorner
Definition: vtkTextRepresentation.h:97
vtkX3D::size
@ size
Definition: vtkX3D.h:259
vtkTextRepresentation::UpdateWindowLocation
virtual void UpdateWindowLocation()
vtkTextRepresentation::UpperLeftCorner
@ UpperLeftCorner
Definition: vtkTextRepresentation.h:100
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:45
vtkTextRepresentation::InitializeTextActor
virtual void InitializeTextActor()
vtkTextRepresentation::WindowLocation
int WindowLocation
Definition: vtkTextRepresentation.h:153
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:34
vtkTextRepresentation::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
vtkTextRepresentation::SetText
void SetText(const char *text)
Get/Set the text string display by this representation.
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:59
vtkTextRepresentation::CheckTextBoundary
virtual void CheckTextBoundary()
vtkTextRepresentation::New
static vtkTextRepresentation * New()
Instantiate class.
vtkTextRepresentation::TextActor
vtkTextActor * TextActor
Definition: vtkTextRepresentation.h:149
vtkTextRepresentation::GetSize
void GetSize(double size[2]) override
Definition: vtkTextRepresentation.h:75
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:36
vtkTextRepresentation::RenderOverlay
int RenderOverlay(vtkViewport *) override
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkTextRepresentation::LowerRightCorner
@ LowerRightCorner
Definition: vtkTextRepresentation.h:98