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 =========================================================================*/
29 #ifndef __vtkTextRepresentation_h
30 #define __vtkTextRepresentation_h
31 
33 
34 class vtkRenderer;
35 class vtkTextActor;
36 class vtkTextProperty;
37 class vtkTextRepresentationObserver;
38 
40 {
41 public:
43  static vtkTextRepresentation *New();
44 
46 
48  void PrintSelf(ostream& os, vtkIndent indent);
50 
52 
54  void SetTextActor(vtkTextActor *textActor);
55  vtkGetObjectMacro(TextActor,vtkTextActor);
57 
59 
60  void SetText(const char* text);
61  const char* GetText();
63 
65 
66  virtual void BuildRepresentation();
67  virtual void GetSize(double size[2])
68  {size[0]=2.0; size[1]=2.0;}
70 
72 
74  virtual void GetActors2D(vtkPropCollection*);
75  virtual void ReleaseGraphicsResources(vtkWindow*);
76  virtual int RenderOverlay(vtkViewport*);
77  virtual int RenderOpaqueGeometry(vtkViewport*);
79  virtual int HasTranslucentPolygonalGeometry();
81 
82  //BTX
83  enum
84  {
85  AnyLocation = 0,
91  UpperCenter
92  };
93  //ETX
94 
96 
99  virtual void SetWindowLocation(int enumLocation);
100  vtkGetMacro(WindowLocation, int);
102 
104 
106  virtual void SetPosition(double x, double y);
107  virtual void SetPosition(double pos[2])
108  { this->SetPosition(pos[0], pos[1]);};
110 
112 
113  void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
114  void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
116 
117 protected:
120 
121  // Initialize text actor
122  virtual void InitializeTextActor();
123 
124  // Check and adjust boundaries according to the size of the text
125  virtual void CheckTextBoundary();
126 
127  // the text to manage
130 
131  // Window location by enumeration
133  virtual void UpdateWindowLocation();
134 
135  // observer to observe internal TextActor and TextProperty
136  vtkTextRepresentationObserver *Observer;
137 
138 private:
139  vtkTextRepresentation(const vtkTextRepresentation&); //Not implemented
140  void operator=(const vtkTextRepresentation&); //Not implemented
141 };
142 
143 #endif