VTK  9.7.1
vtkAxisFollower.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
17 #ifndef vtkAxisFollower_h
18 #define vtkAxisFollower_h
19 
20 #include "vtkFollower.h"
21 #include "vtkRenderingAnnotationModule.h" // For export macro
22 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
23 
24 #include "vtkWeakPointer.h" // For vtkWeakPointer
25 
26 // Forward declarations.
27 VTK_ABI_NAMESPACE_BEGIN
28 class vtkAxisActor;
29 class vtkRenderer;
30 
31 class VTKRENDERINGANNOTATION_EXPORT VTK_MARSHALAUTO vtkAxisFollower : public vtkFollower
32 {
33 public:
34  vtkTypeMacro(vtkAxisFollower, vtkFollower);
35  void PrintSelf(ostream& os, vtkIndent indent) override;
36 
40  static vtkAxisFollower* New();
41 
43 
46  virtual void SetAxis(vtkAxisActor*);
47  virtual vtkAxisActor* GetAxis();
49 
51 
56  vtkSetMacro(AutoCenter, vtkTypeBool);
57  vtkGetMacro(AutoCenter, vtkTypeBool);
58  vtkBooleanMacro(AutoCenter, vtkTypeBool);
60 
62 
67  vtkSetMacro(EnableDistanceLOD, int);
68  vtkGetMacro(EnableDistanceLOD, int);
70 
72 
77  vtkSetClampMacro(DistanceLODThreshold, double, 0.0, 1.0);
78  vtkGetMacro(DistanceLODThreshold, double);
80 
82 
87  vtkSetMacro(EnableViewAngleLOD, int);
88  vtkGetMacro(EnableViewAngleLOD, int);
90 
92 
97  vtkSetClampMacro(ViewAngleLODThreshold, double, 0.0, 1.0);
98  vtkGetMacro(ViewAngleLODThreshold, double);
100 
102 
106  double GetScreenOffset();
107  void SetScreenOffset(double offset);
109 
111 
115  vtkSetVector2Macro(ScreenOffsetVector, double);
116  vtkGetVector2Macro(ScreenOffsetVector, double);
118 
120 
125  void Render(vtkRenderer* ren) override;
127 
132  void ComputeMatrix() override {}
133 
138  virtual void ComputeTransformMatrix(vtkRenderer* ren);
139 
143  void ShallowCopy(vtkProp* prop) override;
144 
149  static double AutoScale(
150  vtkViewport* viewport, vtkCamera* camera, double screenSize, double position[3]);
151 
152 protected:
153  vtkAxisFollower();
154  ~vtkAxisFollower() override;
155 
156  void CalculateOrthogonalVectors(
157  double Rx[3], double Ry[3], double Rz[3], vtkAxisActor* axis1, double* dop, vtkRenderer* ren);
158 
159  void ComputeRotationAndTranlation(vtkRenderer* ren, double translation[3], double Rx[3],
160  double Ry[3], double Rz[3], vtkAxisActor* axis);
161 
162  // \NOTE: Not used as of now.
163  VTK_DEPRECATED_IN_9_6_0("Unmaintained method, please do not use.")
164  void ComputerAutoCenterTranslation(const double& autoScaleFactor, double translation[3]);
165 
166  int TestDistanceVisibility();
167  void ExecuteViewAngleVisibility(double normal[3]);
168 
169  bool IsTextUpsideDown(double* a, double* b);
170 
171  vtkTypeBool AutoCenter;
172 
173  int EnableDistanceLOD;
174  double DistanceLODThreshold;
175 
176  int EnableViewAngleLOD;
177  double ViewAngleLODThreshold;
178 
179  double ScreenOffsetVector[2];
180 
182 
183 private:
184  int TextUpsideDown;
185  int VisibleAtCurrentViewAngle;
186 
187  vtkAxisFollower(const vtkAxisFollower&) = delete;
188  void operator=(const vtkAxisFollower&) = delete;
189 
190  // hide the two parameter Render() method from the user and the compiler.
191  void Render(vtkRenderer*, vtkMapper*) override {}
192 };
193 
194 VTK_ABI_NAMESPACE_END
195 #endif // vtkAxisFollower_h
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:49
abstract specification for Viewports
Definition: vtkViewport.h:46
void ComputeMatrix() override
Overridden to disable this function, and use ComputeTransformMatrix instead, as we need a renderer to...
virtual void Render(vtkRenderer *ren)
This causes the actor to be rendered.
Create an axis with tick marks and labels.
Definition: vtkAxisActor.h:71
abstract specification for renderers
Definition: vtkRenderer.h:63
void ShallowCopy(vtkProp *prop) override
Shallow copy of a follower.
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_DEPRECATED_IN_9_6_0(reason)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:28
a virtual camera for 3D rendering
Definition: vtkCamera.h:41
a weak reference to a vtkObject.
Definition: vtkMeta.h:25
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:77
a subclass of vtkFollower that ensures that data is always parallel to the axis defined by a vtkAxisA...
a subclass of actor that always faces the camera
Definition: vtkFollower.h:33
static vtkFollower * New()
Creates a follower with no camera set.
#define VTK_MARSHALAUTO