VTK  9.0.1
vtkAxisFollower.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAxisFollower.cxx
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
29 #ifndef vtkAxisFollower_h
30 #define vtkAxisFollower_h
31 
32 #include "vtkFollower.h"
33 #include "vtkRenderingAnnotationModule.h" // For export macro
34 
35 #include "vtkWeakPointer.h" // For vtkWeakPointer
36 
37 // Forward declarations.
38 class vtkAxisActor;
39 class vtkRenderer;
40 
41 class VTKRENDERINGANNOTATION_EXPORT vtkAxisFollower : public vtkFollower
42 {
43 public:
44  vtkTypeMacro(vtkAxisFollower, vtkFollower);
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
50  static vtkAxisFollower* New();
51 
53 
56  virtual void SetAxis(vtkAxisActor*);
57  virtual vtkAxisActor* GetAxis();
59 
61 
66  vtkSetMacro(AutoCenter, vtkTypeBool);
67  vtkGetMacro(AutoCenter, vtkTypeBool);
68  vtkBooleanMacro(AutoCenter, vtkTypeBool);
70 
72 
77  vtkSetMacro(EnableDistanceLOD, int);
78  vtkGetMacro(EnableDistanceLOD, int);
80 
82 
87  vtkSetClampMacro(DistanceLODThreshold, double, 0.0, 1.0);
88  vtkGetMacro(DistanceLODThreshold, double);
90 
92 
97  vtkSetMacro(EnableViewAngleLOD, int);
98  vtkGetMacro(EnableViewAngleLOD, int);
100 
102 
107  vtkSetClampMacro(ViewAngleLODThreshold, double, 0.0, 1.0);
108  vtkGetMacro(ViewAngleLODThreshold, double);
110 
112 
116  double GetScreenOffset();
117  void SetScreenOffset(double offset);
119 
121 
125  vtkSetVector2Macro(ScreenOffsetVector, double);
126  vtkGetVector2Macro(ScreenOffsetVector, double);
128 
130 
135  int RenderOpaqueGeometry(vtkViewport* viewport) override;
137  void Render(vtkRenderer* ren) override;
139 
145 
149  void ShallowCopy(vtkProp* prop) override;
150 
155  static double AutoScale(
156  vtkViewport* viewport, vtkCamera* camera, double screenSize, double position[3]);
157 
158 protected:
160  ~vtkAxisFollower() override;
161 
163  double Rx[3], double Ry[3], double Rz[3], vtkAxisActor* axis1, double* dop, vtkRenderer* ren);
164 
165  void ComputeRotationAndTranlation(vtkRenderer* ren, double translation[3], double Rx[3],
166  double Ry[3], double Rz[3], vtkAxisActor* axis);
167 
168  // \NOTE: Not used as of now.
169  void ComputerAutoCenterTranslation(const double& autoScaleFactor, double translation[3]);
170 
172  void ExecuteViewAngleVisibility(double normal[3]);
173 
174  bool IsTextUpsideDown(double* a, double* b);
175 
177 
180 
183 
184  double ScreenOffsetVector[2];
185 
187 
188 private:
189  int TextUpsideDown;
190  int VisibleAtCurrentViewAngle;
191 
192  vtkAxisFollower(const vtkAxisFollower&) = delete;
193  void operator=(const vtkAxisFollower&) = delete;
194 
195  // hide the two parameter Render() method from the user and the compiler.
196  void Render(vtkRenderer*, vtkMapper*) override {}
197 };
198 
199 #endif // vtkAxisFollower_h
Create an axis with tick marks and labels.
Definition: vtkAxisActor.h:72
a subclass of vtkFollower that ensures that data is always parallel to the axis defined by a vtkAxisA...
void SetScreenOffset(double offset)
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()
int RenderOpaqueGeometry(vtkViewport *viewport) override
This causes the actor to be rendered.
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)
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
void Render(vtkRenderer *ren) override
double ViewAngleLODThreshold
virtual void ComputeTransformMatrix(vtkRenderer *ren)
Generate the matrix based on ivars.
a virtual camera for 3D rendering
Definition: vtkCamera.h:46
a subclass of actor that always faces the camera
Definition: vtkFollower.h:41
virtual void Render(vtkRenderer *ren)
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract class specifies interface to map data to graphics primitives
Definition: vtkMapper.h:81
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:54
abstract specification for renderers
Definition: vtkRenderer.h:68
abstract specification for Viewports
Definition: vtkViewport.h:45
@ translation
Definition: vtkX3D.h:238
@ position
Definition: vtkX3D.h:267
@ offset
Definition: vtkX3D.h:444
int vtkTypeBool
Definition: vtkABI.h:69