Tulip  4.0.0
Better Visualization Through Research
 All Classes Files Functions Variables Enumerations Enumerator Properties Groups Pages
QtGlSceneZoomAndPanAnimator.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 
22 #ifndef QTGLSCENEZOOMANDPANANIMATOR_H_
23 #define QTGLSCENEZOOMANDPANANIMATOR_H_
24 
25 #include <QtCore/QObject>
26 
27 #include <tulip/GlMainWidget.h>
28 
29 #include "tulip/GlSceneZoomAndPan.h"
30 
31 namespace tlp {
32 
33 /**
34  * \brief A convenient class to perform a Zoom and Pan animation on a GlMainWidget
35  *
36  * This class allows to perform a Zoom and Pan animation on the Tulip OpenGL scene associated with a GlMainWidget
37  * The algorithm used to perform this task is the one published in : Jarke J. van Wijk and Wim A.A. Nuij, "Smooth and efficient zooming and panning"
38  * For more details, the paper can be downloaded at the following url : www.win.tue.nl/~vanwijk/zoompan.pdf
39  */
40 class TLP_QT_SCOPE QtGlSceneZoomAndPanAnimator : public QObject, public GlSceneZoomAndPan {
41 
42  Q_OBJECT
43 
44 public :
45 
46  /**
47  * QtGlSceneZoomAndPanAnimator constructor
48  *
49  * \param glWidget The Tulip OpenGL widget on which to perform the animation
50  * * \param boundingBox the bounding box in scene coordinates on which the Tulip OpenGL scene has to be zoomed and panned.
51  * At the end of the animation, the viewport will be zoomed and centered on the content of that bounding box.
52  * \param optimalPath if true zooming and panning will be combined at each step of the animation, if false the scene will be zoomed out/in, panned then zoomed in/out
53  * \param layerName name of the layer zoom animation should be done on
54  * \param velocity animation speed parameter, adjust it according to your needs
55  * \param p zoom/pan trade-off parameter, adjust it according to your needs
56  */
57  QtGlSceneZoomAndPanAnimator(GlMainWidget *glWidget, const BoundingBox &boundingBox, const std::string &layerName = "Main", const bool optimalPath = true, const double velocity = 1.1, const double p = sqrt(1.6));
58 
59  /**
60  * Method to call to start the Zoom and Pan animation
61  */
62  void animateZoomAndPan();
63 
64 protected slots :
65 
66  virtual void zoomAndPanAnimStepSlot(int animationStep);
67 
68 protected :
69 
70  GlMainWidget *glWidget;
71  double animationDurationMsec;
72 
73 };
74 
75 }
76 
77 
78 #endif /* QTGLSCENEZOOMANDPANANIMATOR_H_ */
79 ///@endcond