Tulip  5.0.0
Large graphs analysis and drawing
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
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 #include <tulip/GlScene.h>
27 
28 namespace tlp {
29 class GlMainWidget;
30 class NodeLinkDiagramComponent;
31 
32 /** An interactor class allowing to zoom and pan using the mouse wheel.
33  */
34 class TLP_QT_SCOPE MousePanNZoomNavigator:public InteractorComponent {
35 public:
36  MousePanNZoomNavigator():cameraScaleFactor(1), isGesturing(false) {}
37  ~MousePanNZoomNavigator() {}
38  bool eventFilter(QObject *, QEvent *);
39 protected:
40  float cameraScaleFactor;
41  bool isGesturing;
42 };
43 
44 /** An interactor class used to delete a graph element on mouse left click
45  */
46 class TLP_QT_SCOPE MouseElementDeleter:public InteractorComponent {
47 public:
48  MouseElementDeleter() :glMainWidget(NULL) {}
49  ~MouseElementDeleter() {}
50  bool eventFilter(QObject *, QEvent *);
51  void clear();
52  virtual void delElement(tlp::Graph* graph, tlp::SelectedEntity& selectedEntity);
53 private:
54  GlMainWidget* glMainWidget;
55 };
56 
57 /** An interactor class to translate/rotate using keys or mouse movements,
58  or to zoom and pan using the mouse wheel or
59  */
60 class TLP_QT_SCOPE MouseNKeysNavigator: public MousePanNZoomNavigator {
61 private:
62  InteractorComponent *currentSpecInteractorComponent;
63 
64  QCursor oldCursor;
65 public:
66  MouseNKeysNavigator() : currentSpecInteractorComponent(NULL), nldc(NULL) {}
67  ~MouseNKeysNavigator() {}
68  bool eventFilter(QObject *, QEvent *);
69  void clear();
70  void viewChanged(tlp::View *view);
71 
72 private :
73 
74  // member below are to manage meta node navigation
75  tlp::NodeLinkDiagramComponent *nldc;
76  std::vector<tlp::Graph*> graphHierarchy;
77  std::vector<tlp::Camera> cameraHierarchy;
78  std::vector<tlp::node> nodeHierarchy;
79  std::vector<float> alphaHierarchy;
80 };
81 
82 
83 }
84 #endif
85 ///@endcond
View plugins provide a way to dynamically add to a Tulip plateform various ways to visualize a graph...
Definition: View.h:73
Structure to store selected entities.
Definition: GlScene.h:47