VTK  9.3.20240419
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 
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:
154  ~vtkAxisFollower() override;
155 
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  void ComputerAutoCenterTranslation(const double& autoScaleFactor, double translation[3]);
164 
166  void ExecuteViewAngleVisibility(double normal[3]);
167 
168  bool IsTextUpsideDown(double* a, double* b);
169 
171 
174 
177 
178  double ScreenOffsetVector[2];
179 
181 
182 private:
183  int TextUpsideDown;
184  int VisibleAtCurrentViewAngle;
185 
186  vtkAxisFollower(const vtkAxisFollower&) = delete;
187  void operator=(const vtkAxisFollower&) = delete;
188 
189  // hide the two parameter Render() method from the user and the compiler.
190  void Render(vtkRenderer*, vtkMapper*) override {}
191 };
192 
193 VTK_ABI_NAMESPACE_END
194 #endif // vtkAxisFollower_h
Create an axis with tick marks and labels.
Definition: vtkAxisActor.h:90
a subclass of vtkFollower that ensures that data is always parallel to the axis defined by a vtkAxisA...
void SetScreenOffset(double offset)
Set/Get the desired screen offset from the axis.
void ComputeRotationAndTranlation(vtkRenderer *ren, double translation[3], double Rx[3], double Ry[3], double Rz[3], vtkAxisActor *axis)
static double AutoScale(vtkViewport *viewport, vtkCamera *camera, double screenSize, double position[3])
Calculate scale factor to maintain same size of a object on the screen.
~vtkAxisFollower() override
double GetScreenOffset()
Set/Get the desired screen offset from the axis.
void ExecuteViewAngleVisibility(double normal[3])
virtual vtkAxisActor * GetAxis()
Set axis that needs to be followed.
vtkTypeBool AutoCenter
bool IsTextUpsideDown(double *a, double *b)
void ComputerAutoCenterTranslation(const double &autoScaleFactor, double translation[3])
static vtkAxisFollower * New()
Creates a follower with no camera set.
virtual void SetAxis(vtkAxisActor *)
Set axis that needs to be followed.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void ShallowCopy(vtkProp *prop) override
Shallow copy of a follower.
int TestDistanceVisibility()
double DistanceLODThreshold
vtkWeakPointer< vtkAxisActor > Axis
void CalculateOrthogonalVectors(double Rx[3], double Ry[3], double Rz[3], vtkAxisActor *axis1, double *dop, vtkRenderer *ren)
void Render(vtkRenderer *ren) override
This causes the actor to be rendered.
double ViewAngleLODThreshold
virtual void ComputeTransformMatrix(vtkRenderer *ren)
Generate the matrix based on ivars.
void ComputeMatrix() override
Overridden to disable this function, and use ComputeTransformMatrix instead, as we need a renderer to...
a virtual camera for 3D rendering
Definition: vtkCamera.h:151
a subclass of actor that always faces the camera
Definition: vtkFollower.h:92
virtual void Render(vtkRenderer *ren)
This causes the actor to be rendered.
a simple class to control print indentation
Definition: vtkIndent.h:108
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:137
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:66
abstract specification for renderers
Definition: vtkRenderer.h:172
abstract specification for Viewports
Definition: vtkViewport.h:65
@ translation
Definition: vtkX3D.h:232
@ position
Definition: vtkX3D.h:261
@ offset
Definition: vtkX3D.h:438
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_MARSHALAUTO