1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkCameraPathWidget.h
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 =========================================================================*/
15 /**
16  * @class   vtkCameraPathWidget
17  * @brief   widget for vtkCameraPathRepresentation.
18  *
19  * vtkCameraPathWidget is the vtkAbstractWidget subclass for
20  * vtkCameraPathRepresentation which manages the interactions with
21  * vtkCameraPathRepresentation. This is based on vtkSplineWidget2.
22  * @sa
23  * vtkCameraPathRepresentation
24  */
25 
26 #ifndef vtkCameraPathWidget_h
27 #define vtkCameraPathWidget_h
28 
29 #include "vtkAbstractWidget.h"
30 #include "vtkInteractionWidgetsModule.h" // For export macro
31 #include "vtkNew.h"                      // for vtkNew
32 
33 class vtkCameraPathRepresentation;
34 
35 class VTKINTERACTIONWIDGETS_EXPORT vtkCameraPathWidget : public vtkAbstractWidget
36 {
37 public:
38   static vtkCameraPathWidget* New();
39   vtkTypeMacro(vtkCameraPathWidget, vtkAbstractWidget);
40   void PrintSelf(ostream& os, vtkIndent indent) override;
41 
42   /**
43    * Specify an instance of vtkWidgetRepresentation used to represent this
44    * widget in the scene. Note that the representation is a subclass of
45    * vtkProp so it can be added to the renderer independent of the widget.
46    */
47   void SetRepresentation(vtkCameraPathRepresentation* r);
48 
49   /**
50    * Override superclasses SetEnabled() method because the line
51    * widget must enable its internal handle widgets.
52    */
53   void SetEnabled(int enabling) override;
54 
55   /**
56    * Create the default widget representation if one is not set. By default,
57    * this is an instance of the vtkCameraPathRepresentation class.
58    */
59   void CreateDefaultRepresentation() override;
60 
61 protected:
62   vtkCameraPathWidget();
63   ~vtkCameraPathWidget() override = default;
64 
65   int WidgetState = vtkCameraPathWidget::Start;
66   enum _WidgetState
67   {
68     Start = 0,
69     Active
70   };
71 
72   // These methods handle events
73   static void SelectAction(vtkAbstractWidget*);
74   static void EndSelectAction(vtkAbstractWidget*);
75   static void TranslateAction(vtkAbstractWidget*);
76   static void ScaleAction(vtkAbstractWidget*);
77   static void MoveAction(vtkAbstractWidget*);
78 
79   vtkNew<vtkCallbackCommand> KeyEventCallbackCommand;
80   static void ProcessKeyEvents(vtkObject*, unsigned long, void*, void*);
81 
82 private:
83   vtkCameraPathWidget(const vtkCameraPathWidget&) = delete;
84   void operator=(const vtkCameraPathWidget&) = delete;
85 };
86 
87 #endif
88