VTK  9.2.6
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 =========================================================================*/
41 #ifndef vtkTextMapper_h
42 #define vtkTextMapper_h
43 
44 #include "vtkMapper2D.h"
45 #include "vtkRenderingCoreModule.h" // For export macro
46 
47 #include "vtkNew.h" // For vtkNew
48 
49 class vtkActor2D;
50 class vtkImageData;
51 class vtkPoints;
52 class vtkPolyData;
54 class vtkTextProperty;
55 class vtkTexture;
56 class vtkTimeStamp;
57 class vtkViewport;
58 
59 class VTKRENDERINGCORE_EXPORT vtkTextMapper : public vtkMapper2D
60 {
61 public:
62  vtkTypeMacro(vtkTextMapper, vtkMapper2D);
63  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
68  static vtkTextMapper* New();
69 
71 
75  virtual void GetSize(vtkViewport*, int size[2]);
76  virtual int GetWidth(vtkViewport* v);
77  virtual int GetHeight(vtkViewport* v);
79 
81 
84  vtkSetStringMacro(Input);
85  vtkGetStringMacro(Input);
87 
89 
92  virtual void SetTextProperty(vtkTextProperty* p);
93  vtkGetObjectMacro(TextProperty, vtkTextProperty);
95 
99  void ShallowCopy(vtkAbstractMapper* m) override;
100 
102 
108  virtual int SetConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight);
110  vtkTextMapper*, vtkViewport*, int targetWidth, int targetHeight);
112 
120  static int SetMultipleConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight,
121  vtkTextMapper** mappers, int nbOfMappers, int* maxResultingSize);
122 
124 
129  vtkTextMapper*, vtkViewport*, const int* winSize, int* stringSize, float sizeFactor = 0.0);
130  static int SetMultipleRelativeFontSize(vtkViewport* viewport, vtkTextMapper** textMappers,
131  int nbOfMappers, int* winSize, int* stringSize, float sizeFactor);
133 
136  vtkMTimeType GetMTime() override;
137 
138 protected:
140  ~vtkTextMapper() override;
141 
142  char* Input;
144 
145 private:
146  vtkTextMapper(const vtkTextMapper&) = delete;
147  void operator=(const vtkTextMapper&) = delete;
148 
149  void UpdateQuad(vtkActor2D* actor, int dpi);
150  void UpdateImage(int dpi);
151 
152  int TextDims[2];
153 
154  int RenderedDPI;
155  vtkTimeStamp CoordsTime;
156  vtkTimeStamp TCoordsTime;
157  vtkNew<vtkImageData> Image;
158  vtkNew<vtkPoints> Points;
159  vtkNew<vtkPolyData> PolyData;
161  vtkNew<vtkTexture> Texture;
162 };
163 
164 #endif
abstract class specifies interface to map data
a actor that draws 2D data
Definition: vtkActor2D.h:55
topologically and geometrically regular array of data
Definition: vtkImageData.h:63
a simple class to control print indentation
Definition: vtkIndent.h:49
abstract class specifies interface for objects which render 2D actors
Definition: vtkMapper2D.h:36
represent and manipulate 3D points
Definition: vtkPoints.h:49
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:100
2D text annotation
Definition: vtkTextMapper.h:60
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:78
record modification and/or execution time
Definition: vtkTimeStamp.h:45
abstract specification for Viewports
Definition: vtkViewport.h:65
window superclass for vtkRenderWindow
Definition: vtkWindow.h:48
@ size
Definition: vtkX3D.h:259
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287