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 =========================================================================*/
29 #ifndef vtkTextMapper_h
30 #define vtkTextMapper_h
31 
32 #include "vtkRenderingCoreModule.h" // For export macro
33 #include "vtkMapper2D.h"
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) VTK_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(vtkTextMapper *tm);
88 
90 
96  virtual int SetConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight);
97  static int SetConstrainedFontSize(vtkTextMapper*, vtkViewport*, int targetWidth, int targetHeight);
99 
107  static int SetMultipleConstrainedFontSize(vtkViewport*,
108  int targetWidth, int targetHeight,
109  vtkTextMapper** mappers,
110  int nbOfMappers,
111  int* maxResultingSize);
112 
114 
118  static int SetRelativeFontSize(vtkTextMapper*, vtkViewport*, int *winSize,
119  int *stringSize, float sizeFactor=0.0);
120  static int SetMultipleRelativeFontSize(vtkViewport *viewport,
121  vtkTextMapper **textMappers,
122  int nbOfMappers, int *winSize,
123  int *stringSize, float sizeFactor);
125 
126  void RenderOverlay(vtkViewport *, vtkActor2D *) VTK_OVERRIDE;
127  void ReleaseGraphicsResources(vtkWindow *) VTK_OVERRIDE;
128  vtkMTimeType GetMTime() VTK_OVERRIDE;
129 
130 protected:
131  vtkTextMapper();
132  ~vtkTextMapper() VTK_OVERRIDE;
133 
134  char* Input;
135  vtkTextProperty *TextProperty;
136 
137 private:
138  vtkTextMapper(const vtkTextMapper&) VTK_DELETE_FUNCTION;
139  void operator=(const vtkTextMapper&) VTK_DELETE_FUNCTION;
140 
141  void UpdateQuad(vtkActor2D *actor, int dpi);
142  void UpdateImage(int dpi);
143 
144  int TextDims[2];
145 
146  int RenderedDPI;
147  vtkTimeStamp CoordsTime;
148  vtkTimeStamp TCoordsTime;
149  vtkNew<vtkImageData> Image;
150  vtkNew<vtkPoints> Points;
151  vtkNew<vtkPolyData> PolyData;
152  vtkNew<vtkPolyDataMapper2D> Mapper;
153  vtkNew<vtkTexture> Texture;
154 };
155 
156 #endif
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:300
virtual void RenderOverlay(vtkViewport *, vtkActor2D *)
Definition: vtkMapper2D.h:41
abstract specification for Viewports
Definition: vtkViewport.h:44
vtkMTimeType GetMTime() override
Override Modifiedtime as we have added Clipping planes.
a actor that draws 2D data
Definition: vtkActor2D.h:39
record modification and/or execution time
Definition: vtkTimeStamp.h:32
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
2D text annotation
Definition: vtkTextMapper.h:47
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
a simple class to control print indentation
Definition: vtkIndent.h:33
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
handles properties associated with a texture map
Definition: vtkTexture.h:64
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
represent text properties.
Allocate and hold a VTK object.
Definition: vtkNew.h:61
virtual void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this mapper.
void ShallowCopy(vtkAbstractMapper *m)
Make a shallow copy of 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:33