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