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 
163 
165 
173  vtkGetMacro(Orientation,float);
175 
177 
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 
203  vtkViewport*, int targetWidth, int targetHeight);
205  vtkTextActor*, vtkViewport*, int targetWidth, int targetHeight);
207 
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 
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
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:40
vtkPolyDataMapper2D
draw vtkPolyData onto the image plane
Definition: vtkPolyDataMapper2D.h:52
vtkTextActor::SetTextScaleModeToNone
void SetTextScaleModeToNone()
Definition: vtkTextActor.h:119
vtkTextActor::SetConstrainedFontSize
virtual int SetConstrainedFontSize(vtkViewport *, int targetWidth, int targetHeight)
Set and return the font size required to make this mapper fit in a given target rectangle (width x he...
vtkTextActor::SetTextScaleModeToProp
void SetTextScaleModeToProp()
Definition: vtkTextActor.h:121
vtkTextActor::SetOrientation
void SetOrientation(float orientation)
Counterclockwise rotation around the Alignment point.
vtkTextActor::GetSize
virtual void GetSize(vtkViewport *vport, double size[2])
Syntactic sugar to get the size of text instead of the entire bounding box.
vtkTexturedActor2D
actor that draws 2D data with texture support
Definition: vtkTexturedActor2D.h:42
vtkTextActor::SetTextProperty
virtual void SetTextProperty(vtkTextProperty *p)
Set/Get the text property.
vtkTextActor::New
static vtkTextActor * New()
Instantiate object with a rectangle in normaled view coordinates of (0.2,0.85, 0.8,...
vtkTextActor::SetAlignmentPoint
void SetAlignmentPoint(int point)
This method is being depricated.
vtkTextActor::HasTranslucentPolygonalGeometry
virtual int HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:36
vtkTextActor::ComputeScaledFont
virtual void ComputeScaledFont(vtkViewport *viewport)
Compute the scale the font should be given the viewport.
vtkTexturedActor2D.h
vtkTextActor::GetInput
char * GetInput()
vtkTextActor::SetConstrainedFontSize
static int SetConstrainedFontSize(vtkTextActor *, vtkViewport *, int targetWidth, int targetHeight)
vtkTextActor::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:61
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
vtkTextActor::GetAlignmentPoint
int GetAlignmentPoint()
vtkX3D::point
@ point
Definition: vtkX3D.h:236
ADIOS::Transform
Transform
Definition: ADIOSDefs.h:40
vtkTextActor::RenderOpaqueGeometry
virtual int RenderOpaqueGeometry(vtkViewport *viewport) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
vtkTextActor
An actor that displays text.
Definition: vtkTextActor.h:57
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkTextActor::SetNonLinearFontScale
virtual void SetNonLinearFontScale(double exponent, int target)
Enable non-linear scaling of font sizes.
vtkX3D::size
@ size
Definition: vtkX3D.h:253
vtkTextActor::TEXT_SCALE_MODE_PROP
@ TEXT_SCALE_MODE_PROP
Definition: vtkTextActor.h:129
vtkTextActor::RenderTranslucentPolygonalGeometry
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Definition: vtkTextActor.h:280
vtkTextActor::ShallowCopy
void ShallowCopy(vtkProp *prop) override
Shallow copy of this text actor.
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:48
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:40
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
vtkProperty2D
represent surface properties of a 2D image
Definition: vtkProperty2D.h:41
vtkTextActor::GetFontScale
static float GetFontScale(vtkViewport *viewport)
Provide a font scaling based on a viewport.
vtkX3D::orientation
@ orientation
Definition: vtkX3D.h:262
vtkTextActor::SetMultipleConstrainedFontSize
static int SetMultipleConstrainedFontSize(vtkViewport *, int targetWidth, int targetHeight, vtkTextActor **actors, int nbOfActors, int *maxResultingSize)
Set and return the font size required to make each element of an array of mappers fit in a given rect...
vtkTextRenderer
Interface for generating images and path data from string data, using multiple backends.
Definition: vtkTextRenderer.h:76
vtkTextActor::SpecifiedToDisplay
void SpecifiedToDisplay(double *pos, vtkViewport *vport, int specified)
This is just a simple coordinate conversion method used in the render process.
vtkTextActor::SetInput
void SetInput(const char *inputString)
Set the text string to be displayed.
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
vtkTextActor::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
vtkTextActor::GetBoundingBox
virtual void GetBoundingBox(vtkViewport *vport, double bbox[4])
Return the bounding box coordinates of the text in viewport coordinates.
vtkTextActor::DisplayToSpecified
void DisplayToSpecified(double *pos, vtkViewport *vport, int specified)
This is just a simple coordinate conversion method used in the render process.
target
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:829
vtkTextActor::SetTextScaleModeToViewport
void SetTextScaleModeToViewport()
Definition: vtkTextActor.h:123
BuildTime
vtkTimeStamp BuildTime
Updates the extensions string.
Definition: vtkOpenGLExtensionManager.h:390
vtkTextActor::RenderOverlay
virtual int RenderOverlay(vtkViewport *viewport) override
Support the standard render methods.