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=========================================================================*/
50#ifndef vtkTextActor_h
51#define vtkTextActor_h
52
53#include "vtkRenderingCoreModule.h" // For export macro
54#include "vtkTexturedActor2D.h"
55
56class vtkImageData;
57class vtkPoints;
58class vtkPolyData;
60class vtkProperty2D;
61class vtkTextProperty;
62class vtkTextRenderer;
63class vtkTransform;
64
65class VTKRENDERINGCORE_EXPORT vtkTextActor : public vtkTexturedActor2D
66{
67public:
69 void PrintSelf(ostream& os, vtkIndent indent) override;
70
75 static vtkTextActor* New();
76
81 void ShallowCopy(vtkProp* prop) override;
82
84
90 void SetInput(const char* inputString);
91 char* GetInput();
93
95
100 vtkSetVector2Macro(MinimumSize, int);
101 vtkGetVector2Macro(MinimumSize, int);
103
105
111 vtkSetMacro(MaximumLineHeight, float);
112 vtkGetMacro(MaximumLineHeight, float);
114
116
125 vtkSetClampMacro(TextScaleMode, int, TEXT_SCALE_MODE_NONE, TEXT_SCALE_MODE_VIEWPORT);
126 vtkGetMacro(TextScaleMode, int);
127 void SetTextScaleModeToNone() { this->SetTextScaleMode(TEXT_SCALE_MODE_NONE); }
128 void SetTextScaleModeToProp() { this->SetTextScaleMode(TEXT_SCALE_MODE_PROP); }
129 void SetTextScaleModeToViewport() { this->SetTextScaleMode(TEXT_SCALE_MODE_VIEWPORT); }
131
132 enum
133 {
134 TEXT_SCALE_MODE_NONE = 0,
136 TEXT_SCALE_MODE_VIEWPORT
137 };
138
140
145 vtkSetMacro(UseBorderAlign, vtkTypeBool);
146 vtkGetMacro(UseBorderAlign, vtkTypeBool);
147 vtkBooleanMacro(UseBorderAlign, vtkTypeBool);
149
151
166 void SetAlignmentPoint(int point);
169
171
178 void SetOrientation(float orientation);
179 vtkGetMacro(Orientation, float);
181
183
187 vtkGetObjectMacro(TextProperty, vtkTextProperty);
189
195 virtual void GetBoundingBox(vtkViewport* vport, double bbox[4]);
196
200 virtual void GetSize(vtkViewport* vport, double size[2]);
201
203
208 virtual int SetConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight);
209 static int SetConstrainedFontSize(vtkTextActor*, vtkViewport*, int targetWidth, int targetHeight);
211
218 static int SetMultipleConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight,
219 vtkTextActor** actors, int nbOfActors, int* maxResultingSize);
220
230 virtual void SetNonLinearFontScale(double exponent, int target);
231
236 void SpecifiedToDisplay(double* pos, vtkViewport* vport, int specified);
237
242 void DisplayToSpecified(double* pos, vtkViewport* vport, int specified);
243
248 virtual void ComputeScaledFont(vtkViewport* viewport);
249
251
255 vtkGetObjectMacro(ScaledTextProperty, vtkTextProperty);
257
265 static float GetFontScale(vtkViewport* viewport);
266
275
277
282 int RenderOpaqueGeometry(vtkViewport* viewport) override;
284 int RenderOverlay(vtkViewport* viewport) override;
286
291
292protected:
296 virtual bool RenderImage(vtkTextProperty* tprop, vtkViewport* viewport);
297
301 virtual bool GetImageBoundingBox(vtkTextProperty* tprop, vtkViewport* viewport, int bbox[4]);
302
304 ~vtkTextActor() override;
305
306 int MinimumSize[2];
312
318 int LastSize[2];
319 int LastOrigin[2];
320 char* Input;
324
326
327 // Stuff needed to display the image text as a texture map.
330
331 virtual void ComputeRectangle(vtkViewport* viewport);
332
346 virtual int UpdateRectangle(vtkViewport* viewport);
347
348private:
349 vtkTextActor(const vtkTextActor&) = delete;
350 void operator=(const vtkTextActor&) = delete;
351};
352
353#endif
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:49
represent and manipulate 3D points
Definition vtkPoints.h:49
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:66
represent surface properties of a 2D image
An actor that displays text.
vtkTextProperty * TextProperty
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
static int SetConstrainedFontSize(vtkTextActor *, 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...
static vtkTextActor * New()
Instantiate object with a rectangle in normaled view coordinates of (0.2,0.85, 0.8,...
int GetAlignmentPoint()
This method is being deprecated.
double FormerOrientation
void SetOrientation(float orientation)
Counterclockwise rotation around the Alignment point.
float MaximumLineHeight
void ShallowCopy(vtkProp *prop) override
Shallow copy of this text actor.
int RenderOverlay(vtkViewport *viewport) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
virtual bool RenderImage(vtkTextProperty *tprop, vtkViewport *viewport)
Render Input to Image using the supplied font property.
vtkTransform * Transform
vtkTextProperty * ScaledTextProperty
int RenderOpaqueGeometry(vtkViewport *viewport) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
char * GetInput()
Set the text string to be displayed.
void SetInput(const char *inputString)
Set the text string to be displayed.
virtual int UpdateRectangle(vtkViewport *viewport)
Ensure that Rectangle and RectanglePoints are valid and up-to-date.
void SetAlignmentPoint(int point)
This method is being deprecated.
virtual bool GetImageBoundingBox(vtkTextProperty *tprop, vtkViewport *viewport, int bbox[4])
Get the bounding box for Input using the supplied font property.
~vtkTextActor() override
vtkImageData * ImageData
vtkTextRenderer * TextRenderer
vtkPolyData * Rectangle
vtkTimeStamp BuildTime
virtual void ComputeRectangle(vtkViewport *viewport)
double FontScaleExponent
void SetTextScaleModeToProp()
Set how text should be scaled.
virtual void SetNonLinearFontScale(double exponent, int target)
Enable non-linear scaling of font sizes.
virtual void GetSize(vtkViewport *vport, double size[2])
Syntactic sugar to get the size of text instead of the entire bounding box.
void SetTextScaleModeToViewport()
Set how text should be scaled.
vtkPoints * RectanglePoints
static float GetFontScale(vtkViewport *viewport)
Provide a font scaling based on a viewport.
virtual void SetTextProperty(vtkTextProperty *p)
Set/Get the text property.
vtkTypeBool UseBorderAlign
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...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetTextScaleModeToNone()
Set how text should be scaled.
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
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...
void SpecifiedToDisplay(double *pos, vtkViewport *vport, int specified)
This is just a simple coordinate conversion method used in the render process.
void DisplayToSpecified(double *pos, vtkViewport *vport, int specified)
This is just a simple coordinate conversion method used in the render process.
virtual void ComputeScaledFont(vtkViewport *viewport)
Compute the scale the font should be given the viewport.
virtual void GetBoundingBox(vtkViewport *vport, double bbox[4])
Return the bounding box coordinates of the text in pixels.
represent text properties.
Interface for generating images and path data from string data, using multiple backends.
actor that draws 2D data with texture support
record modification and/or execution time
describes linear transformations via a 4x4 matrix
abstract specification for Viewports
Definition vtkViewport.h:65
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
int vtkTypeBool
Definition vtkABI.h:69
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)