Developer documentation | Axl-2.5.1

axlInteractorStyleSwitch.h
Go to the documentation of this file.
1 /* axlInteractorStyleSwitch.h ---
2  *
3  * Author: Meriadeg Perrinel
4  * Copyright (C) 2008 - Meriadeg Perrinel, Inria.
5  * Created: Fri Feb 18 17:25:39 2011 (+0100)
6  * Version: $Id$
7  * Last-Updated: Fri Feb 18 17:28:34 2011 (+0100)
8  * By: Meriadeg Perrinel
9  * Update #: 18
10  */
11 
12 /* Commentary:
13  *
14  */
15 
16 /* Change log:
17  *
18  */
19 #ifndef AXLINTERACTORSSTYLEWITCH
20 #define AXLINTERACTORSSTYLEWITCH
21 
22 #include "vtkInteractorStyle.h"
23 #include <QtCore/QObject>
24 
25 #include "axlVtkViewPluginExport.h"
26 
27 
28 #define VTKIS_JOYSTICK 0
29 #define VTKIS_TRACKBALL 1
30 
31 #define VTKIS_CAMERA 0
32 #define VTKIS_ACTOR 1
33 
34 class vtkInteractorStyleJoystickActor;
35 class vtkInteractorStyleJoystickCamera;
36 class vtkInteractorStyleTrackballActor;
37 class vtkInteractorStyleTrackballCamera;
38 
39 class axlInteractorStyleSwitchPrivate;
40 
41 class AXLVTKVIEWPLUGIN_EXPORT axlInteractorStyleSwitch :public QObject, public vtkInteractorStyle
42 {
43  Q_OBJECT
44 
45 public:
46  static axlInteractorStyleSwitch *New();
47  vtkTypeMacro(axlInteractorStyleSwitch, vtkInteractorStyle);
48  void PrintSelf(ostream& os, vtkIndent indent);
49 
50  // Description:
51  // The sub styles need the interactor too.
52  void SetInteractor(vtkRenderWindowInteractor *iren);
53 
54  // Description:
55  // We must override this method in order to pass the setting down to
56  // the underlying styles
57  void SetAutoAdjustCameraClippingRange( int value ) override;
58 
59  // Description:
60  // Set/Get current style
61  vtkGetObjectMacro(CurrentStyle, vtkInteractorStyle);
62  void SetCurrentStyleToJoystickActor();
63  void SetCurrentStyleToJoystickCamera();
64  void SetCurrentStyleToTrackballActor();
65  void SetCurrentStyleToTrackballCamera();
66 
67  // Description:
68  // Only care about the char event, which is used to switch between
69  // different styles.
70  virtual void OnChar();
71 
72  // Description:
73  // Overridden from vtkInteractorObserver because the interactor styles
74  // used by this class must also be updated.
75  virtual void SetDefaultRenderer(vtkRenderer*) override;
76  virtual void SetCurrentRenderer(vtkRenderer*) override;
77 
78 protected:
79  axlInteractorStyleSwitch(QObject *parent = 0);
81 
82  void SetCurrentStyle();
83 
84  vtkInteractorStyleJoystickActor *JoystickActor;
85  vtkInteractorStyleJoystickCamera *JoystickCamera;
86  vtkInteractorStyleTrackballActor *TrackballActor;
87  vtkInteractorStyleTrackballCamera *TrackballCamera;
88  vtkInteractorStyle* CurrentStyle;
89 
92 
93 private:
94  axlInteractorStyleSwitch(const axlInteractorStyleSwitch&); // Not implemented.
95  void operator=(const axlInteractorStyleSwitch&); // Not implemented.
96 
97 private:
98  axlInteractorStyleSwitchPrivate *d;
99 };
100 
101 #endif //AXLINTERACTORSSTYLEWITCH
#define AXLVTKVIEWPLUGIN_EXPORT
vtkInteractorStyleJoystickCamera * JoystickCamera
vtkInteractorStyleTrackballActor * TrackballActor
vtkInteractorStyleJoystickActor * JoystickActor
vtkInteractorStyleTrackballCamera * TrackballCamera
vtkInteractorStyle * CurrentStyle