Tulip  4.6.0
Better Visualization Through Research
library/tulip-gui/include/tulip/MouseInteractors.h
00001 /*
00002  *
00003  * This file is part of Tulip (www.tulip-software.org)
00004  *
00005  * Authors: David Auber and the Tulip development Team
00006  * from LaBRI, University of Bordeaux
00007  *
00008  * Tulip is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU Lesser General Public License
00010  * as published by the Free Software Foundation, either version 3
00011  * of the License, or (at your option) any later version.
00012  *
00013  * Tulip is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  * See the GNU General Public License for more details.
00017  *
00018  */
00019 ///@cond DOXYGEN_HIDDEN
00020 
00021 #ifndef MOUSEOBJECT_H
00022 #define MOUSEOBJECT_H
00023 
00024 #include <tulip/InteractorComposite.h>
00025 #include <tulip/Camera.h>
00026 
00027 namespace tlp {
00028 
00029 class NodeLinkDiagramComponent;
00030 
00031 /** An interactor class allowing to zoom and pan using the mouse wheel.
00032  */
00033 class TLP_QT_SCOPE MousePanNZoomNavigator:public InteractorComponent {
00034 public:
00035   MousePanNZoomNavigator():cameraScaleFactor(1), isGesturing(false) {}
00036   ~MousePanNZoomNavigator() {}
00037   bool eventFilter(QObject *, QEvent *);
00038 protected:
00039   float cameraScaleFactor;
00040   bool isGesturing;
00041 };
00042 
00043 /** An interactor class used to delete a graph element on mouse left click
00044  */
00045 class TLP_QT_SCOPE MouseElementDeleter:public InteractorComponent {
00046 public:
00047   MouseElementDeleter() {}
00048   ~MouseElementDeleter() {}
00049   bool eventFilter(QObject *, QEvent *);
00050   void clear();
00051 };
00052 
00053 /** An interactor class to translate/rotate using keys or mouse movements,
00054     or to zoom and pan using the mouse wheel or
00055  */
00056 class TLP_QT_SCOPE MouseNKeysNavigator: public MousePanNZoomNavigator {
00057 private:
00058   InteractorComponent *currentSpecInteractorComponent;
00059 
00060   QCursor oldCursor;
00061 public:
00062   MouseNKeysNavigator() : currentSpecInteractorComponent(NULL), nldc(NULL) {}
00063   ~MouseNKeysNavigator() {}
00064   bool eventFilter(QObject *, QEvent *);
00065   void clear();
00066   void viewChanged(tlp::View *view);
00067 
00068 private :
00069 
00070   // member below are to manage meta node navigation
00071   tlp::NodeLinkDiagramComponent *nldc;
00072   std::vector<tlp::Graph*> graphHierarchy;
00073   std::vector<tlp::Camera> cameraHierarchy;
00074   std::vector<tlp::node> nodeHierarchy;
00075   std::vector<float> alphaHierarchy;
00076 };
00077 
00078 
00079 }
00080 #endif
00081 ///@endcond
 All Classes Files Functions Variables Enumerations Enumerator Properties