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 
32 #include "vtkInteractionWidgetsModule.h" // For export macro
34 
35 class vtkRenderer;
36 class vtkTextActor;
37 class vtkTextProperty;
38 class vtkTextRepresentationObserver;
39 
41 {
42 public:
44  static vtkTextRepresentation *New();
45 
47 
49  void PrintSelf(ostream& os, vtkIndent indent);
51 
53 
55  void SetTextActor(vtkTextActor *textActor);
56  vtkGetObjectMacro(TextActor,vtkTextActor);
58 
60 
61  void SetText(const char* text);
62  const char* GetText();
64 
66 
67  virtual void BuildRepresentation();
68  virtual void GetSize(double size[2])
69  {size[0]=2.0; size[1]=2.0;}
71 
73 
75  virtual void GetActors2D(vtkPropCollection*);
76  virtual void ReleaseGraphicsResources(vtkWindow*);
77  virtual int RenderOverlay(vtkViewport*);
78  virtual int RenderOpaqueGeometry(vtkViewport*);
80  virtual int HasTranslucentPolygonalGeometry();
82 
83  //BTX
84  enum
85  {
86  AnyLocation = 0,
92  UpperCenter
93  };
94  //ETX
95 
97 
100  virtual void SetWindowLocation(int enumLocation);
101  vtkGetMacro(WindowLocation, int);
103 
105 
107  virtual void SetPosition(double x, double y);
108  virtual void SetPosition(double pos[2])
109  { this->SetPosition(pos[0], pos[1]);};
111 
113 
114  void ExecuteTextPropertyModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
115  void ExecuteTextActorModifiedEvent(vtkObject* obj, unsigned long enumEvent, void* p);
117 
118 protected:
121 
122  // Initialize text actor
123  virtual void InitializeTextActor();
124 
125  // Check and adjust boundaries according to the size of the text
126  virtual void CheckTextBoundary();
127 
128  // the text to manage
131 
132  // Window location by enumeration
134  virtual void UpdateWindowLocation();
135 
136  // observer to observe internal TextActor and TextProperty
137  vtkTextRepresentationObserver *Observer;
138 
139 private:
140  vtkTextRepresentation(const vtkTextRepresentation&); //Not implemented
141  void operator=(const vtkTextRepresentation&); //Not implemented
142 };
143 
144 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:61
virtual void SetPosition(double pos[2])
virtual void SetPosition(float x[2])
void PrintSelf(ostream &os, vtkIndent indent)
abstract specification for Viewports
Definition: vtkViewport.h:46
vtkTextProperty * TextProperty
vtkTextRepresentationObserver * Observer
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
virtual void GetActors2D(vtkPropCollection *)
abstract specification for renderers
Definition: vtkRenderer.h:63
represent text for vtkTextWidget
static vtkBorderRepresentation * New()
a list of Props
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
#define VTKINTERACTIONWIDGETS_EXPORT
An actor that displays text. Scaled or unscaled.
Definition: vtkTextActor.h:54
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual int RenderOpaqueGeometry(vtkViewport *)
virtual void BuildRepresentation()
virtual int RenderOverlay(vtkViewport *)
represent a vtkBorderWidget
represent text properties.
virtual int HasTranslucentPolygonalGeometry()
virtual void ReleaseGraphicsResources(vtkWindow *)
virtual void GetSize(double size[2])