ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cvConstrainedDistanceWidget.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 // Control Layer: cvConstrainedDistanceWidget
9 // Based on ParaView: VTK/Interaction/Widgets/vtkLineWidget2.{h,cxx}
10 //
11 // Layer hierarchy:
12 // cvDistanceTool (Qt object) - Presentation Layer
13 // ↓ owns
14 // cvConstrainedDistanceWidget - Control Layer (this class)
15 // ↓ owns WidgetRep pointer
16 // vtkLineRepresentation - Representation Layer
17 // ↓ owns (member variables)
18 // ├─ Point1Representation (vtkHandleRepresentation) - Data Layer
19 // ├─ Point2Representation (vtkHandleRepresentation) - Data Layer
20 // └─ LineHandleRepresentation (vtkHandleRepresentation) - Data Layer (middle
21 // handle)
22 
23 #ifndef cvConstrainedDistanceWidget_h
24 #define cvConstrainedDistanceWidget_h
25 
26 #include <vtkLineWidget2.h>
27 
50 class cvConstrainedDistanceWidget : public vtkLineWidget2 {
51 public:
54  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
60  void SetInteractor(vtkRenderWindowInteractor* iren) override;
61 
66  void SetEnabled(int enabling) override;
67 
68 protected:
71 
81  static void ProcessKeyEvents(vtkObject* object,
82  unsigned long event,
83  void* clientdata,
84  void* calldata);
85 
86 private:
88  void operator=(const cvConstrainedDistanceWidget&) = delete;
89 
90  // Keyboard observer IDs and callback command
91  unsigned long KeyPressObserverId;
92  unsigned long KeyReleaseObserverId;
93  vtkCallbackCommand* KeyboardCallbackCommand;
94 };
95 
96 #endif // cvConstrainedDistanceWidget_h
MouseEvent event
Line/Distance Widget with XYZL constraint support (100% consistent with ParaView)
void SetInteractor(vtkRenderWindowInteractor *iren) override
Set interactor - override to register keyboard events Copied from ParaView vtkLineWidget2.
vtkTypeMacro(cvConstrainedDistanceWidget, vtkLineWidget2)
static void ProcessKeyEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
Keyboard event handler - directly copied from ParaView vtkLineWidget2::ProcessKeyEvents.
static cvConstrainedDistanceWidget * New()
void PrintSelf(ostream &os, vtkIndent indent) override
void SetEnabled(int enabling) override
Override SetEnabled to manage keyboard event observers We need to remove the parent class's keyboard ...