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 "vtkMapper2D.h"
38 
39 class vtkActor2D;
40 class vtkTextProperty;
41 class vtkViewport;
42 
44 {
45 public:
46  vtkTypeMacro(vtkTextMapper,vtkMapper2D);
47  void PrintSelf(ostream& os, vtkIndent indent);
48 
50  static vtkTextMapper *New();
51 
53 
55  virtual void GetSize(vtkViewport*, int size[2]) {size[0]=size[0];}
56  virtual int GetWidth(vtkViewport*v);
57  virtual int GetHeight(vtkViewport*v);
59 
61 
63  virtual void SetInput(const char *inputString);
64  vtkGetStringMacro(Input);
66 
68 
69  virtual void SetTextProperty(vtkTextProperty *p);
70  vtkGetObjectMacro(TextProperty,vtkTextProperty);
72 
74  void ShallowCopy(vtkTextMapper *tm);
75 
78  int GetNumberOfLines(const char *input);
79 
81 
84  vtkGetMacro(NumberOfLines,int);
86 
88 
92  virtual int SetConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight);
93  static int SetConstrainedFontSize(vtkTextMapper*, vtkViewport*, int targetWidth, int targetHeight);
95 
97 
101  static int SetMultipleConstrainedFontSize(vtkViewport*,
102  int targetWidth, int targetHeight,
103  vtkTextMapper** mappers,
104  int nbOfMappers,
105  int* maxResultingSize);
107 
109 
112  static int SetRelativeFontSize(vtkTextMapper*, vtkViewport*, int *winSize,
113  int *stringSize, float sizeFactor=0.0);
114  static int SetMultipleRelativeFontSize(vtkViewport *viewport,
115  vtkTextMapper **textMappers,
116  int nbOfMappers, int *winSize,
117  int *stringSize, float sizeFactor);
119 
121 
122  virtual int GetSystemFontSize(int size)
123  { return size; }
125 
126 protected:
127  vtkTextMapper();
128  ~vtkTextMapper();
129 
130  char* Input;
132 
133  int LineSize;
136 
138 
139  // These functions are used to parse, process, and render multiple lines
140  char *NextLine(const char *input, int lineNum);
141  void GetMultiLineSize(vtkViewport* viewport, int size[2]);
142  void RenderOverlayMultipleLines(vtkViewport *viewport, vtkActor2D *actor);
143 
144 private:
145  vtkTextMapper(const vtkTextMapper&); // Not implemented.
146  void operator=(const vtkTextMapper&); // Not implemented.
147 };
148 
149 #endif
150 
virtual void GetSize(vtkViewport *, int size[2])
Definition: vtkTextMapper.h:55
vtkTextProperty * TextProperty
abstract specification for Viewports
Definition: vtkViewport.h:45
a actor that draws 2D data
Definition: vtkActor2D.h:43
2D text annotation
Definition: vtkTextMapper.h:43
vtkTextMapper ** TextLines
a simple class to control print indentation
Definition: vtkIndent.h:37
void PrintSelf(ostream &os, vtkIndent indent)
represent text properties.
#define VTK_RENDERING_EXPORT
int NumberOfLinesAllocated
void ShallowCopy(vtkAbstractMapper *m)
static vtkAlgorithm * New()
abstract class specifies interface for objects which render 2D actors
Definition: vtkMapper2D.h:33
virtual int GetSystemFontSize(int size)