VTK  9.1.0
vtkTextMapper.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkTextMapper.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=========================================================================*/
138#ifndef vtkTextMapper_h
139#define vtkTextMapper_h
140
141#include "vtkMapper2D.h"
142#include "vtkRenderingCoreModule.h" // For export macro
143
144#include "vtkNew.h" // For vtkNew
145
146class vtkActor2D;
147class vtkImageData;
148class vtkPoints;
149class vtkPolyData;
151class vtkTextProperty;
152class vtkTexture;
153class vtkTimeStamp;
154class vtkViewport;
155
156class VTKRENDERINGCORE_EXPORT vtkTextMapper : public vtkMapper2D
157{
158public:
160 void PrintSelf(ostream& os, vtkIndent indent) override;
161
166
168
172 virtual void GetSize(vtkViewport*, int size[2]);
173 virtual int GetWidth(vtkViewport* v);
174 virtual int GetHeight(vtkViewport* v);
176
178
181 vtkSetStringMacro(Input);
182 vtkGetStringMacro(Input);
184
186
190 vtkGetObjectMacro(TextProperty, vtkTextProperty);
192
197
199
205 virtual int SetConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight);
207 vtkTextMapper*, vtkViewport*, int targetWidth, int targetHeight);
209
217 static int SetMultipleConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight,
218 vtkTextMapper** mappers, int nbOfMappers, int* maxResultingSize);
219
221
226 vtkTextMapper*, vtkViewport*, const int* winSize, int* stringSize, float sizeFactor = 0.0);
227 static int SetMultipleRelativeFontSize(vtkViewport* viewport, vtkTextMapper** textMappers,
228 int nbOfMappers, int* winSize, int* stringSize, float sizeFactor);
230
234
235protected:
237 ~vtkTextMapper() override;
238
239 char* Input;
241
242private:
243 vtkTextMapper(const vtkTextMapper&) = delete;
244 void operator=(const vtkTextMapper&) = delete;
245
246 void UpdateQuad(vtkActor2D* actor, int dpi);
247 void UpdateImage(int dpi);
248
249 int TextDims[2];
250
251 int RenderedDPI;
252 vtkTimeStamp CoordsTime;
253 vtkTimeStamp TCoordsTime;
255 vtkNew<vtkPoints> Points;
256 vtkNew<vtkPolyData> PolyData;
258 vtkNew<vtkTexture> Texture;
259};
260
261#endif
abstract class specifies interface to map data
a actor that draws 2D data
Definition: vtkActor2D.h:149
topologically and geometrically regular array of data
Definition: vtkImageData.h:157
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract class specifies interface for objects which render 2D actors
Definition: vtkMapper2D.h:36
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
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:175
record modification and/or execution time
Definition: vtkTimeStamp.h:52
abstract specification for Viewports
Definition: vtkViewport.h:47
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
@ size
Definition: vtkX3D.h:259
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287