VTK  9.3.20240425
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
129#ifndef vtkTextMapper_h
130#define vtkTextMapper_h
131
132#include "vtkMapper2D.h"
133#include "vtkRenderingCoreModule.h" // For export macro
134
135#include "vtkNew.h" // For vtkNew
136
137VTK_ABI_NAMESPACE_BEGIN
138class vtkActor2D;
139class vtkImageData;
140class vtkPoints;
141class vtkPolyData;
143class vtkTextProperty;
144class vtkTexture;
145class vtkTimeStamp;
146class vtkViewport;
147
148class VTKRENDERINGCORE_EXPORT vtkTextMapper : public vtkMapper2D
149{
150public:
152 void PrintSelf(ostream& os, vtkIndent indent) override;
153
158
160
164 virtual void GetSize(vtkViewport*, int size[2]);
165 virtual int GetWidth(vtkViewport* v);
166 virtual int GetHeight(vtkViewport* v);
168
170
173 vtkSetStringMacro(Input);
174 vtkGetStringMacro(Input);
176
178
182 vtkGetObjectMacro(TextProperty, vtkTextProperty);
184
189
191
197 virtual int SetConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight);
199 vtkTextMapper*, vtkViewport*, int targetWidth, int targetHeight);
201
209 static int SetMultipleConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight,
210 vtkTextMapper** mappers, int nbOfMappers, int* maxResultingSize);
211
213
218 vtkTextMapper*, vtkViewport*, const int* winSize, int* stringSize, float sizeFactor = 0.0);
219 static int SetMultipleRelativeFontSize(vtkViewport* viewport, vtkTextMapper** textMappers,
220 int nbOfMappers, int* winSize, int* stringSize, float sizeFactor);
222
226
227protected:
229 ~vtkTextMapper() override;
230
231 char* Input;
233
234private:
235 vtkTextMapper(const vtkTextMapper&) = delete;
236 void operator=(const vtkTextMapper&) = delete;
237
238 void UpdateQuad(vtkActor2D* actor, int dpi);
239 void UpdateImage(int dpi);
240
241 int TextDims[2];
242
243 int RenderedDPI;
244 vtkTimeStamp CoordsTime;
245 vtkTimeStamp TCoordsTime;
247 vtkNew<vtkPoints> Points;
248 vtkNew<vtkPolyData> PolyData;
250 vtkNew<vtkTexture> Texture;
251};
252
253VTK_ABI_NAMESPACE_END
254#endif
abstract class specifies interface to map data
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
abstract class specifies interface for objects which render 2D actors
Definition vtkMapper2D.h:26
Allocate and hold a VTK object.
Definition vtkNew.h:160
represent and manipulate 3D points
Definition vtkPoints.h:139
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
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:167
record modification and/or execution time
abstract specification for Viewports
Definition vtkViewport.h:65
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270