VTK
vtkTextProperty.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkTextProperty.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 =========================================================================*/
32 #ifndef __vtkTextProperty_h
33 #define __vtkTextProperty_h
34 
35 #include "vtkRenderingCoreModule.h" // For export macro
36 #include "vtkObject.h"
37 
39 {
40 public:
42  void PrintSelf(ostream& os, vtkIndent indent);
43 
46  static vtkTextProperty *New();
47 
49 
50  vtkSetVector3Macro(Color,double);
51  vtkGetVector3Macro(Color,double);
53 
55 
57  vtkSetMacro(Opacity,double);
58  vtkGetMacro(Opacity,double);
60 
62 
66  vtkGetStringMacro(FontFamilyAsString);
67  vtkSetStringMacro(FontFamilyAsString);
68  void SetFontFamily(int t);
69  int GetFontFamily();
70  int GetFontFamilyMinValue() { return VTK_ARIAL; };
71  void SetFontFamilyToArial();
72  void SetFontFamilyToCourier();
73  void SetFontFamilyToTimes();
74  static int GetFontFamilyFromString( const char *f );
75  static const char *GetFontFamilyAsString( int f );
77 
79 
82  vtkGetStringMacro(FontFile)
83  vtkSetStringMacro(FontFile)
85 
87 
88  vtkSetClampMacro(FontSize,int,0,VTK_INT_MAX);
89  vtkGetMacro(FontSize, int);
91 
93 
94  vtkSetMacro(Bold, int);
95  vtkGetMacro(Bold, int);
96  vtkBooleanMacro(Bold, int);
98 
100 
101  vtkSetMacro(Italic, int);
102  vtkGetMacro(Italic, int);
103  vtkBooleanMacro(Italic, int);
105 
107 
108  vtkSetMacro(Shadow, int);
109  vtkGetMacro(Shadow, int);
110  vtkBooleanMacro(Shadow, int);
112 
114 
116  vtkSetVector2Macro(ShadowOffset,int);
117  vtkGetVectorMacro(ShadowOffset,int,2);
119 
121  void GetShadowColor(double color[3]);
122 
124 
126  vtkSetClampMacro(Justification,int,VTK_TEXT_LEFT,VTK_TEXT_RIGHT);
127  vtkGetMacro(Justification,int);
128  void SetJustificationToLeft()
129  { this->SetJustification(VTK_TEXT_LEFT);};
131  { this->SetJustification(VTK_TEXT_CENTERED);};
133  { this->SetJustification(VTK_TEXT_RIGHT);};
134  const char *GetJustificationAsString();
136 
138 
140  vtkSetClampMacro(VerticalJustification,int,VTK_TEXT_BOTTOM,VTK_TEXT_TOP);
141  vtkGetMacro(VerticalJustification,int);
143  {this->SetVerticalJustification(VTK_TEXT_BOTTOM);};
145  {this->SetVerticalJustification(VTK_TEXT_CENTERED);};
147  {this->SetVerticalJustification(VTK_TEXT_TOP);};
148  const char *GetVerticalJustificationAsString();
150 
152 
153  vtkSetMacro(Orientation,double);
154  vtkGetMacro(Orientation,double);
156 
158 
160  vtkSetMacro(LineSpacing, double);
161  vtkGetMacro(LineSpacing, double);
163 
165 
166  vtkSetMacro(LineOffset, double);
167  vtkGetMacro(LineOffset, double);
169 
171  void ShallowCopy(vtkTextProperty *tprop);
172 
173 protected:
174  vtkTextProperty();
175  ~vtkTextProperty();
176 
177  double Color[3];
178  double Opacity;
180  char* FontFile;
181  int FontSize;
182  int Bold;
183  int Italic;
184  int Shadow;
185  int ShadowOffset[2];
188  double Orientation;
189  double LineOffset;
190  double LineSpacing;
191 
192 private:
193  vtkTextProperty(const vtkTextProperty&); // Not implemented.
194  void operator=(const vtkTextProperty&); // Not implemented.
195 };
196 
197 inline const char *vtkTextProperty::GetFontFamilyAsString( int f )
198 {
199  if ( f == VTK_ARIAL )
200  {
201  return "Arial";
202  }
203  else if ( f == VTK_COURIER )
204  {
205  return "Courier";
206  }
207  else if ( f == VTK_TIMES )
208  {
209  return "Times";
210  }
211  else if ( f == VTK_FONT_FILE )
212  {
213  return "File";
214  }
215  return "Unknown";
216 }
217 
219 {
220  this->SetFontFamilyAsString( this->GetFontFamilyAsString( t ) );
221 }
222 
224 {
225  this->SetFontFamily(VTK_ARIAL);
226 }
227 
229 {
230  this->SetFontFamily(VTK_COURIER);
231 }
232 
234 {
235  this->SetFontFamily(VTK_TIMES);
236 }
237 
239 {
240  if ( strcmp( f, GetFontFamilyAsString( VTK_ARIAL ) ) == 0 )
241  {
242  return VTK_ARIAL;
243  }
244  else if ( strcmp( f, GetFontFamilyAsString( VTK_COURIER ) ) == 0 )
245  {
246  return VTK_COURIER;
247  }
248  else if ( strcmp( f, GetFontFamilyAsString( VTK_TIMES ) ) == 0 )
249  {
250  return VTK_TIMES;
251  }
252  else if ( strcmp( f, GetFontFamilyAsString( VTK_FONT_FILE) ) == 0 )
253  {
254  return VTK_FONT_FILE;
255  }
256  return VTK_UNKNOWN_FONT;
257 }
258 
260 {
262 }
263 
265 {
266  if (this->Justification == VTK_TEXT_LEFT)
267  {
268  return "Left";
269  }
270  else if (this->Justification == VTK_TEXT_CENTERED)
271  {
272  return "Centered";
273  }
274  else if (this->Justification == VTK_TEXT_RIGHT)
275  {
276  return "Right";
277  }
278  return "Unknown";
279 }
280 
282 {
284  {
285  return "Bottom";
286  }
287  else if (this->VerticalJustification == VTK_TEXT_CENTERED)
288  {
289  return "Centered";
290  }
291  else if (this->VerticalJustification == VTK_TEXT_TOP)
292  {
293  return "Top";
294  }
295  return "Unknown";
296 }
297 
298 #endif
void SetFontFamilyToArial()
GLclampf f
Definition: vtkgl.h:14181
#define VTK_UNKNOWN_FONT
void SetJustificationToRight()
abstract base class for most VTK objects
Definition: vtkObject.h:61
void SetVerticalJustificationToTop()
#define VTK_INT_MAX
Definition: vtkType.h:131
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
#define VTK_ARIAL
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:133
GLdouble GLdouble t
Definition: vtkgl.h:11602
#define VTK_TEXT_TOP
#define vtkSetStringMacro(name)
Definition: vtkSetGet.h:94
void SetVerticalJustificationToBottom()
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
void SetVerticalJustificationToCentered()
#define VTK_TEXT_CENTERED
virtual void SetFontFamilyAsString(const char *)
#define VTK_TEXT_RIGHT
#define VTK_TEXT_LEFT
#define VTK_COURIER
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:38
#define VTK_TEXT_BOTTOM
#define VTK_TIMES
#define vtkGetVector3Macro(name, type)
Definition: vtkSetGet.h:294
int GetFontFamilyMinValue()
#define vtkGetStringMacro(name)
Definition: vtkSetGet.h:120
represent text properties.
void SetFontFamilyToCourier()
static int GetFontFamilyFromString(const char *f)
#define VTKRENDERINGCORE_EXPORT
GLuint color
Definition: vtkgl.h:12351
virtual char * GetFontFamilyAsString()
#define VTK_FONT_FILE
#define vtkBooleanMacro(name, type)
Definition: vtkSetGet.h:234
static vtkObject * New()
#define vtkSetVector3Macro(name, type)
Definition: vtkSetGet.h:277
#define vtkGetVectorMacro(name, type, count)
Definition: vtkSetGet.h:414
const char * GetVerticalJustificationAsString()
#define vtkSetVector2Macro(name, type)
Definition: vtkSetGet.h:244
void SetFontFamilyToTimes()
void SetJustificationToCentered()
void SetFontFamily(int t)
const char * GetJustificationAsString()
#define vtkSetMacro(name, type)
Definition: vtkSetGet.h:69