VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 "vtkRenderingFreeTypeModule.h" // For export macro
44 #include "vtkActor2D.h"
45 
46 class vtkTextProperty;
48 class vtkImageData;
49 class vtkTextRenderer;
50 class vtkTransform;
51 class vtkPolyData;
52 class vtkPoints;
53 class vtkTexture;
54 
56 {
57 public:
59  void PrintSelf(ostream& os, vtkIndent indent);
60 
63  static vtkTextActor *New();
64 
67  void ShallowCopy(vtkProp *prop);
68 
71  void SetMapper(vtkPolyDataMapper2D *mapper);
72 
74 
77  void SetInput(const char *inputString);
78  char *GetInput();
80 
82 
84  vtkSetVector2Macro(MinimumSize,int);
85  vtkGetVector2Macro(MinimumSize,int);
87 
89 
92  vtkSetMacro(MaximumLineHeight,float);
93  vtkGetMacro(MaximumLineHeight,float);
95 
97 
104  vtkSetClampMacro(TextScaleMode, int,
105  TEXT_SCALE_MODE_NONE, TEXT_SCALE_MODE_VIEWPORT);
106  vtkGetMacro(TextScaleMode, int);
108  { this->SetTextScaleMode(TEXT_SCALE_MODE_NONE); }
110  { this->SetTextScaleMode(TEXT_SCALE_MODE_PROP); }
112  { this->SetTextScaleMode(TEXT_SCALE_MODE_VIEWPORT); }
114 
115 //BTX
116  enum {
117  TEXT_SCALE_MODE_NONE = 0,
119  TEXT_SCALE_MODE_VIEWPORT
120  };
121 //ETX
122 
124 
127  vtkSetMacro(UseBorderAlign,int);
128  vtkGetMacro(UseBorderAlign,int);
129  vtkBooleanMacro(UseBorderAlign,int);
131 
133 
141  void SetAlignmentPoint(int point);
142  int GetAlignmentPoint();
144 
146 
150  void SetOrientation(float orientation);
151  vtkGetMacro(Orientation,float);
153 
155 
156  virtual void SetTextProperty(vtkTextProperty *p);
157  vtkGetObjectMacro(TextProperty,vtkTextProperty);
159 
163  virtual void GetBoundingBox(vtkViewport* vport, double bbox[4]);
164 
167  virtual void GetSize(vtkViewport* vport, double size[2]);
168 
170 
174  virtual int SetConstrainedFontSize(
175  vtkViewport*, int targetWidth, int targetHeight);
176  static int SetConstrainedFontSize(
177  vtkTextActor*, vtkViewport*, int targetWidth, int targetHeight);
179 
181 
185  static int SetMultipleConstrainedFontSize(
186  vtkViewport*, int targetWidth, int targetHeight,
187  vtkTextActor** actors, int nbOfActors, int* maxResultingSize);
189 
197  virtual void SetNonLinearFontScale(double exponent, int target);
198 
201  void SpecifiedToDisplay(double *pos, vtkViewport *vport, int specified);
202 
205  void DisplayToSpecified(double *pos, vtkViewport *vport, int specified);
206 
209  virtual void ComputeScaledFont(vtkViewport *viewport);
210 
212 
214  vtkGetObjectMacro(ScaledTextProperty, vtkTextProperty);
216 
223  static float GetFontScale(vtkViewport *viewport);
224 
225 //BTX
230  virtual void ReleaseGraphicsResources(vtkWindow *);
231 
233 
236  virtual int RenderOpaqueGeometry(vtkViewport* viewport);
238  virtual int RenderOverlay(vtkViewport* viewport);
240 
242 
243  virtual int HasTranslucentPolygonalGeometry();
244 //ETX
246 
247 protected:
250  void SetMapper(vtkMapper2D *mapper);
251 
253  virtual bool RenderImage(vtkTextProperty *tprop, vtkViewport *viewport);
254 
256 
257  virtual bool GetImageBoundingBox(
258  vtkTextProperty *tprop, vtkViewport *viewport, int bbox[4]);
260 
261  vtkTextActor();
262  ~vtkTextActor();
263 
264  int MinimumSize[2];
268  float Orientation;
270 
273  // This used to be "Mapper" but I changed it to PDMapper because
274  // Mapper is an ivar in Actor2D (bad form).
279  int LastSize[2];
280  int LastOrigin[2];
281  char *Input;
284 
286 
287  // Stuff needed to display the image text as a texture map.
291 
292  virtual void ComputeRectangle(vtkViewport *viewport);
293 
301  virtual int UpdateRectangle(vtkViewport* viewport);
302 
303  // Set/Get the texture object to control rendering texture maps. This will
304  // be a vtkTexture object. An actor does not need to have an associated
305  // texture map and multiple actors can share one texture.
306  // This was added for orienated text which is rendered with a
307  // vtkPolyDataMaper2D and a texture.
308  virtual void SetTexture(vtkTexture*);
309  vtkGetObjectMacro(Texture,vtkTexture);
310 
311 private:
312  vtkTextActor(const vtkTextActor&); // Not implemented.
313  void operator=(const vtkTextActor&); // Not implemented.
314 };
315 
316 
317 #endif
318 
bool InputRendered
Definition: vtkTextActor.h:282
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:50
GLsizeiptr size
Definition: vtkgl.h:11843
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
vtkPolyData * Rectangle
Definition: vtkTextActor.h:288
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
Definition: vtkTextActor.h:237
void SetTextScaleModeToViewport()
Definition: vtkTextActor.h:111
virtual void ReleaseGraphicsResources(vtkWindow *)
abstract specification for Viewports
Definition: vtkViewport.h:46
virtual void SetMapper(vtkMapper2D *mapper)
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
a actor that draws 2D data
Definition: vtkActor2D.h:44
record modification and/or execution time
Definition: vtkTimeStamp.h:34
vtkPoints * RectanglePoints
Definition: vtkTextActor.h:289
vtkTextProperty * ScaledTextProperty
Definition: vtkTextActor.h:285
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:133
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:59
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:83
#define VTKRENDERINGFREETYPE_EXPORT
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
vtkImageData * ImageData
Definition: vtkTextActor.h:272
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
An actor that displays text. Scaled or unscaled.
Definition: vtkTextActor.h:55
double FontScaleExponent
Definition: vtkTextActor.h:266
vtkTimeStamp BuildTime
Definition: vtkTextActor.h:277
vtkTransform * Transform
Definition: vtkTextActor.h:278
virtual int HasTranslucentPolygonalGeometry()
virtual int RenderOpaqueGeometry(vtkViewport *viewport)
a simple class to control print indentation
Definition: vtkIndent.h:38
void SetTextScaleModeToProp()
Definition: vtkTextActor.h:109
void PrintSelf(ostream &os, vtkIndent indent)
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
static vtkActor2D * New()
handles properties associated with a texture map
Definition: vtkTexture.h:69
float Orientation
Definition: vtkTextActor.h:268
vtkTextRenderer * TextRenderer
Definition: vtkTextActor.h:276
represent text properties.
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:222
void SetTextScaleModeToNone()
Definition: vtkTextActor.h:107
float MaximumLineHeight
Definition: vtkTextActor.h:265
Interface for generating images and path data from string data, using multiple backends.
#define vtkGetVector2Macro(name, type)
Definition: vtkSetGet.h:260
virtual void ShallowCopy(vtkProp *prop)
vtkTextProperty * TextProperty
Definition: vtkTextActor.h:271
virtual int RenderOverlay(vtkViewport *viewport)
#define vtkBooleanMacro(name, type)
Definition: vtkSetGet.h:234
#define vtkSetVector2Macro(name, type)
Definition: vtkSetGet.h:244
abstract class specifies interface for objects which render 2D actors
Definition: vtkMapper2D.h:34
vtkPolyDataMapper2D * PDMapper
Definition: vtkTextActor.h:275
draw vtkPolyData onto the image plane
vtkTexture * Texture
Definition: vtkTextActor.h:290
represent and manipulate 3D points
Definition: vtkPoints.h:39
double FormerOrientation
Definition: vtkTextActor.h:283
GLfloat GLfloat p
Definition: vtkgl.h:15717
#define vtkSetMacro(name, type)
Definition: vtkSetGet.h:69