VTK  9.3.1
vtkTextProperty.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
18 #ifndef vtkTextProperty_h
19 #define vtkTextProperty_h
20 
21 #include "vtkObject.h"
22 #include "vtkRenderingCoreModule.h" // For export macro
23 
24 VTK_ABI_NAMESPACE_BEGIN
25 class VTKRENDERINGCORE_EXPORT vtkTextProperty : public vtkObject
26 {
27 public:
28  vtkTypeMacro(vtkTextProperty, vtkObject);
29  void PrintSelf(ostream& os, vtkIndent indent) override;
30 
35  static vtkTextProperty* New();
36 
38 
41  vtkSetVector3Macro(Color, double);
42  vtkGetVector3Macro(Color, double);
44 
46 
50  vtkSetClampMacro(Opacity, double, 0., 1.);
51  vtkGetMacro(Opacity, double);
53 
55 
58  vtkSetVector3Macro(BackgroundColor, double);
59  vtkGetVector3Macro(BackgroundColor, double);
61 
63 
67  vtkSetClampMacro(BackgroundOpacity, double, 0., 1.);
68  vtkGetMacro(BackgroundOpacity, double);
70 
72 
75  void SetBackgroundRGBA(double rgba[4]);
76  void SetBackgroundRGBA(double r, double g, double b, double a);
77 
81  void GetBackgroundRGBA(double rgba[4]);
82  void GetBackgroundRGBA(double& r, double& g, double& b, double& a);
84 
86 
89  vtkSetVector3Macro(FrameColor, double);
90  vtkGetVector3Macro(FrameColor, double);
92 
94 
97  vtkSetMacro(Frame, vtkTypeBool);
98  vtkGetMacro(Frame, vtkTypeBool);
99  vtkBooleanMacro(Frame, vtkTypeBool);
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 
136  vtkGetFilePathMacro(FontFile);
137  vtkSetFilePathMacro(FontFile);
139 
141 
144  vtkSetClampMacro(FontSize, int, 0, VTK_INT_MAX);
145  vtkGetMacro(FontSize, int);
147 
149 
152  vtkSetMacro(Bold, vtkTypeBool);
153  vtkGetMacro(Bold, vtkTypeBool);
154  vtkBooleanMacro(Bold, vtkTypeBool);
156 
158 
161  vtkSetMacro(Italic, vtkTypeBool);
162  vtkGetMacro(Italic, vtkTypeBool);
163  vtkBooleanMacro(Italic, vtkTypeBool);
165 
167 
170  vtkSetMacro(Shadow, vtkTypeBool);
171  vtkGetMacro(Shadow, vtkTypeBool);
172  vtkBooleanMacro(Shadow, vtkTypeBool);
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() { this->SetJustification(VTK_TEXT_LEFT); }
197  void SetJustificationToCentered() { this->SetJustification(VTK_TEXT_CENTERED); }
198  void SetJustificationToRight() { this->SetJustification(VTK_TEXT_RIGHT); }
199  const char* GetJustificationAsString();
201 
203 
207  vtkSetClampMacro(VerticalJustification, int, VTK_TEXT_BOTTOM, VTK_TEXT_TOP);
208  vtkGetMacro(VerticalJustification, int);
209  void SetVerticalJustificationToBottom() { this->SetVerticalJustification(VTK_TEXT_BOTTOM); }
210  void SetVerticalJustificationToCentered() { this->SetVerticalJustification(VTK_TEXT_CENTERED); }
211  void SetVerticalJustificationToTop() { this->SetVerticalJustification(VTK_TEXT_TOP); }
212  const char* GetVerticalJustificationAsString();
214 
216 
222  vtkSetMacro(UseTightBoundingBox, vtkTypeBool);
223  vtkGetMacro(UseTightBoundingBox, vtkTypeBool);
224  vtkBooleanMacro(UseTightBoundingBox, vtkTypeBool);
226 
228 
231  vtkSetMacro(Orientation, double);
232  vtkGetMacro(Orientation, double);
234 
236 
240  vtkSetMacro(LineSpacing, double);
241  vtkGetMacro(LineSpacing, double);
243 
245 
248  vtkSetMacro(LineOffset, double);
249  vtkGetMacro(LineOffset, double);
251 
253 
257  vtkSetMacro(CellOffset, double);
258  vtkGetMacro(CellOffset, double);
260 
262 
266  vtkSetMacro(InteriorLinesVisibility, bool);
267  vtkGetMacro(InteriorLinesVisibility, bool);
269 
271 
275  vtkSetMacro(InteriorLinesWidth, int);
276  vtkGetMacro(InteriorLinesWidth, int);
278 
280 
284  vtkSetVector3Macro(InteriorLinesColor, double);
285  vtkGetVector3Macro(InteriorLinesColor, double);
287 
291  void ShallowCopy(vtkTextProperty* tprop);
292 
293 protected:
294  vtkTextProperty();
295  ~vtkTextProperty() override;
296 
297  double Color[3];
298  double Opacity;
299  double BackgroundColor[3];
302  double FrameColor[3];
305  char* FontFile;
306  int FontSize;
310  int ShadowOffset[2];
314  double Orientation;
315  double LineOffset;
316  double LineSpacing;
317  double CellOffset;
318  bool InteriorLinesVisibility = false;
319  int InteriorLinesWidth = 1;
320  double InteriorLinesColor[3] = { 0.0, 0.0, 0.0 };
321 
322 private:
323  vtkTextProperty(const vtkTextProperty&) = delete;
324  void operator=(const vtkTextProperty&) = delete;
325 };
326 
327 inline const char* vtkTextProperty::GetFontFamilyAsString(int f)
328 {
329  if (f == VTK_ARIAL)
330  {
331  return "Arial";
332  }
333  else if (f == VTK_COURIER)
334  {
335  return "Courier";
336  }
337  else if (f == VTK_TIMES)
338  {
339  return "Times";
340  }
341  else if (f == VTK_FONT_FILE)
342  {
343  return "File";
344  }
345  return "Unknown";
346 }
347 
349 {
351 }
352 
354 {
355  this->SetFontFamily(VTK_ARIAL);
356 }
357 
359 {
360  this->SetFontFamily(VTK_COURIER);
361 }
362 
364 {
365  this->SetFontFamily(VTK_TIMES);
366 }
367 
369 {
370  if (strcmp(f, GetFontFamilyAsString(VTK_ARIAL)) == 0)
371  {
372  return VTK_ARIAL;
373  }
374  else if (strcmp(f, GetFontFamilyAsString(VTK_COURIER)) == 0)
375  {
376  return VTK_COURIER;
377  }
378  else if (strcmp(f, GetFontFamilyAsString(VTK_TIMES)) == 0)
379  {
380  return VTK_TIMES;
381  }
382  else if (strcmp(f, GetFontFamilyAsString(VTK_FONT_FILE)) == 0)
383  {
384  return VTK_FONT_FILE;
385  }
386  return VTK_UNKNOWN_FONT;
387 }
388 
390 {
392 }
393 
395 {
396  if (this->Justification == VTK_TEXT_LEFT)
397  {
398  return "Left";
399  }
400  else if (this->Justification == VTK_TEXT_CENTERED)
401  {
402  return "Centered";
403  }
404  else if (this->Justification == VTK_TEXT_RIGHT)
405  {
406  return "Right";
407  }
408  return "Unknown";
409 }
410 
412 {
414  {
415  return "Bottom";
416  }
417  else if (this->VerticalJustification == VTK_TEXT_CENTERED)
418  {
419  return "Centered";
420  }
421  else if (this->VerticalJustification == VTK_TEXT_TOP)
422  {
423  return "Top";
424  }
425  return "Unknown";
426 }
427 
428 VTK_ABI_NAMESPACE_END
429 #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:51
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:144
#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:64
#define VTK_TEXT_RIGHT
#define VTK_TEXT_LEFT
#define VTK_COURIER
a simple class to control print indentation
Definition: vtkIndent.h:28
#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.