VTK
vtkTextActor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkTextActor.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 =========================================================================*/
40 #ifndef __vtkTextActor_h
41 #define __vtkTextActor_h
42 
43 #include "vtkActor2D.h"
44 
45 class vtkTextProperty;
47 class vtkImageData;
49 class vtkTransform;
50 class vtkPolyData;
51 class vtkPoints;
52 class vtkTexture;
53 
55 {
56 public:
57  vtkTypeMacro(vtkTextActor,vtkActor2D);
58  void PrintSelf(ostream& os, vtkIndent indent);
59 
62  static vtkTextActor *New();
63 
66  void ShallowCopy(vtkProp *prop);
67 
70  void SetMapper(vtkPolyDataMapper2D *mapper);
71 
73 
76  void SetInput(const char *inputString);
77  char *GetInput();
79 
81 
83  vtkSetVector2Macro(MinimumSize,int);
84  vtkGetVector2Macro(MinimumSize,int);
86 
88 
91  vtkSetMacro(MaximumLineHeight,float);
92  vtkGetMacro(MaximumLineHeight,float);
94 
96 
103  vtkSetClampMacro(TextScaleMode, int,
104  TEXT_SCALE_MODE_NONE, TEXT_SCALE_MODE_VIEWPORT);
105  vtkGetMacro(TextScaleMode, int);
107  { this->SetTextScaleMode(TEXT_SCALE_MODE_NONE); }
109  { this->SetTextScaleMode(TEXT_SCALE_MODE_PROP); }
111  { this->SetTextScaleMode(TEXT_SCALE_MODE_VIEWPORT); }
113 
114 //BTX
115  enum {
116  TEXT_SCALE_MODE_NONE = 0,
118  TEXT_SCALE_MODE_VIEWPORT
119  };
120 //ETX
121 
123 
125  VTK_LEGACY(void SetScaledText(int));
126  VTK_LEGACY(int GetScaledText());
127  VTK_LEGACY(void ScaledTextOn());
128  VTK_LEGACY(void ScaledTextOff());
130 
132 
135  vtkSetMacro(UseBorderAlign,int);
136  vtkGetMacro(UseBorderAlign,int);
137  vtkBooleanMacro(UseBorderAlign,int);
139 
141 
149  void SetAlignmentPoint(int point);
150  int GetAlignmentPoint();
152 
154 
158  void SetOrientation(float orientation);
159  vtkGetMacro(Orientation,float);
161 
163 
164  virtual void SetTextProperty(vtkTextProperty *p);
165  vtkGetObjectMacro(TextProperty,vtkTextProperty);
167 
175  virtual void SetNonLinearFontScale(double exponent, int target);
176 
179  void SpecifiedToDisplay(double *pos, vtkViewport *vport, int specified);
180 
183  void DisplayToSpecified(double *pos, vtkViewport *vport, int specified);
184 
187  virtual void ComputeScaledFont(vtkViewport *viewport);
188 
190 
192  vtkGetObjectMacro(ScaledTextProperty, vtkTextProperty);
194 
201  static float GetFontScale(vtkViewport *viewport);
202 
203 //BTX
208  virtual void ReleaseGraphicsResources(vtkWindow *);
209 
211 
214  virtual int RenderOpaqueGeometry(vtkViewport* viewport);
216  virtual int RenderOverlay(vtkViewport* viewport);
218 
220 
221  virtual int HasTranslucentPolygonalGeometry();
222 //ETX
224 
225 protected:
228  void SetMapper(vtkMapper2D *mapper);
229 
230  vtkTextActor();
231  ~vtkTextActor();
232 
233  int MinimumSize[2];
237  float Orientation;
239 
242  // This used to be "Mapper" but I changed it to PDMapper because
243  // Mapper is an ivar in Actor2D (bad form).
248  int LastSize[2];
249  int LastOrigin[2];
250  char *Input;
253 
255 
256  // Stuff needed to display the image text as a texture map.
260 
261  virtual void ComputeRectangle(vtkViewport *viewport);
262 
263  // Set/Get the texture object to control rendering texture maps. This will
264  // be a vtkTexture object. An actor does not need to have an associated
265  // texture map and multiple actors can share one texture.
266  // This was added for orienated text which is rendered with a
267  // vtkPolyDataMaper2D and a texture.
268  virtual void SetTexture(vtkTexture*);
269  vtkGetObjectMacro(Texture,vtkTexture);
270 
271 private:
272  vtkTextActor(const vtkTextActor&); // Not implemented.
273  void operator=(const vtkTextActor&); // Not implemented.
274 };
275 
276 
277 #endif
278