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) override;
61 
66  static vtkTextActor *New();
67 
72  void ShallowCopy(vtkProp *prop) 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,vtkTypeBool);
140  vtkGetMacro(UseBorderAlign,vtkTypeBool);
141  vtkBooleanMacro(UseBorderAlign,vtkTypeBool);
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  void ReleaseGraphicsResources(vtkWindow *) override;
272 
274 
279  int RenderOpaqueGeometry(vtkViewport* viewport) override;
280  int RenderTranslucentPolygonalGeometry(vtkViewport* ) override {return 0;};
281  int RenderOverlay(vtkViewport* viewport) override;
283 
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() override;
303 
304  int MinimumSize[2];
308  float Orientation;
310 
316  int LastSize[2];
317  int LastOrigin[2];
318  char *Input;
322 
324 
325  // Stuff needed to display the image text as a texture map.
328 
329  virtual void ComputeRectangle(vtkViewport *viewport);
330 
344  virtual int UpdateRectangle(vtkViewport* viewport);
345 
346 private:
347  vtkTextActor(const vtkTextActor&) = delete;
348  void operator=(const vtkTextActor&) = delete;
349 };
350 
351 
352 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:39
vtkTextActor::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Definition: vtkTextActor.h:280
vtkPolyDataMapper2D
draw vtkPolyData onto the image plane
Definition: vtkPolyDataMapper2D.h:51
vtkTexturedActor2D::New
static vtkTexturedActor2D * New()
vtkTextActor::SetTextScaleModeToNone
void SetTextScaleModeToNone()
Definition: vtkTextActor.h:119
vtkTextActor::Orientation
float Orientation
Definition: vtkTextActor.h:308
vtkTextActor::SetTextScaleModeToProp
void SetTextScaleModeToProp()
Definition: vtkTextActor.h:121
vtkTexturedActor2D
actor that draws 2D data with texture support
Definition: vtkTexturedActor2D.h:41
vtkTextActor::FormerOrientation
double FormerOrientation
Definition: vtkTextActor.h:320
vtkTextActor::InputRendered
bool InputRendered
Definition: vtkTextActor.h:319
vtkTextActor::ImageData
vtkImageData * ImageData
Definition: vtkTextActor.h:312
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkTexturedActor2D.h
vtkTextActor::MaximumLineHeight
float MaximumLineHeight
Definition: vtkTextActor.h:305
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkTextActor::TEXT_SCALE_MODE_PROP
Definition: vtkTextActor.h:129
vtkX3D::point
Definition: vtkX3D.h:236
vtkTextActor::RectanglePoints
vtkPoints * RectanglePoints
Definition: vtkTextActor.h:327
vtkTextActor::ScaledTextProperty
vtkTextProperty * ScaledTextProperty
Definition: vtkTextActor.h:323
vtkTextActor::UseBorderAlign
vtkTypeBool UseBorderAlign
Definition: vtkTextActor.h:309
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkTextActor
An actor that displays text. Scaled or unscaled.
Definition: vtkTextActor.h:56
vtkTextActor::TextProperty
vtkTextProperty * TextProperty
Definition: vtkTextActor.h:311
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkTextActor::BuildTime
vtkTimeStamp BuildTime
Definition: vtkTextActor.h:314
vtkX3D::size
Definition: vtkX3D.h:253
vtkTexturedActor2D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTexturedActor2D::RenderOpaqueGeometry
int RenderOpaqueGeometry(vtkViewport *viewport) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkTexturedActor2D::RenderOverlay
int RenderOverlay(vtkViewport *viewport) override
Support the standard render methods.
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:39
vtkTextActor::Rectangle
vtkPolyData * Rectangle
Definition: vtkTextActor.h:326
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
vtkProperty2D
represent surface properties of a 2D image
Definition: vtkProperty2D.h:40
vtkX3D::orientation
Definition: vtkX3D.h:262
vtkTexturedActor2D::ShallowCopy
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkTexturedActor2D.
vtkTextRenderer
Interface for generating images and path data from string data, using multiple backends.
Definition: vtkTextRenderer.h:75
vtkTexturedActor2D::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *win) override
Release any graphics resources that are being consumed by this actor.
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkTextActor::TextRenderer
vtkTextRenderer * TextRenderer
Definition: vtkTextActor.h:313
vtkTextActor::TextScaleMode
int TextScaleMode
Definition: vtkTextActor.h:307
target
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:832
vtkActor2D::HasTranslucentPolygonalGeometry
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
vtkTextActor::FontScaleExponent
double FontScaleExponent
Definition: vtkTextActor.h:306
vtkTextActor::Input
char * Input
Definition: vtkTextActor.h:318
vtkTextActor::RenderedDPI
int RenderedDPI
Definition: vtkTextActor.h:321
vtkTextActor::Transform
vtkTransform * Transform
Definition: vtkTextActor.h:315
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkTextActor::SetTextScaleModeToViewport
void SetTextScaleModeToViewport()
Definition: vtkTextActor.h:123