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 =========================================================================*/
27 #ifndef vtkTextRepresentation_h
28 #define vtkTextRepresentation_h
29 
30 #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:
44  static vtkTextRepresentation *New();
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  {size[0]=2.0; size[1]=2.0;}
77 
79 
83  void GetActors2D(vtkPropCollection*) override;
84  void ReleaseGraphicsResources(vtkWindow*) override;
85  int RenderOverlay(vtkViewport*) override;
86  int RenderOpaqueGeometry(vtkViewport*) override;
88  int HasTranslucentPolygonalGeometry() override;
90 
91  enum
92  {
93  AnyLocation = 0,
99  UpperCenter
100  };
101 
103 
114  virtual void SetWindowLocation(int enumLocation);
115  vtkGetMacro(WindowLocation, int);
117 
119 
123  void SetPosition(double x, double y) override;
124  void SetPosition(double pos[2]) override
125  { this->SetPosition(pos[0], pos[1]);};
127 
129 
132  void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
133  void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
135 
136 protected:
138  ~vtkTextRepresentation() override;
139 
140  // Initialize text actor
141  virtual void InitializeTextActor();
142 
143  // Check and adjust boundaries according to the size of the text
144  virtual void CheckTextBoundary();
145 
146  // the text to manage
149 
150  // Window location by enumeration
152  virtual void UpdateWindowLocation();
153 
154  // observer to observe internal TextActor and TextProperty
155  vtkTextRepresentationObserver *Observer;
156 
157 private:
159  void operator=(const vtkTextRepresentation&) = delete;
160 };
161 
162 #endif
vtkTextRepresentation::UpperLeftCorner
Definition: vtkTextRepresentation.h:97
vtkTextRepresentation::SetPosition
void SetPosition(double pos[2]) override
Definition: vtkTextRepresentation.h:124
vtkBorderRepresentation
represent a vtkBorderWidget
Definition: vtkBorderRepresentation.h:55
vtkBorderRepresentation::RenderOpaqueGeometry
int RenderOpaqueGeometry(vtkViewport *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkBorderRepresentation::New
static vtkBorderRepresentation * New()
Instantiate this class.
vtkTextRepresentation::UpperRightCorner
Definition: vtkTextRepresentation.h:98
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:53
vtkTextRepresentation::Observer
vtkTextRepresentationObserver * Observer
Definition: vtkTextRepresentation.h:155
vtkBorderRepresentation::SetPosition
virtual void SetPosition(float x[2])
vtkBorderRepresentation::BuildRepresentation
void BuildRepresentation() override
Subclasses should implement these methods.
vtkBorderRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkBorderRepresentation::GetActors2D
void GetActors2D(vtkPropCollection *) override
These methods are necessary to make this representation behave as a vtkProp.
vtkTextRepresentation::TextProperty
vtkTextProperty * TextProperty
Definition: vtkTextRepresentation.h:148
vtkBorderRepresentation.h
vtkTextRepresentation
represent text for vtkTextWidget
Definition: vtkTextRepresentation.h:38
vtkBorderRepresentation::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
vtkTextRepresentation::LowerRightCorner
Definition: vtkTextRepresentation.h:95
vtkTextActor
An actor that displays text. Scaled or unscaled.
Definition: vtkTextActor.h:50
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkBorderRepresentation::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
vtkX3D::size
Definition: vtkX3D.h:253
vtkTextRepresentation::LowerCenter
Definition: vtkTextRepresentation.h:96
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:44
vtkTextRepresentation::WindowLocation
int WindowLocation
Definition: vtkTextRepresentation.h:151
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:33
vtkTextRepresentation::LowerLeftCorner
Definition: vtkTextRepresentation.h:94
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:57
vtkTextRepresentation::TextActor
vtkTextActor * TextActor
Definition: vtkTextRepresentation.h:147
vtkBorderRepresentation::RenderOverlay
int RenderOverlay(vtkViewport *) override
vtkTextRepresentation::GetSize
void GetSize(double size[2]) override
Definition: vtkTextRepresentation.h:75
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:35
vtkBorderRepresentation::HasTranslucentPolygonalGeometry
int HasTranslucentPolygonalGeometry() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...