ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cvCustomAxisHandleRepresentation.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 //
8 // Custom handle representation that supports custom translation axis
9 // This backports VTK 9.3+ functionality to VTK 9.2 and earlier
10 
11 #ifndef cvCustomAxisHandleRepresentation_h
12 #define cvCustomAxisHandleRepresentation_h
13 
14 #include <vtkPointHandleRepresentation3D.h>
15 #include <vtkVersion.h>
16 
24 class cvCustomAxisHandleRepresentation : public vtkPointHandleRepresentation3D {
25 public:
28  vtkPointHandleRepresentation3D);
29  void PrintSelf(ostream& os, vtkIndent indent) override;
30 
31 #if !((VTK_MAJOR_VERSION > 9) || \
32  (VTK_MAJOR_VERSION == 9 && VTK_MINOR_VERSION >= 3))
33  // These methods are only needed for VTK < 9.3
34  // In VTK 9.3+, the base class already has these
35 
40 
45 
50  void SetCustomTranslationAxis(double axis[3]);
51  void SetCustomTranslationAxis(double x, double y, double z);
52 
57 
61  bool IsCustomAxisEnabled() const { return this->CustomAxisEnabled; }
62 
66  void GetTranslationVector(const double* p1,
67  const double* p2,
68  double* v) const override;
69 
73  void Translate(const double* p1, const double* p2) override;
74  void Translate(const double* v) override;
75 
76 protected:
79 
82 
83 #else
84  // For VTK 9.3+, just forward to base class methods
86  this->Superclass::SetCustomTranslationAxisOn();
87  }
88 
90  this->Superclass::SetTranslationAxisOff();
91  }
92 
93  void SetCustomTranslationAxis(double axis[3]) {
94  this->Superclass::SetCustomTranslationAxis(axis);
95  }
96 
97  void SetCustomTranslationAxis(double x, double y, double z) {
98  double axis[3] = {x, y, z};
99  this->Superclass::SetCustomTranslationAxis(axis);
100  }
101 
102 protected:
105 #endif
106 
107 private:
109  delete;
110  void operator=(const cvCustomAxisHandleRepresentation&) = delete;
111 };
112 
113 #endif // cvCustomAxisHandleRepresentation_h
Handle representation with custom translation axis support.
bool IsCustomAxisEnabled() const
Check if custom translation axis is enabled.
static cvCustomAxisHandleRepresentation * New()
void SetCustomTranslationAxisOff()
Disable custom translation axis mode.
void PrintSelf(ostream &os, vtkIndent indent) override
void SetCustomTranslationAxisOn()
Enable custom translation axis mode.
vtkGetVector3Macro(CustomTranslationAxis, double)
Get the custom translation axis.
void Translate(const double *p1, const double *p2) override
Override Translate to support custom axis.
void GetTranslationVector(const double *p1, const double *p2, double *v) const override
Override GetTranslationVector to support custom axis.
void SetCustomTranslationAxis(double axis[3])
Set the custom translation axis vector.
vtkTypeMacro(cvCustomAxisHandleRepresentation, vtkPointHandleRepresentation3D)
normal_z y
normal_z x
normal_z z