VTK  9.7.1
vtkFollowerTextPropertyAdaptor.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
3 #ifndef vtkFollowerTextPropertyAdaptor_h
4 #define vtkFollowerTextPropertyAdaptor_h
5 
6 #include "vtkCallbackCommand.h"
7 #include "vtkNew.h" // for vtkNew
8 #include "vtkWeakPointer.h" // for vtkSmartPointer
9 
10 VTK_ABI_NAMESPACE_BEGIN
11 
12 class vtkAxisFollower;
13 class vtkProperty;
15 class vtkTextProperty;
16 
27 {
28 public:
31 
37  static void OnModified(vtkObject*, unsigned long, void* clientData, void*);
38 
46  void UpdateProperty(vtkTextProperty* textProp, vtkProperty* actorProperty);
47 
54  void SetScale(double scale);
55 
61  [[nodiscard]] double GetFontScale();
62 
63 private:
64  vtkAxisFollower* MapperFollower;
65  vtkProp3DAxisFollower* PropFollower;
66  double FontScale = 1;
67 
68  unsigned int TextPropObserverId = 0;
69  vtkNew<vtkCallbackCommand> ModifiedCallback;
70  vtkWeakPointer<vtkTextProperty> ObservedProperty;
71 };
72 
73 VTK_ABI_NAMESPACE_END
74 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:52
double GetFontScale()
Return the scale to apply to mimic a font size.
represent surface properties of a geometric object
Definition: vtkProperty.h:59
void UpdateProperty(vtkTextProperty *textProp, vtkProperty *actorProperty)
DeepCopy actorProperty.
represent text properties.
a subclass of vtkFollower that ensures that data is always parallel to the axis defined by a vtkAxisA...
a subclass of vtkProp3DFollower that ensures that data is always parallel to the axis defined by a vt...
vtkFollowerTextPropertyAdaptor(vtkAxisFollower *follower, vtkProp3DAxisFollower *propFollower)
vtkFollowerTextPropertyAdaptor is a helper class to mimic vtkTextProperty behavior for a vtkAxisFollo...
static void OnModified(vtkObject *, unsigned long, void *clientData, void *)
Call Modified on the vtkAxisActor of the follower, to trigger a render.
void SetScale(double scale)
Update the scale, taking the FontScale into account.