VTK  9.1.0
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=========================================================================*/
144#ifndef vtkTextActor_h
145#define vtkTextActor_h
146
147#include "vtkRenderingCoreModule.h" // For export macro
148#include "vtkTexturedActor2D.h"
149
150class vtkImageData;
151class vtkPoints;
152class vtkPolyData;
154class vtkProperty2D;
155class vtkTextProperty;
156class vtkTextRenderer;
157class vtkTransform;
158
159class VTKRENDERINGCORE_EXPORT vtkTextActor : public vtkTexturedActor2D
160{
161public:
163 void PrintSelf(ostream& os, vtkIndent indent) override;
164
169 static vtkTextActor* New();
170
175 void ShallowCopy(vtkProp* prop) override;
176
178
184 void SetInput(const char* inputString);
185 char* GetInput();
187
189
194 vtkSetVector2Macro(MinimumSize, int);
195 vtkGetVector2Macro(MinimumSize, int);
197
199
205 vtkSetMacro(MaximumLineHeight, float);
206 vtkGetMacro(MaximumLineHeight, float);
208
210
219 vtkSetClampMacro(TextScaleMode, int, TEXT_SCALE_MODE_NONE, TEXT_SCALE_MODE_VIEWPORT);
220 vtkGetMacro(TextScaleMode, int);
221 void SetTextScaleModeToNone() { this->SetTextScaleMode(TEXT_SCALE_MODE_NONE); }
222 void SetTextScaleModeToProp() { this->SetTextScaleMode(TEXT_SCALE_MODE_PROP); }
223 void SetTextScaleModeToViewport() { this->SetTextScaleMode(TEXT_SCALE_MODE_VIEWPORT); }
225
226 enum
227 {
228 TEXT_SCALE_MODE_NONE = 0,
230 TEXT_SCALE_MODE_VIEWPORT
231 };
232
234
239 vtkSetMacro(UseBorderAlign, vtkTypeBool);
240 vtkGetMacro(UseBorderAlign, vtkTypeBool);
241 vtkBooleanMacro(UseBorderAlign, vtkTypeBool);
243
245
263
265
273 vtkGetMacro(Orientation, float);
275
277
281 vtkGetObjectMacro(TextProperty, vtkTextProperty);
283
289 virtual void GetBoundingBox(vtkViewport* vport, double bbox[4]);
290
294 virtual void GetSize(vtkViewport* vport, double size[2]);
295
297
302 virtual int SetConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight);
303 static int SetConstrainedFontSize(vtkTextActor*, vtkViewport*, int targetWidth, int targetHeight);
305
312 static int SetMultipleConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight,
313 vtkTextActor** actors, int nbOfActors, int* maxResultingSize);
314
324 virtual void SetNonLinearFontScale(double exponent, int target);
325
330 void SpecifiedToDisplay(double* pos, vtkViewport* vport, int specified);
331
336 void DisplayToSpecified(double* pos, vtkViewport* vport, int specified);
337
342 virtual void ComputeScaledFont(vtkViewport* viewport);
343
345
349 vtkGetObjectMacro(ScaledTextProperty, vtkTextProperty);
351
359 static float GetFontScale(vtkViewport* viewport);
360
369
371
376 int RenderOpaqueGeometry(vtkViewport* viewport) override;
378 int RenderOverlay(vtkViewport* viewport) override;
380
385
386protected:
390 virtual bool RenderImage(vtkTextProperty* tprop, vtkViewport* viewport);
391
395 virtual bool GetImageBoundingBox(vtkTextProperty* tprop, vtkViewport* viewport, int bbox[4]);
396
398 ~vtkTextActor() override;
399
400 int MinimumSize[2];
406
412 int LastSize[2];
413 int LastOrigin[2];
414 char* Input;
418
420
421 // Stuff needed to display the image text as a texture map.
424
425 virtual void ComputeRectangle(vtkViewport* viewport);
426
440 virtual int UpdateRectangle(vtkViewport* viewport);
441
442private:
443 vtkTextActor(const vtkTextActor&) = delete;
444 void operator=(const vtkTextActor&) = delete;
445};
446
447#endif
topologically and geometrically regular array of data
Definition: vtkImageData.h:157
a simple class to control print indentation
Definition: vtkIndent.h:113
represent and manipulate 3D points
Definition: vtkPoints.h:143
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:67
represent surface properties of a 2D image
An actor that displays text.
Definition: vtkTextActor.h:160
vtkTextProperty * TextProperty
Definition: vtkTextActor.h:407
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
Definition: vtkTextActor.h:416
void SetOrientation(float orientation)
Counterclockwise rotation around the Alignment point.
float MaximumLineHeight
Definition: vtkTextActor.h:401
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
Definition: vtkTextActor.h:411
vtkTextProperty * ScaledTextProperty
Definition: vtkTextActor.h:419
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
Definition: vtkTextActor.h:408
vtkTextRenderer * TextRenderer
Definition: vtkTextActor.h:409
vtkPolyData * Rectangle
Definition: vtkTextActor.h:422
vtkTimeStamp BuildTime
Definition: vtkTextActor.h:410
virtual void ComputeRectangle(vtkViewport *viewport)
double FontScaleExponent
Definition: vtkTextActor.h:402
bool InputRendered
Definition: vtkTextActor.h:415
void SetTextScaleModeToProp()
Set how text should be scaled.
Definition: vtkTextActor.h:222
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.
Definition: vtkTextActor.h:223
vtkPoints * RectanglePoints
Definition: vtkTextActor.h:423
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
Definition: vtkTextActor.h:405
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.
float Orientation
Definition: vtkTextActor.h:404
void SetTextScaleModeToNone()
Set how text should be scaled.
Definition: vtkTextActor.h:221
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
Definition: vtkTextActor.h:377
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
Definition: vtkTimeStamp.h:52
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:164
abstract specification for Viewports
Definition: vtkViewport.h:47
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
@ point
Definition: vtkX3D.h:242
@ orientation
Definition: vtkX3D.h:268
@ size
Definition: vtkX3D.h:259
int vtkTypeBool
Definition: vtkABI.h:69
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)