VTK
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 =========================================================================*/
34 #ifndef vtkTextMapper_h
35 #define vtkTextMapper_h
36 
37 #include "vtkRenderingCoreModule.h" // For export macro
38 #include "vtkMapper2D.h"
39 
40 #include "vtkNew.h" // For vtkNew
41 
42 class vtkActor2D;
43 class vtkImageData;
44 class vtkPoints;
45 class vtkPolyData;
47 class vtkTextProperty;
48 class vtkTexture;
49 class vtkTimeStamp;
50 class vtkViewport;
51 
53 {
54 public:
55  vtkTypeMacro(vtkTextMapper,vtkMapper2D);
56  void PrintSelf(ostream& os, vtkIndent indent);
57 
59  static vtkTextMapper *New();
60 
62 
64  virtual void GetSize(vtkViewport*, int size[2]);
65  virtual int GetWidth(vtkViewport*v);
66  virtual int GetHeight(vtkViewport*v);
68 
70 
71  vtkSetStringMacro(Input)
72  vtkGetStringMacro(Input)
74 
76 
77  virtual void SetTextProperty(vtkTextProperty *p);
78  vtkGetObjectMacro(TextProperty,vtkTextProperty);
80 
82  void ShallowCopy(vtkTextMapper *tm);
83 
85 
89  virtual int SetConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight);
90  static int SetConstrainedFontSize(vtkTextMapper*, vtkViewport*, int targetWidth, int targetHeight);
92 
94 
98  static int SetMultipleConstrainedFontSize(vtkViewport*,
99  int targetWidth, int targetHeight,
100  vtkTextMapper** mappers,
101  int nbOfMappers,
102  int* maxResultingSize);
104 
106 
109  static int SetRelativeFontSize(vtkTextMapper*, vtkViewport*, int *winSize,
110  int *stringSize, float sizeFactor=0.0);
111  static int SetMultipleRelativeFontSize(vtkViewport *viewport,
112  vtkTextMapper **textMappers,
113  int nbOfMappers, int *winSize,
114  int *stringSize, float sizeFactor);
116 
117  void RenderOverlay(vtkViewport *, vtkActor2D *);
118  void ReleaseGraphicsResources(vtkWindow *);
119  unsigned long GetMTime();
120 
121 protected:
122  vtkTextMapper();
123  ~vtkTextMapper();
124 
125  char* Input;
126  vtkTextProperty *TextProperty;
127 
128 private:
129  vtkTextMapper(const vtkTextMapper&); // Not implemented.
130  void operator=(const vtkTextMapper&); // Not implemented.
131 
132  void UpdateQuad(vtkActor2D *actor, int dpi);
133  void UpdateImage(int dpi);
134 
135  int TextDims[2];
136 
137  int RenderedDPI;
138  vtkTimeStamp CoordsTime;
139  vtkTimeStamp TCoordsTime;
140  vtkNew<vtkImageData> Image;
141  vtkNew<vtkPoints> Points;
142  vtkNew<vtkPolyData> PolyData;
143  vtkNew<vtkPolyDataMapper2D> Mapper;
144  vtkNew<vtkTexture> Texture;
145 };
146 
147 #endif
abstract specification for Viewports
Definition: vtkViewport.h:46
a actor that draws 2D data
Definition: vtkActor2D.h:44
record modification and/or execution time
Definition: vtkTimeStamp.h:34
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:83
2D text annotation
Definition: vtkTextMapper.h:52
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
a simple class to control print indentation
Definition: vtkIndent.h:38
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
handles properties associated with a texture map
Definition: vtkTexture.h:69
void PrintSelf(ostream &os, vtkIndent indent)
represent text properties.
Allocate and hold a VTK object.
Definition: vtkNew.h:66
#define VTKRENDERINGCORE_EXPORT
static vtkAlgorithm * New()
abstract class specifies interface for objects which render 2D actors
Definition: vtkMapper2D.h:34
draw vtkPolyData onto the image plane
represent and manipulate 3D points
Definition: vtkPoints.h:38