VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 "vtkRenderingCoreModule.h" // For export macro
45 #include "vtkMapper2D.h"
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 
60 {
61 public:
63  void PrintSelf(ostream& os, vtkIndent indent);
64 
66  static vtkTextMapper *New();
67 
69 
71  virtual void GetSize(vtkViewport*, int size[2]);
72  virtual int GetWidth(vtkViewport*v);
73  virtual int GetHeight(vtkViewport*v);
75 
77 
78  vtkSetStringMacro(Input)
79  vtkGetStringMacro(Input)
81 
83 
84  virtual void SetTextProperty(vtkTextProperty *p);
85  vtkGetObjectMacro(TextProperty,vtkTextProperty);
87 
89  void ShallowCopy(vtkTextMapper *tm);
90 
94  VTK_LEGACY(int GetNumberOfLines(const char *input));
95 
99  VTK_LEGACY(int GetNumberOfLines());
100 
102 
106  virtual int SetConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight);
107  static int SetConstrainedFontSize(vtkTextMapper*, vtkViewport*, int targetWidth, int targetHeight);
109 
111 
115  static int SetMultipleConstrainedFontSize(vtkViewport*,
116  int targetWidth, int targetHeight,
117  vtkTextMapper** mappers,
118  int nbOfMappers,
119  int* maxResultingSize);
121 
123 
126  static int SetRelativeFontSize(vtkTextMapper*, vtkViewport*, int *winSize,
127  int *stringSize, float sizeFactor=0.0);
128  static int SetMultipleRelativeFontSize(vtkViewport *viewport,
129  vtkTextMapper **textMappers,
130  int nbOfMappers, int *winSize,
131  int *stringSize, float sizeFactor);
133 
137  VTK_LEGACY(virtual int GetSystemFontSize(int size));
138 
139  void RenderOverlay(vtkViewport *, vtkActor2D *);
140  void ReleaseGraphicsResources(vtkWindow *);
141  unsigned long GetMTime();
142 
143 protected:
144  vtkTextMapper();
145  ~vtkTextMapper();
146 
147  char* Input;
148  vtkTextProperty *TextProperty;
149 
150 private:
151  vtkTextMapper(const vtkTextMapper&); // Not implemented.
152  void operator=(const vtkTextMapper&); // Not implemented.
153 
154  void UpdateQuad(vtkActor2D *actor);
155  void UpdateImage();
156 
157  int TextDims[2];
158 
159  vtkTimeStamp CoordsTime;
160  vtkTimeStamp TCoordsTime;
161  vtkNew<vtkImageData> Image;
162  vtkNew<vtkPoints> Points;
163  vtkNew<vtkPolyData> PolyData;
164  vtkNew<vtkPolyDataMapper2D> Mapper;
165  vtkNew<vtkTexture> Texture;
166 };
167 
168 
169 #ifndef VTK_LEGACY_REMOVE
171 {
173  return size;
174 }
175 #endif // VTK_LEGACY_REMOVE
176 
177 #endif
178 
GLsizeiptr size
Definition: vtkgl.h:11843
const GLdouble * v
Definition: vtkgl.h:11595
#define VTK_LEGACY_BODY(method, version)
Definition: vtkSetGet.h:812
GLenum GLenum GLenum input
Definition: vtkgl.h:15941
abstract specification for Viewports
Definition: vtkViewport.h:46
virtual int GetSystemFontSize(int size)
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
#define vtkSetStringMacro(name)
Definition: vtkSetGet.h:94
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
2D text annotation
Definition: vtkTextMapper.h:59
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)
#define vtkGetStringMacro(name)
Definition: vtkSetGet.h:120
represent text properties.
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:222
#define VTK_LEGACY(method)
Definition: vtkSetGet.h:787
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:39
GLfloat GLfloat p
Definition: vtkgl.h:15717