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
bool InputRendered
Definition: vtkTextActor.h:319
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
actor that draws 2D data with texture support
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
vtkPolyData * Rectangle
Definition: vtkTextActor.h:326
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
vtkPoints * RectanglePoints
Definition: vtkTextActor.h:327
vtkTextProperty * ScaledTextProperty
Definition: vtkTextActor.h:323
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkImageData * ImageData
Definition: vtkTextActor.h:312
int vtkTypeBool
Definition: vtkABI.h:69
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
An actor that displays text.
Definition: vtkTextActor.h:56
int RenderOpaqueGeometry(vtkViewport *viewport) override
Support the standard render methods.
double FontScaleExponent
Definition: vtkTextActor.h:306
vtkTimeStamp BuildTime
Definition: vtkTextActor.h:314
vtkTransform * Transform
Definition: vtkTextActor.h:315
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
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
Definition: vtkTextActor.h:280
float Orientation
Definition: vtkTextActor.h:308
vtkTextRenderer * TextRenderer
Definition: vtkTextActor.h:313
represent text properties.
void SetTextScaleModeToNone()
Set how text should be scaled.
Definition: vtkTextActor.h:119
float MaximumLineHeight
Definition: vtkTextActor.h:305
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
Interface for generating images and path data from string data, using multiple backends.
vtkTextProperty * TextProperty
Definition: vtkTextActor.h:311
represent surface properties of a 2D image
Definition: vtkProperty2D.h:40
int RenderOverlay(vtkViewport *viewport) override
Support the standard render methods.
static vtkTexturedActor2D * New()
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkTexturedActor2D.
vtkTypeBool UseBorderAlign
Definition: vtkTextActor.h:309
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:39
double FormerOrientation
Definition: vtkTextActor.h:320