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 =========================================================================*/
35 #ifndef vtkTextActor_h
36 #define vtkTextActor_h
37 
38 #include "vtkRenderingCoreModule.h" // For export macro
39 #include "vtkTexturedActor2D.h"
40 
41 class vtkImageData;
42 class vtkPoints;
43 class vtkPolyData;
45 class vtkProperty2D;
46 class vtkTextProperty;
47 class vtkTextRenderer;
48 class vtkTransform;
49 
50 class VTKRENDERINGCORE_EXPORT vtkTextActor : public vtkTexturedActor2D
51 {
52 public:
54  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
55 
60  static vtkTextActor *New();
61 
66  void ShallowCopy(vtkProp *prop) VTK_OVERRIDE;
67 
69 
75  void SetInput(const char *inputString);
76  char *GetInput();
78 
80 
85  vtkSetVector2Macro(MinimumSize,int);
86  vtkGetVector2Macro(MinimumSize,int);
88 
90 
96  vtkSetMacro(MaximumLineHeight,float);
97  vtkGetMacro(MaximumLineHeight,float);
99 
101 
110  vtkSetClampMacro(TextScaleMode, int,
111  TEXT_SCALE_MODE_NONE, TEXT_SCALE_MODE_VIEWPORT);
112  vtkGetMacro(TextScaleMode, int);
114  { this->SetTextScaleMode(TEXT_SCALE_MODE_NONE); }
116  { this->SetTextScaleMode(TEXT_SCALE_MODE_PROP); }
118  { this->SetTextScaleMode(TEXT_SCALE_MODE_VIEWPORT); }
120 
121  enum {
122  TEXT_SCALE_MODE_NONE = 0,
124  TEXT_SCALE_MODE_VIEWPORT
125  };
126 
128 
133  vtkSetMacro(UseBorderAlign,int);
134  vtkGetMacro(UseBorderAlign,int);
135  vtkBooleanMacro(UseBorderAlign,int);
137 
139 
154  void SetAlignmentPoint(int point);
155  int GetAlignmentPoint();
157 
159 
166  void SetOrientation(float orientation);
167  vtkGetMacro(Orientation,float);
169 
171 
174  virtual void SetTextProperty(vtkTextProperty *p);
175  vtkGetObjectMacro(TextProperty,vtkTextProperty);
177 
183  virtual void GetBoundingBox(vtkViewport* vport, double bbox[4]);
184 
188  virtual void GetSize(vtkViewport* vport, double size[2]);
189 
191 
196  virtual int SetConstrainedFontSize(
197  vtkViewport*, int targetWidth, int targetHeight);
198  static int SetConstrainedFontSize(
199  vtkTextActor*, vtkViewport*, int targetWidth, int targetHeight);
201 
208  static int SetMultipleConstrainedFontSize(
209  vtkViewport*, int targetWidth, int targetHeight,
210  vtkTextActor** actors, int nbOfActors, int* maxResultingSize);
211 
221  virtual void SetNonLinearFontScale(double exponent, int target);
222 
227  void SpecifiedToDisplay(double *pos, vtkViewport *vport, int specified);
228 
233  void DisplayToSpecified(double *pos, vtkViewport *vport, int specified);
234 
239  virtual void ComputeScaledFont(vtkViewport *viewport);
240 
242 
246  vtkGetObjectMacro(ScaledTextProperty, vtkTextProperty);
248 
256  static float GetFontScale(vtkViewport *viewport);
257 
265  void ReleaseGraphicsResources(vtkWindow *) VTK_OVERRIDE;
266 
268 
273  int RenderOpaqueGeometry(vtkViewport* viewport) VTK_OVERRIDE;
274  int RenderTranslucentPolygonalGeometry(vtkViewport* ) VTK_OVERRIDE {return 0;};
275  int RenderOverlay(vtkViewport* viewport) VTK_OVERRIDE;
277 
281  int HasTranslucentPolygonalGeometry() VTK_OVERRIDE;
282 
283 protected:
287  virtual bool RenderImage(vtkTextProperty *tprop, vtkViewport *viewport);
288 
292  virtual bool GetImageBoundingBox(
293  vtkTextProperty *tprop, vtkViewport *viewport, int bbox[4]);
294 
295  vtkTextActor();
296  ~vtkTextActor() VTK_OVERRIDE;
297 
298  int MinimumSize[2];
299  float MaximumLineHeight;
300  double FontScaleExponent;
301  int TextScaleMode;
302  float Orientation;
303  int UseBorderAlign;
304 
305  vtkTextProperty *TextProperty;
306  vtkImageData *ImageData;
307  vtkTextRenderer *TextRenderer;
310  int LastSize[2];
311  int LastOrigin[2];
312  char *Input;
313  bool InputRendered;
314  double FormerOrientation;
315  int RenderedDPI;
316 
317  vtkTextProperty *ScaledTextProperty;
318 
319  // Stuff needed to display the image text as a texture map.
320  vtkPolyData* Rectangle;
321  vtkPoints* RectanglePoints;
322 
323  virtual void ComputeRectangle(vtkViewport *viewport);
324 
338  virtual int UpdateRectangle(vtkViewport* viewport);
339 
340 private:
341  vtkTextActor(const vtkTextActor&) VTK_DELETE_FUNCTION;
342  void operator=(const vtkTextActor&) VTK_DELETE_FUNCTION;
343 };
344 
345 
346 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:44
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:117
abstract specification for Viewports
Definition: vtkViewport.h:44
record modification and/or execution time
Definition: vtkTimeStamp.h:32
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
An actor that displays text.
Definition: vtkTextActor.h:50
int RenderOpaqueGeometry(vtkViewport *viewport) override
Support the standard render methods.
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:33
int HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
void SetTextScaleModeToProp()
Set how text should be scaled.
Definition: vtkTextActor.h:115
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
Definition: vtkTextActor.h:274
represent text properties.
void SetTextScaleModeToNone()
Set how text should be scaled.
Definition: vtkTextActor.h:113
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.
represent surface properties of a 2D image
Definition: vtkProperty2D.h:37
int RenderOverlay(vtkViewport *viewport) override
Support the standard render methods.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
static vtkTexturedActor2D * New()
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkTexturedActor2D.
draw vtkPolyData onto the image plane
void ReleaseGraphicsResources(vtkWindow *win) override
Release any graphics resources that are being consumed by this actor.
represent and manipulate 3D points
Definition: vtkPoints.h:33
Transform
Definition: ADIOSDefs.h:39