Tulip  4.4.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
MouseInteractors.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef MOUSEOBJECT_H
22 #define MOUSEOBJECT_H
23 
24 #include <tulip/InteractorComposite.h>
25 #include <tulip/Camera.h>
26 
27 namespace tlp {
28 
29 class NodeLinkDiagramComponent;
30 
31 /** An interactor class allowing to zoom and pan using the mouse wheel.
32  */
33 class TLP_QT_SCOPE MousePanNZoomNavigator:public InteractorComponent {
34 public:
35  MousePanNZoomNavigator():cameraScaleFactor(1), isGesturing(false) {}
36  ~MousePanNZoomNavigator() {}
37  bool eventFilter(QObject *, QEvent *);
38 protected:
39  float cameraScaleFactor;
40  bool isGesturing;
41 };
42 
43 /** An interactor class used to delete a graph element on mouse left click
44  */
45 class TLP_QT_SCOPE MouseElementDeleter:public InteractorComponent {
46 public:
47  MouseElementDeleter() {}
48  ~MouseElementDeleter() {}
49  bool eventFilter(QObject *, QEvent *);
50  void clear();
51 };
52 
53 /** An interactor class to translate/rotate using keys or mouse movements,
54  or to zoom and pan using the mouse wheel or
55  */
56 class TLP_QT_SCOPE MouseNKeysNavigator: public MousePanNZoomNavigator {
57 private:
58  InteractorComponent *currentSpecInteractorComponent;
59 
60  QCursor oldCursor;
61 public:
62  MouseNKeysNavigator() : currentSpecInteractorComponent(NULL) {}
63  ~MouseNKeysNavigator() {}
64  bool eventFilter(QObject *, QEvent *);
65  void clear();
66  void viewChanged(tlp::View *view);
67 
68 private :
69 
70  // member below are to manage meta node navigation
71  tlp::NodeLinkDiagramComponent *nldc;
72  std::vector<tlp::Graph*> graphHierarchy;
73  std::vector<tlp::Camera> cameraHierarchy;
74  std::vector<tlp::node> nodeHierarchy;
75  std::vector<float> alphaHierarchy;
76 };
77 
78 
79 }
80 #endif
81 ///@endcond