VTK  9.2.5
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 =========================================================================*/
141 #ifndef vtkTextMapper_h
142 #define vtkTextMapper_h
143 
144 #include "vtkMapper2D.h"
145 #include "vtkRenderingCoreModule.h" // For export macro
146 
147 #include "vtkNew.h" // For vtkNew
148 
149 class vtkActor2D;
150 class vtkImageData;
151 class vtkPoints;
152 class vtkPolyData;
153 class vtkPolyDataMapper2D;
154 class vtkTextProperty;
155 class vtkTexture;
156 class vtkTimeStamp;
157 class vtkViewport;
158 
159 class VTKRENDERINGCORE_EXPORT vtkTextMapper : public vtkMapper2D
160 {
161 public:
162  vtkTypeMacro(vtkTextMapper, vtkMapper2D);
163  void PrintSelf(ostream& os, vtkIndent indent) override;
164 
168  static vtkTextMapper* New();
169 
171 
175  virtual void GetSize(vtkViewport*, int size[2]);
176  virtual int GetWidth(vtkViewport* v);
177  virtual int GetHeight(vtkViewport* v);
179 
181 
184  vtkSetStringMacro(Input);
185  vtkGetStringMacro(Input);
187 
189 
193  vtkGetObjectMacro(TextProperty, vtkTextProperty);
195 
199  void ShallowCopy(vtkAbstractMapper* m) override;
200 
202 
208  virtual int SetConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight);
210  vtkTextMapper*, vtkViewport*, int targetWidth, int targetHeight);
212 
220  static int SetMultipleConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight,
221  vtkTextMapper** mappers, int nbOfMappers, int* maxResultingSize);
222 
224 
229  vtkTextMapper*, vtkViewport*, const int* winSize, int* stringSize, float sizeFactor = 0.0);
230  static int SetMultipleRelativeFontSize(vtkViewport* viewport, vtkTextMapper** textMappers,
231  int nbOfMappers, int* winSize, int* stringSize, float sizeFactor);
233 
236  vtkMTimeType GetMTime() override;
237 
238 protected:
240  ~vtkTextMapper() override;
241 
242  char* Input;
244 
245 private:
246  vtkTextMapper(const vtkTextMapper&) = delete;
247  void operator=(const vtkTextMapper&) = delete;
248 
249  void UpdateQuad(vtkActor2D* actor, int dpi);
250  void UpdateImage(int dpi);
251 
252  int TextDims[2];
253 
254  int RenderedDPI;
255  vtkTimeStamp CoordsTime;
256  vtkTimeStamp TCoordsTime;
257  vtkNew<vtkImageData> Image;
258  vtkNew<vtkPoints> Points;
259  vtkNew<vtkPolyData> PolyData;
261  vtkNew<vtkTexture> Texture;
262 };
263 
264 #endif
abstract class specifies interface to map data
a actor that draws 2D data
Definition: vtkActor2D.h:155
topologically and geometrically regular array of data
Definition: vtkImageData.h:163
a simple class to control print indentation
Definition: vtkIndent.h:119
abstract class specifies interface for objects which render 2D actors
Definition: vtkMapper2D.h:36
represent and manipulate 3D points
Definition: vtkPoints.h:149
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:200
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 vtkTextMapper * New()
Creates a new text mapper.
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.
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:178
record modification and/or execution time
Definition: vtkTimeStamp.h:55
abstract specification for Viewports
Definition: vtkViewport.h:56
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
@ size
Definition: vtkX3D.h:259
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287