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 =========================================================================*/
32 #ifndef vtkTextMapper_h
33 #define vtkTextMapper_h
34 
35 #include "vtkMapper2D.h"
36 #include "vtkRenderingCoreModule.h" // For export macro
37 
38 #include "vtkNew.h" // For vtkNew
39 
40 class vtkActor2D;
41 class vtkImageData;
42 class vtkPoints;
43 class vtkPolyData;
45 class vtkTextProperty;
46 class vtkTexture;
47 class vtkTimeStamp;
48 class vtkViewport;
49 
50 class VTKRENDERINGCORE_EXPORT vtkTextMapper : public vtkMapper2D
51 {
52 public:
53  vtkTypeMacro(vtkTextMapper, vtkMapper2D);
54  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
59  static vtkTextMapper* New();
60 
62 
66  virtual void GetSize(vtkViewport*, int size[2]);
67  virtual int GetWidth(vtkViewport* v);
68  virtual int GetHeight(vtkViewport* v);
70 
72 
75  vtkSetStringMacro(Input);
76  vtkGetStringMacro(Input);
78 
80 
83  virtual void SetTextProperty(vtkTextProperty* p);
84  vtkGetObjectMacro(TextProperty, vtkTextProperty);
86 
90  void ShallowCopy(vtkAbstractMapper* m) override;
91 
93 
99  virtual int SetConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight);
100  static int SetConstrainedFontSize(
101  vtkTextMapper*, vtkViewport*, int targetWidth, int targetHeight);
103 
111  static int SetMultipleConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight,
112  vtkTextMapper** mappers, int nbOfMappers, int* maxResultingSize);
113 
115 
119  static int SetRelativeFontSize(
120  vtkTextMapper*, vtkViewport*, const int* winSize, int* stringSize, float sizeFactor = 0.0);
121  static int SetMultipleRelativeFontSize(vtkViewport* viewport, vtkTextMapper** textMappers,
122  int nbOfMappers, int* winSize, int* stringSize, float sizeFactor);
124 
125  void RenderOverlay(vtkViewport*, vtkActor2D*) override;
126  void ReleaseGraphicsResources(vtkWindow*) override;
127  vtkMTimeType GetMTime() override;
128 
129 protected:
130  vtkTextMapper();
131  ~vtkTextMapper() override;
132 
133  char* Input;
135 
136 private:
137  vtkTextMapper(const vtkTextMapper&) = delete;
138  void operator=(const vtkTextMapper&) = delete;
139 
140  void UpdateQuad(vtkActor2D* actor, int dpi);
141  void UpdateImage(int dpi);
142 
143  int TextDims[2];
144 
145  int RenderedDPI;
146  vtkTimeStamp CoordsTime;
147  vtkTimeStamp TCoordsTime;
148  vtkNew<vtkImageData> Image;
149  vtkNew<vtkPoints> Points;
150  vtkNew<vtkPolyData> PolyData;
152  vtkNew<vtkTexture> Texture;
153 };
154 
155 #endif
vtkTextProperty * TextProperty
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
virtual void RenderOverlay(vtkViewport *, vtkActor2D *)
Definition: vtkMapper2D.h:41
abstract specification for Viewports
Definition: vtkViewport.h:55
vtkMTimeType GetMTime() override
Override Modifiedtime as we have added Clipping planes.
a actor that draws 2D data
Definition: vtkActor2D.h:45
record modification and/or execution time
Definition: vtkTimeStamp.h:35
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:90
2D text annotation
Definition: vtkTextMapper.h:50
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
a simple class to control print indentation
Definition: vtkIndent.h:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:53
virtual void ShallowCopy(vtkAbstractMapper *m)
Make a shallow copy of this mapper.
handles properties associated with a texture map
Definition: vtkTexture.h:68
represent text properties.
abstract class specifies interface to map data
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
static vtkAlgorithm * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
abstract class specifies interface for objects which render 2D actors
Definition: vtkMapper2D.h:35
draw vtkPolyData onto the image plane
represent and manipulate 3D points
Definition: vtkPoints.h:39