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