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 =========================================================================*/
41 #ifndef vtkTextActor_h
42 #define vtkTextActor_h
43 
44 #include "vtkRenderingCoreModule.h" // For export macro
45 #include "vtkTexturedActor2D.h"
46 
47 class vtkImageData;
48 class vtkPoints;
49 class vtkPolyData;
51 class vtkProperty2D;
52 class vtkTextProperty;
53 class vtkTextRenderer;
54 class vtkTransform;
55 
56 class VTKRENDERINGCORE_EXPORT vtkTextActor : public vtkTexturedActor2D
57 {
58 public:
60  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
61 
66  static vtkTextActor *New();
67 
72  void ShallowCopy(vtkProp *prop) VTK_OVERRIDE;
73 
75 
81  void SetInput(const char *inputString);
82  char *GetInput();
84 
86 
91  vtkSetVector2Macro(MinimumSize,int);
92  vtkGetVector2Macro(MinimumSize,int);
94 
96 
102  vtkSetMacro(MaximumLineHeight,float);
103  vtkGetMacro(MaximumLineHeight,float);
105 
107 
116  vtkSetClampMacro(TextScaleMode, int,
117  TEXT_SCALE_MODE_NONE, TEXT_SCALE_MODE_VIEWPORT);
118  vtkGetMacro(TextScaleMode, int);
120  { this->SetTextScaleMode(TEXT_SCALE_MODE_NONE); }
122  { this->SetTextScaleMode(TEXT_SCALE_MODE_PROP); }
124  { this->SetTextScaleMode(TEXT_SCALE_MODE_VIEWPORT); }
126 
127  enum {
128  TEXT_SCALE_MODE_NONE = 0,
130  TEXT_SCALE_MODE_VIEWPORT
131  };
132 
134 
139  vtkSetMacro(UseBorderAlign,int);
140  vtkGetMacro(UseBorderAlign,int);
141  vtkBooleanMacro(UseBorderAlign,int);
143 
145 
160  void SetAlignmentPoint(int point);
161  int GetAlignmentPoint();
163 
165 
172  void SetOrientation(float orientation);
173  vtkGetMacro(Orientation,float);
175 
177 
180  virtual void SetTextProperty(vtkTextProperty *p);
181  vtkGetObjectMacro(TextProperty,vtkTextProperty);
183 
189  virtual void GetBoundingBox(vtkViewport* vport, double bbox[4]);
190 
194  virtual void GetSize(vtkViewport* vport, double size[2]);
195 
197 
202  virtual int SetConstrainedFontSize(
203  vtkViewport*, int targetWidth, int targetHeight);
204  static int SetConstrainedFontSize(
205  vtkTextActor*, vtkViewport*, int targetWidth, int targetHeight);
207 
214  static int SetMultipleConstrainedFontSize(
215  vtkViewport*, int targetWidth, int targetHeight,
216  vtkTextActor** actors, int nbOfActors, int* maxResultingSize);
217 
227  virtual void SetNonLinearFontScale(double exponent, int target);
228 
233  void SpecifiedToDisplay(double *pos, vtkViewport *vport, int specified);
234 
239  void DisplayToSpecified(double *pos, vtkViewport *vport, int specified);
240 
245  virtual void ComputeScaledFont(vtkViewport *viewport);
246 
248 
252  vtkGetObjectMacro(ScaledTextProperty, vtkTextProperty);
254 
262  static float GetFontScale(vtkViewport *viewport);
263 
271  virtual void ReleaseGraphicsResources(vtkWindow *) VTK_OVERRIDE;
272 
274 
279  virtual int RenderOpaqueGeometry(vtkViewport* viewport) VTK_OVERRIDE;
280  virtual int RenderTranslucentPolygonalGeometry(vtkViewport* ) VTK_OVERRIDE {return 0;};
281  virtual int RenderOverlay(vtkViewport* viewport) VTK_OVERRIDE;
283 
287  virtual int HasTranslucentPolygonalGeometry() VTK_OVERRIDE;
288 
289 protected:
293  virtual bool RenderImage(vtkTextProperty *tprop, vtkViewport *viewport);
294 
298  virtual bool GetImageBoundingBox(
299  vtkTextProperty *tprop, vtkViewport *viewport, int bbox[4]);
300 
301  vtkTextActor();
302  ~vtkTextActor();
303 
304  int MinimumSize[2];
305  float MaximumLineHeight;
306  double FontScaleExponent;
307  int TextScaleMode;
308  float Orientation;
309  int UseBorderAlign;
310 
311  vtkTextProperty *TextProperty;
312  vtkImageData *ImageData;
313  vtkTextRenderer *TextRenderer;
316  int LastSize[2];
317  int LastOrigin[2];
318  char *Input;
319  bool InputRendered;
320  double FormerOrientation;
321  int RenderedDPI;
322 
323  vtkTextProperty *ScaledTextProperty;
324 
325  // Stuff needed to display the image text as a texture map.
326  vtkPolyData* Rectangle;
327  vtkPoints* RectanglePoints;
328 
329  virtual void ComputeRectangle(vtkViewport *viewport);
330 
344  virtual int UpdateRectangle(vtkViewport* viewport);
345 
346 private:
347  vtkTextActor(const vtkTextActor&) VTK_DELETE_FUNCTION;
348  void operator=(const vtkTextActor&) VTK_DELETE_FUNCTION;
349 };
350 
351 
352 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:50
vtkTimeStamp BuildTime
actor that draws 2D data with texture support
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
void SetTextScaleModeToViewport()
Set how text should be scaled.
Definition: vtkTextActor.h:123
abstract specification for Viewports
Definition: vtkViewport.h:47
record modification and/or execution time
Definition: vtkTimeStamp.h:35
virtual void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkTexturedActor2D.
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
virtual int RenderOverlay(vtkViewport *viewport) override
Support the standard render methods.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
virtual int HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
An actor that displays text.
Definition: vtkTextActor.h:56
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:39
void SetTextScaleModeToProp()
Set how text should be scaled.
Definition: vtkTextActor.h:121
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
represent text properties.
void SetTextScaleModeToNone()
Set how text should be scaled.
Definition: vtkTextActor.h:119
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
Interface for generating images and path data from string data, using multiple backends.
virtual void ReleaseGraphicsResources(vtkWindow *win) override
Release any graphics resources that are being consumed by this actor.
represent surface properties of a 2D image
Definition: vtkProperty2D.h:40
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
static vtkTexturedActor2D * New()
draw vtkPolyData onto the image plane
represent and manipulate 3D points
Definition: vtkPoints.h:39
Transform
Definition: ADIOSDefs.h:39