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=========================================================================*/
33#ifndef vtkTextProperty_h
34#define vtkTextProperty_h
35
36#include "vtkRenderingCoreModule.h" // For export macro
37#include "vtkObject.h"
38
39class VTKRENDERINGCORE_EXPORT vtkTextProperty : public vtkObject
40{
41public:
43 void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
44
50
52
55 vtkSetVector3Macro(Color,double);
56 vtkGetVector3Macro(Color,double);
58
60
64 vtkSetClampMacro(Opacity, double, 0., 1.);
65 vtkGetMacro(Opacity,double);
67
69
72 vtkSetVector3Macro(BackgroundColor, double);
73 vtkGetVector3Macro(BackgroundColor, double);
75
77
81 vtkSetClampMacro(BackgroundOpacity, double, 0., 1.);
82 vtkGetMacro(BackgroundOpacity, double);
84
86
89 vtkSetVector3Macro(FrameColor, double);
90 vtkGetVector3Macro(FrameColor, double);
92
94
97 vtkSetMacro(Frame, int);
98 vtkGetMacro(Frame, int);
99 vtkBooleanMacro(Frame, int);
101
103
107 vtkSetClampMacro(FrameWidth, int, 0, VTK_INT_MAX);
108 vtkGetMacro(FrameWidth, int);
110
112
118 vtkGetStringMacro(FontFamilyAsString);
119 vtkSetStringMacro(FontFamilyAsString);
120 void SetFontFamily(int t);
121 int GetFontFamily();
123 void SetFontFamilyToArial();
124 void SetFontFamilyToCourier();
125 void SetFontFamilyToTimes();
126 static int GetFontFamilyFromString( const char *f );
127 static const char *GetFontFamilyAsString( int f );
129
131
137 vtkSetStringMacro(FontFile)
139
141
144 vtkSetClampMacro(FontSize,int,0,VTK_INT_MAX);
145 vtkGetMacro(FontSize, int);
147
149
152 vtkSetMacro(Bold, int);
153 vtkGetMacro(Bold, int);
154 vtkBooleanMacro(Bold, int);
156
158
161 vtkSetMacro(Italic, int);
162 vtkGetMacro(Italic, int);
163 vtkBooleanMacro(Italic, int);
165
167
170 vtkSetMacro(Shadow, int);
171 vtkGetMacro(Shadow, int);
172 vtkBooleanMacro(Shadow, int);
174
176
180 vtkSetVector2Macro(ShadowOffset,int);
181 vtkGetVectorMacro(ShadowOffset,int,2);
183
187 void GetShadowColor(double color[3]);
188
190
194 vtkSetClampMacro(Justification,int,VTK_TEXT_LEFT,VTK_TEXT_RIGHT);
195 vtkGetMacro(Justification,int);
196 void SetJustificationToLeft()
197 { this->SetJustification(VTK_TEXT_LEFT);};
199 { this->SetJustification(VTK_TEXT_CENTERED);};
201 { this->SetJustification(VTK_TEXT_RIGHT);};
202 const char *GetJustificationAsString();
204
206
210 vtkSetClampMacro(VerticalJustification,int,VTK_TEXT_BOTTOM,VTK_TEXT_TOP);
211 vtkGetMacro(VerticalJustification,int);
213 {this->SetVerticalJustification(VTK_TEXT_BOTTOM);};
215 {this->SetVerticalJustification(VTK_TEXT_CENTERED);};
217 {this->SetVerticalJustification(VTK_TEXT_TOP);};
218 const char *GetVerticalJustificationAsString();
220
222
228 vtkSetMacro(UseTightBoundingBox, int);
229 vtkGetMacro(UseTightBoundingBox, int);
230 vtkBooleanMacro(UseTightBoundingBox, int);
232
234
237 vtkSetMacro(Orientation,double);
238 vtkGetMacro(Orientation,double);
240
242
246 vtkSetMacro(LineSpacing, double);
247 vtkGetMacro(LineSpacing, double);
249
251
254 vtkSetMacro(LineOffset, double);
255 vtkGetMacro(LineOffset, double);
257
262
263protected:
266
267 double Color[3];
268 double Opacity;
269 double BackgroundColor[3];
271 int Frame;
272 double FrameColor[3];
275 char* FontFile;
277 int Bold;
280 int ShadowOffset[2];
287
288private:
289 vtkTextProperty(const vtkTextProperty&) VTK_DELETE_FUNCTION;
290 void operator=(const vtkTextProperty&) VTK_DELETE_FUNCTION;
291};
292
293inline const char *vtkTextProperty::GetFontFamilyAsString( int f )
294{
295 if ( f == VTK_ARIAL )
296 {
297 return "Arial";
298 }
299 else if ( f == VTK_COURIER )
300 {
301 return "Courier";
302 }
303 else if ( f == VTK_TIMES )
304 {
305 return "Times";
306 }
307 else if ( f == VTK_FONT_FILE )
308 {
309 return "File";
310 }
311 return "Unknown";
312}
313
315{
317}
318
320{
322}
323
325{
327}
328
330{
332}
333
335{
336 if ( strcmp( f, GetFontFamilyAsString( VTK_ARIAL ) ) == 0 )
337 {
338 return VTK_ARIAL;
339 }
340 else if ( strcmp( f, GetFontFamilyAsString( VTK_COURIER ) ) == 0 )
341 {
342 return VTK_COURIER;
343 }
344 else if ( strcmp( f, GetFontFamilyAsString( VTK_TIMES ) ) == 0 )
345 {
346 return VTK_TIMES;
347 }
348 else if ( strcmp( f, GetFontFamilyAsString( VTK_FONT_FILE) ) == 0 )
349 {
350 return VTK_FONT_FILE;
351 }
352 return VTK_UNKNOWN_FONT;
353}
354
356{
358}
359
361{
362 if (this->Justification == VTK_TEXT_LEFT)
363 {
364 return "Left";
365 }
366 else if (this->Justification == VTK_TEXT_CENTERED)
367 {
368 return "Centered";
369 }
370 else if (this->Justification == VTK_TEXT_RIGHT)
371 {
372 return "Right";
373 }
374 return "Unknown";
375}
376
378{
380 {
381 return "Bottom";
382 }
384 {
385 return "Centered";
386 }
387 else if (this->VerticalJustification == VTK_TEXT_TOP)
388 {
389 return "Top";
390 }
391 return "Unknown";
392}
393
394#endif
a simple class to control print indentation
Definition: vtkIndent.h:40
abstract base class for most VTK objects
Definition: vtkObject.h:60
represent text properties.
void SetFontFamilyToArial()
void ShallowCopy(vtkTextProperty *tprop)
Shallow copy of a text property.
static vtkTextProperty * New()
Creates a new text property with font size 12, bold off, italic off, and Arial font.
static int GetFontFamilyFromString(const char *f)
virtual char * GetFontFamilyAsString()
Set/Get the font family.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetJustificationToCentered()
void SetFontFamilyToCourier()
void SetVerticalJustificationToCentered()
const char * GetVerticalJustificationAsString()
void SetJustificationToRight()
void SetVerticalJustificationToTop()
void SetFontFamily(int t)
void SetVerticalJustificationToBottom()
const char * GetJustificationAsString()
virtual void SetFontFamilyAsString(const char *)
void SetFontFamilyToTimes()
@ Color
Definition: vtkX3D.h:46
@ color
Definition: vtkX3D.h:221
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
#define VTK_TEXT_TOP
#define VTK_TEXT_RIGHT
#define VTK_TEXT_LEFT
#define VTK_COURIER
#define VTK_TEXT_BOTTOM
#define VTK_FONT_FILE
#define VTK_ARIAL
#define VTK_TIMES
#define VTK_UNKNOWN_FONT
#define VTK_TEXT_CENTERED
#define VTK_INT_MAX
Definition: vtkType.h:153