VTK  9.2.6
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 =========================================================================*/
30 #ifndef vtkTextProperty_h
31 #define vtkTextProperty_h
32 
33 #include "vtkObject.h"
34 #include "vtkRenderingCoreModule.h" // For export macro
35 
36 class VTKRENDERINGCORE_EXPORT vtkTextProperty : public vtkObject
37 {
38 public:
39  vtkTypeMacro(vtkTextProperty, vtkObject);
40  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
46  static vtkTextProperty* New();
47 
49 
52  vtkSetVector3Macro(Color, double);
53  vtkGetVector3Macro(Color, double);
55 
57 
61  vtkSetClampMacro(Opacity, double, 0., 1.);
62  vtkGetMacro(Opacity, double);
64 
66 
69  vtkSetVector3Macro(BackgroundColor, double);
70  vtkGetVector3Macro(BackgroundColor, double);
72 
74 
78  vtkSetClampMacro(BackgroundOpacity, double, 0., 1.);
79  vtkGetMacro(BackgroundOpacity, double);
81 
83 
86  void SetBackgroundRGBA(double rgba[4]);
87  void SetBackgroundRGBA(double r, double g, double b, double a);
88 
92  void GetBackgroundRGBA(double rgba[4]);
93  void GetBackgroundRGBA(double& r, double& g, double& b, double& a);
95 
97 
100  vtkSetVector3Macro(FrameColor, double);
101  vtkGetVector3Macro(FrameColor, double);
103 
105 
108  vtkSetMacro(Frame, vtkTypeBool);
109  vtkGetMacro(Frame, vtkTypeBool);
110  vtkBooleanMacro(Frame, vtkTypeBool);
112 
114 
118  vtkSetClampMacro(FrameWidth, int, 0, VTK_INT_MAX);
119  vtkGetMacro(FrameWidth, int);
121 
123 
129  vtkGetStringMacro(FontFamilyAsString);
130  vtkSetStringMacro(FontFamilyAsString);
131  void SetFontFamily(int t);
132  int GetFontFamily();
134  void SetFontFamilyToArial();
135  void SetFontFamilyToCourier();
136  void SetFontFamilyToTimes();
137  static int GetFontFamilyFromString(const char* f);
138  static const char* GetFontFamilyAsString(int f);
140 
142 
147  vtkGetFilePathMacro(FontFile);
148  vtkSetFilePathMacro(FontFile);
150 
152 
155  vtkSetClampMacro(FontSize, int, 0, VTK_INT_MAX);
156  vtkGetMacro(FontSize, int);
158 
160 
163  vtkSetMacro(Bold, vtkTypeBool);
164  vtkGetMacro(Bold, vtkTypeBool);
165  vtkBooleanMacro(Bold, vtkTypeBool);
167 
169 
172  vtkSetMacro(Italic, vtkTypeBool);
173  vtkGetMacro(Italic, vtkTypeBool);
174  vtkBooleanMacro(Italic, vtkTypeBool);
176 
178 
181  vtkSetMacro(Shadow, vtkTypeBool);
182  vtkGetMacro(Shadow, vtkTypeBool);
183  vtkBooleanMacro(Shadow, vtkTypeBool);
185 
187 
191  vtkSetVector2Macro(ShadowOffset, int);
192  vtkGetVectorMacro(ShadowOffset, int, 2);
194 
198  void GetShadowColor(double color[3]);
199 
201 
205  vtkSetClampMacro(Justification, int, VTK_TEXT_LEFT, VTK_TEXT_RIGHT);
206  vtkGetMacro(Justification, int);
207  void SetJustificationToLeft() { this->SetJustification(VTK_TEXT_LEFT); }
208  void SetJustificationToCentered() { this->SetJustification(VTK_TEXT_CENTERED); }
209  void SetJustificationToRight() { this->SetJustification(VTK_TEXT_RIGHT); }
210  const char* GetJustificationAsString();
212 
214 
218  vtkSetClampMacro(VerticalJustification, int, VTK_TEXT_BOTTOM, VTK_TEXT_TOP);
219  vtkGetMacro(VerticalJustification, int);
220  void SetVerticalJustificationToBottom() { this->SetVerticalJustification(VTK_TEXT_BOTTOM); }
221  void SetVerticalJustificationToCentered() { this->SetVerticalJustification(VTK_TEXT_CENTERED); }
222  void SetVerticalJustificationToTop() { this->SetVerticalJustification(VTK_TEXT_TOP); }
223  const char* GetVerticalJustificationAsString();
225 
227 
233  vtkSetMacro(UseTightBoundingBox, vtkTypeBool);
234  vtkGetMacro(UseTightBoundingBox, vtkTypeBool);
235  vtkBooleanMacro(UseTightBoundingBox, vtkTypeBool);
237 
239 
242  vtkSetMacro(Orientation, double);
243  vtkGetMacro(Orientation, double);
245 
247 
251  vtkSetMacro(LineSpacing, double);
252  vtkGetMacro(LineSpacing, double);
254 
256 
259  vtkSetMacro(LineOffset, double);
260  vtkGetMacro(LineOffset, double);
262 
264 
268  vtkSetMacro(CellOffset, double);
269  vtkGetMacro(CellOffset, double);
271 
273 
277  vtkSetMacro(InteriorLinesVisibility, bool);
278  vtkGetMacro(InteriorLinesVisibility, bool);
280 
282 
286  vtkSetMacro(InteriorLinesWidth, int);
287  vtkGetMacro(InteriorLinesWidth, int);
289 
291 
295  vtkSetVector3Macro(InteriorLinesColor, double);
296  vtkGetVector3Macro(InteriorLinesColor, double);
298 
302  void ShallowCopy(vtkTextProperty* tprop);
303 
304 protected:
305  vtkTextProperty();
306  ~vtkTextProperty() override;
307 
308  double Color[3];
309  double Opacity;
310  double BackgroundColor[3];
313  double FrameColor[3];
316  char* FontFile;
317  int FontSize;
321  int ShadowOffset[2];
325  double Orientation;
326  double LineOffset;
327  double LineSpacing;
328  double CellOffset;
329  bool InteriorLinesVisibility = false;
330  int InteriorLinesWidth = 1;
331  double InteriorLinesColor[3] = { 0.0, 0.0, 0.0 };
332 
333 private:
334  vtkTextProperty(const vtkTextProperty&) = delete;
335  void operator=(const vtkTextProperty&) = delete;
336 };
337 
338 inline const char* vtkTextProperty::GetFontFamilyAsString(int f)
339 {
340  if (f == VTK_ARIAL)
341  {
342  return "Arial";
343  }
344  else if (f == VTK_COURIER)
345  {
346  return "Courier";
347  }
348  else if (f == VTK_TIMES)
349  {
350  return "Times";
351  }
352  else if (f == VTK_FONT_FILE)
353  {
354  return "File";
355  }
356  return "Unknown";
357 }
358 
360 {
362 }
363 
365 {
366  this->SetFontFamily(VTK_ARIAL);
367 }
368 
370 {
371  this->SetFontFamily(VTK_COURIER);
372 }
373 
375 {
376  this->SetFontFamily(VTK_TIMES);
377 }
378 
380 {
381  if (strcmp(f, GetFontFamilyAsString(VTK_ARIAL)) == 0)
382  {
383  return VTK_ARIAL;
384  }
385  else if (strcmp(f, GetFontFamilyAsString(VTK_COURIER)) == 0)
386  {
387  return VTK_COURIER;
388  }
389  else if (strcmp(f, GetFontFamilyAsString(VTK_TIMES)) == 0)
390  {
391  return VTK_TIMES;
392  }
393  else if (strcmp(f, GetFontFamilyAsString(VTK_FONT_FILE)) == 0)
394  {
395  return VTK_FONT_FILE;
396  }
397  return VTK_UNKNOWN_FONT;
398 }
399 
401 {
403 }
404 
406 {
407  if (this->Justification == VTK_TEXT_LEFT)
408  {
409  return "Left";
410  }
411  else if (this->Justification == VTK_TEXT_CENTERED)
412  {
413  return "Centered";
414  }
415  else if (this->Justification == VTK_TEXT_RIGHT)
416  {
417  return "Right";
418  }
419  return "Unknown";
420 }
421 
423 {
425  {
426  return "Bottom";
427  }
428  else if (this->VerticalJustification == VTK_TEXT_CENTERED)
429  {
430  return "Centered";
431  }
432  else if (this->VerticalJustification == VTK_TEXT_TOP)
433  {
434  return "Top";
435  }
436  return "Unknown";
437 }
438 
439 #endif
void SetFontFamilyToArial()
Set/Get the font family.
#define VTK_UNKNOWN_FONT
void SetJustificationToRight()
Set/Get the horizontal justification to left (default), centered, or right.
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkTypeBool Frame
vtkTypeBool Italic
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetVerticalJustificationToTop()
Set/Get the vertical justification to bottom (default), middle, or top.
#define VTK_INT_MAX
Definition: vtkType.h:155
#define VTK_ARIAL
#define VTK_TEXT_TOP
void SetVerticalJustificationToBottom()
Set/Get the vertical justification to bottom (default), middle, or top.
vtkTypeBool Shadow
void SetVerticalJustificationToCentered()
Set/Get the vertical justification to bottom (default), middle, or top.
#define VTK_TEXT_CENTERED
virtual void SetFontFamilyAsString(const char *)
Set/Get the font family.
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_TEXT_RIGHT
#define VTK_TEXT_LEFT
#define VTK_COURIER
a simple class to control print indentation
Definition: vtkIndent.h:39
#define VTK_TEXT_BOTTOM
#define VTK_TIMES
int GetFontFamily()
Set/Get the font family.
int GetFontFamilyMinValue()
Set/Get the font family.
void SetJustificationToLeft()
Set/Get the horizontal justification to left (default), centered, or right.
represent text properties.
void SetFontFamilyToCourier()
Set/Get the font family.
vtkTypeBool Bold
vtkTypeBool UseTightBoundingBox
static int GetFontFamilyFromString(const char *f)
Set/Get the font family.
virtual char * GetFontFamilyAsString()
Set/Get the font family.
#define VTK_FONT_FILE
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
const char * GetVerticalJustificationAsString()
Set/Get the vertical justification to bottom (default), middle, or top.
void SetFontFamilyToTimes()
Set/Get the font family.
void SetJustificationToCentered()
Set/Get the horizontal justification to left (default), centered, or right.
void SetFontFamily(int t)
Set/Get the font family.
const char * GetJustificationAsString()
Set/Get the horizontal justification to left (default), centered, or right.