VTK  9.3.0
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 
23 #include "vtkWeakPointer.h" // For vtkWeakPointer
24 
25 // Forward declarations.
26 VTK_ABI_NAMESPACE_BEGIN
27 class vtkAxisActor;
28 class vtkRenderer;
29 
30 class VTKRENDERINGANNOTATION_EXPORT vtkAxisFollower : public vtkFollower
31 {
32 public:
33  vtkTypeMacro(vtkAxisFollower, vtkFollower);
34  void PrintSelf(ostream& os, vtkIndent indent) override;
35 
39  static vtkAxisFollower* New();
40 
42 
45  virtual void SetAxis(vtkAxisActor*);
46  virtual vtkAxisActor* GetAxis();
48 
50 
55  vtkSetMacro(AutoCenter, vtkTypeBool);
56  vtkGetMacro(AutoCenter, vtkTypeBool);
57  vtkBooleanMacro(AutoCenter, vtkTypeBool);
59 
61 
66  vtkSetMacro(EnableDistanceLOD, int);
67  vtkGetMacro(EnableDistanceLOD, int);
69 
71 
76  vtkSetClampMacro(DistanceLODThreshold, double, 0.0, 1.0);
77  vtkGetMacro(DistanceLODThreshold, double);
79 
81 
86  vtkSetMacro(EnableViewAngleLOD, int);
87  vtkGetMacro(EnableViewAngleLOD, int);
89 
91 
96  vtkSetClampMacro(ViewAngleLODThreshold, double, 0.0, 1.0);
97  vtkGetMacro(ViewAngleLODThreshold, double);
99 
101 
105  double GetScreenOffset();
106  void SetScreenOffset(double offset);
108 
110 
114  vtkSetVector2Macro(ScreenOffsetVector, double);
115  vtkGetVector2Macro(ScreenOffsetVector, double);
117 
119 
124  void Render(vtkRenderer* ren) override;
126 
131  void ComputeMatrix() override{};
132 
138 
142  void ShallowCopy(vtkProp* prop) override;
143 
148  static double AutoScale(
149  vtkViewport* viewport, vtkCamera* camera, double screenSize, double position[3]);
150 
151 protected:
153  ~vtkAxisFollower() override;
154 
156  double Rx[3], double Ry[3], double Rz[3], vtkAxisActor* axis1, double* dop, vtkRenderer* ren);
157 
158  void ComputeRotationAndTranlation(vtkRenderer* ren, double translation[3], double Rx[3],
159  double Ry[3], double Rz[3], vtkAxisActor* axis);
160 
161  // \NOTE: Not used as of now.
162  void ComputerAutoCenterTranslation(const double& autoScaleFactor, double translation[3]);
163 
165  void ExecuteViewAngleVisibility(double normal[3]);
166 
167  bool IsTextUpsideDown(double* a, double* b);
168 
170 
173 
176 
177  double ScreenOffsetVector[2];
178 
180 
181 private:
182  int TextUpsideDown;
183  int VisibleAtCurrentViewAngle;
184 
185  vtkAxisFollower(const vtkAxisFollower&) = delete;
186  void operator=(const vtkAxisFollower&) = delete;
187 
188  // hide the two parameter Render() method from the user and the compiler.
189  void Render(vtkRenderer*, vtkMapper*) override {}
190 };
191 
192 VTK_ABI_NAMESPACE_END
193 #endif // vtkAxisFollower_h
Create an axis with tick marks and labels.
Definition: vtkAxisActor.h:79
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:50
a subclass of actor that always faces the camera
Definition: vtkFollower.h:42
virtual void Render(vtkRenderer *ren)
This causes the actor to be rendered.
a simple class to control print indentation
Definition: vtkIndent.h:38
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:86
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:55
abstract specification for renderers
Definition: vtkRenderer.h:71
abstract specification for Viewports
Definition: vtkViewport.h:54
@ translation
Definition: vtkX3D.h:232
@ position
Definition: vtkX3D.h:261
@ offset
Definition: vtkX3D.h:438
int vtkTypeBool
Definition: vtkABI.h:64