VTK  9.7.20260918
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
128
129#ifndef vtkTextMapper_h
130#define vtkTextMapper_h
131
132#include "vtkMapper2D.h"
133#include "vtkRenderingCoreModule.h" // For export macro
134#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
135
136#include "vtkNew.h" // For vtkNew
137
138VTK_ABI_NAMESPACE_BEGIN
139class vtkActor2D;
140class vtkImageData;
141class vtkPoints;
142class vtkPolyData;
144class vtkTextProperty;
145class vtkTexture;
146class vtkTimeStamp;
147class vtkViewport;
148
149class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkTextMapper : public vtkMapper2D
150{
151public:
153 void PrintSelf(ostream& os, vtkIndent indent) override;
154
159
161
165 virtual void GetSize(vtkViewport*, int size[2]);
166 virtual int GetWidth(vtkViewport* v);
167 virtual int GetHeight(vtkViewport* v);
169
171
174 vtkSetStringMacro(Input);
175 vtkGetStringMacro(Input);
177
179
183 vtkGetObjectMacro(TextProperty, vtkTextProperty);
185
190
192
198 virtual int SetConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight);
200 vtkTextMapper*, vtkViewport*, int targetWidth, int targetHeight);
202
210 static int SetMultipleConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight,
211 vtkTextMapper** mappers, int nbOfMappers, int* maxResultingSize);
212
214
219 vtkTextMapper*, vtkViewport*, const int* winSize, int* stringSize, float sizeFactor = 0.0);
220 static int SetMultipleRelativeFontSize(vtkViewport* viewport, vtkTextMapper** textMappers,
221 int nbOfMappers, int* winSize, int* stringSize, float sizeFactor);
223
227
228protected:
230 ~vtkTextMapper() override;
231
232 char* Input;
234
235private:
236 vtkTextMapper(const vtkTextMapper&) = delete;
237 void operator=(const vtkTextMapper&) = delete;
238
239 void UpdateQuad(vtkActor2D* actor, int dpi);
240 void UpdateImage(int dpi);
241
242 int TextDims[2];
243
244 int RenderedDPI;
245 vtkTimeStamp CoordsTime;
246 vtkTimeStamp TCoordsTime;
248 vtkNew<vtkPoints> Points;
249 vtkNew<vtkPolyData> PolyData;
251 vtkNew<vtkTexture> Texture;
252};
253
254VTK_ABI_NAMESPACE_END
255#endif
a actor that draws 2D data
Definition vtkActor2D.h:145
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:108
vtkMapper2D()=default
Allocate and hold a VTK object.
Definition vtkNew.h:168
represent and manipulate 3D points
Definition vtkPoints.h:140
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
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:168
record modification and/or execution time
abstract specification for Viewports
Definition vtkViewport.h:66
window superclass for vtkRenderWindow
Definition vtkWindow.h:62
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:318
#define VTK_MARSHALAUTO