VTK  9.3.0
vtkTextMapper.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
20#ifndef vtkTextMapper_h
21#define vtkTextMapper_h
22
23#include "vtkMapper2D.h"
24#include "vtkRenderingCoreModule.h" // For export macro
25
26#include "vtkNew.h" // For vtkNew
27
28VTK_ABI_NAMESPACE_BEGIN
29class vtkActor2D;
30class vtkImageData;
31class vtkPoints;
32class vtkPolyData;
34class vtkTextProperty;
35class vtkTexture;
36class vtkTimeStamp;
37class vtkViewport;
38
39class VTKRENDERINGCORE_EXPORT vtkTextMapper : public vtkMapper2D
40{
41public:
42 vtkTypeMacro(vtkTextMapper, vtkMapper2D);
43 void PrintSelf(ostream& os, vtkIndent indent) override;
44
48 static vtkTextMapper* New();
49
51
55 virtual void GetSize(vtkViewport*, int size[2]);
56 virtual int GetWidth(vtkViewport* v);
57 virtual int GetHeight(vtkViewport* v);
59
61
64 vtkSetStringMacro(Input);
65 vtkGetStringMacro(Input);
67
69
73 vtkGetObjectMacro(TextProperty, vtkTextProperty);
75
79 void ShallowCopy(vtkAbstractMapper* m) override;
80
82
88 virtual int SetConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight);
90 vtkTextMapper*, vtkViewport*, int targetWidth, int targetHeight);
92
100 static int SetMultipleConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight,
101 vtkTextMapper** mappers, int nbOfMappers, int* maxResultingSize);
102
104
109 vtkTextMapper*, vtkViewport*, const int* winSize, int* stringSize, float sizeFactor = 0.0);
110 static int SetMultipleRelativeFontSize(vtkViewport* viewport, vtkTextMapper** textMappers,
111 int nbOfMappers, int* winSize, int* stringSize, float sizeFactor);
113
117
118protected:
120 ~vtkTextMapper() override;
121
122 char* Input;
124
125private:
126 vtkTextMapper(const vtkTextMapper&) = delete;
127 void operator=(const vtkTextMapper&) = delete;
128
129 void UpdateQuad(vtkActor2D* actor, int dpi);
130 void UpdateImage(int dpi);
131
132 int TextDims[2];
133
134 int RenderedDPI;
135 vtkTimeStamp CoordsTime;
136 vtkTimeStamp TCoordsTime;
138 vtkNew<vtkPoints> Points;
139 vtkNew<vtkPolyData> PolyData;
141 vtkNew<vtkTexture> Texture;
142};
143
144VTK_ABI_NAMESPACE_END
145#endif
abstract class specifies interface to map data
a actor that draws 2D data
Definition vtkActor2D.h:35
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:29
abstract class specifies interface for objects which render 2D actors
Definition vtkMapper2D.h:25
Allocate and hold a VTK object.
Definition vtkNew.h:51
represent and manipulate 3D points
Definition vtkPoints.h:29
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:80
2D text annotation
static int SetMultipleConstrainedFontSize(vtkViewport *, int targetWidth, int targetHeight, vtkTextMapper **mappers, int nbOfMappers, int *maxResultingSize)
Set and return the font size (in points) required to make each element of an array of mappers fit in ...
static int SetRelativeFontSize(vtkTextMapper *, vtkViewport *, const int *winSize, int *stringSize, float sizeFactor=0.0)
Use these methods when setting font size relative to the renderer's size.
void RenderOverlay(vtkViewport *, vtkActor2D *) override
virtual int GetHeight(vtkViewport *v)
Return the size[2]/width/height of the rectangle required to draw this mapper (in pixels).
vtkMTimeType GetMTime() override
Override Modifiedtime as we have added Clipping planes.
static int SetMultipleRelativeFontSize(vtkViewport *viewport, vtkTextMapper **textMappers, int nbOfMappers, int *winSize, int *stringSize, float sizeFactor)
Use these methods when setting font size relative to the renderer's size.
virtual void SetTextProperty(vtkTextProperty *p)
Set/Get the text property.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void GetSize(vtkViewport *, int size[2])
Return the size[2]/width/height of the rectangle required to draw this mapper (in pixels).
virtual int SetConstrainedFontSize(vtkViewport *, int targetWidth, int targetHeight)
Set and return the font size (in points) required to make this mapper fit in a given target rectangle...
static int SetConstrainedFontSize(vtkTextMapper *, vtkViewport *, int targetWidth, int targetHeight)
Set and return the font size (in points) required to make this mapper fit in a given target rectangle...
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this mapper.
static vtkTextMapper * New()
Creates a new text mapper.
void ShallowCopy(vtkAbstractMapper *m) override
Shallow copy of an actor.
virtual int GetWidth(vtkViewport *v)
Return the size[2]/width/height of the rectangle required to draw this mapper (in pixels).
vtkTextProperty * TextProperty
~vtkTextMapper() override
represent text properties.
handles properties associated with a texture map
Definition vtkTexture.h:58
record modification and/or execution time
abstract specification for Viewports
Definition vtkViewport.h:45
window superclass for vtkRenderWindow
Definition vtkWindow.h:25
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270