VTK  9.2.6
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, TEXT_SCALE_MODE_NONE, TEXT_SCALE_MODE_VIEWPORT);
117  vtkGetMacro(TextScaleMode, int);
118  void SetTextScaleModeToNone() { this->SetTextScaleMode(TEXT_SCALE_MODE_NONE); }
119  void SetTextScaleModeToProp() { this->SetTextScaleMode(TEXT_SCALE_MODE_PROP); }
120  void SetTextScaleModeToViewport() { this->SetTextScaleMode(TEXT_SCALE_MODE_VIEWPORT); }
122 
123  enum
124  {
125  TEXT_SCALE_MODE_NONE = 0,
127  TEXT_SCALE_MODE_VIEWPORT
128  };
129 
131 
136  vtkSetMacro(UseBorderAlign, vtkTypeBool);
137  vtkGetMacro(UseBorderAlign, vtkTypeBool);
138  vtkBooleanMacro(UseBorderAlign, vtkTypeBool);
140 
142 
157  void SetAlignmentPoint(int point);
158  int GetAlignmentPoint();
160 
162 
169  void SetOrientation(float orientation);
170  vtkGetMacro(Orientation, float);
172 
174 
177  virtual void SetTextProperty(vtkTextProperty* p);
178  vtkGetObjectMacro(TextProperty, vtkTextProperty);
180 
186  virtual void GetBoundingBox(vtkViewport* vport, double bbox[4]);
187 
191  virtual void GetSize(vtkViewport* vport, double size[2]);
192 
194 
199  virtual int SetConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight);
200  static int SetConstrainedFontSize(vtkTextActor*, vtkViewport*, int targetWidth, int targetHeight);
202 
209  static int SetMultipleConstrainedFontSize(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*) override;
266 
268 
273  int RenderOpaqueGeometry(vtkViewport* viewport) override;
274  int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
275  int RenderOverlay(vtkViewport* viewport) override;
277 
282 
283 protected:
287  virtual bool RenderImage(vtkTextProperty* tprop, vtkViewport* viewport);
288 
292  virtual bool GetImageBoundingBox(vtkTextProperty* tprop, vtkViewport* viewport, int bbox[4]);
293 
294  vtkTextActor();
295  ~vtkTextActor() override;
296 
297  int MinimumSize[2];
301  float Orientation;
303 
309  int LastSize[2];
310  int LastOrigin[2];
311  char* Input;
315 
317 
318  // Stuff needed to display the image text as a texture map.
321 
322  virtual void ComputeRectangle(vtkViewport* viewport);
323 
337  virtual int UpdateRectangle(vtkViewport* viewport);
338 
339 private:
340  vtkTextActor(const vtkTextActor&) = delete;
341  void operator=(const vtkTextActor&) = delete;
342 };
343 
344 #endif
bool InputRendered
Definition: vtkTextActor.h:312
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:56
actor that draws 2D data with texture support
vtkPolyData * Rectangle
Definition: vtkTextActor.h:319
void SetTextScaleModeToViewport()
Set how text should be scaled.
Definition: vtkTextActor.h:120
abstract specification for Viewports
Definition: vtkViewport.h:55
record modification and/or execution time
Definition: vtkTimeStamp.h:35
vtkPoints * RectanglePoints
Definition: vtkTextActor.h:320
vtkTextProperty * ScaledTextProperty
Definition: vtkTextActor.h:316
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:90
vtkImageData * ImageData
Definition: vtkTextActor.h:305
int vtkTypeBool
Definition: vtkABI.h:69
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
An actor that displays text.
Definition: vtkTextActor.h:56
int RenderOpaqueGeometry(vtkViewport *viewport) override
Support the standard render methods.
double FontScaleExponent
Definition: vtkTextActor.h:299
vtkTimeStamp BuildTime
Definition: vtkTextActor.h:307
vtkTransform * Transform
Definition: vtkTextActor.h:308
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:119
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
topologically and geometrically regular array of data
Definition: vtkImageData.h:53
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
float Orientation
Definition: vtkTextActor.h:301
vtkTextRenderer * TextRenderer
Definition: vtkTextActor.h:306
represent text properties.
void SetTextScaleModeToNone()
Set how text should be scaled.
Definition: vtkTextActor.h:118
float MaximumLineHeight
Definition: vtkTextActor.h:298
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:304
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:302
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:313