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