Tulip  5.2.1
Large graphs analysis and drawing
QtGlSceneZoomAndPanAnimator.h
1 /*
2  *
3  * This file is part of Tulip (http://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 
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
35  * GlMainWidget
36  * The algorithm used to perform this task is the one published in : Jarke J. van Wijk and Wim A.A.
37  * Nuij, "Smooth and efficient zooming and panning"
38  * For more details, the paper can be downloaded at the following url :
39  * www.win.tue.nl/~vanwijk/zoompan.pdf
40  */
41 class TLP_QT_SCOPE QtGlSceneZoomAndPanAnimator : public QObject, public GlSceneZoomAndPan {
42 
43  Q_OBJECT
44 
45 public:
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
51  * to be zoomed and panned.
52  * At the end of the animation, the viewport will be zoomed and centered on the
53  * content of that bounding box.
54  * \param optimalPath if true zooming and panning will be combined at each step of the animation,
55  * if false the scene will be zoomed out/in, panned then zoomed in/out
56  * \param layerName name of the layer zoom animation should be done on
57  * \param velocity animation speed parameter, adjust it according to your needs
58  * \param p zoom/pan trade-off parameter, adjust it according to your needs
59  */
60  QtGlSceneZoomAndPanAnimator(GlMainWidget *glWidget, const BoundingBox &boundingBox,
61  const double duration = 1000., const std::string &layerName = "Main",
62  const bool optimalPath = true, const double velocity = 1.1,
63  const double p = sqrt(1.6));
64 
65  /**
66  * Method to call to start the Zoom and Pan animation
67  */
68  void animateZoomAndPan();
69 
70 protected slots:
71 
72  virtual void zoomAndPanAnimStepSlot(int animationStep);
73 
74 protected:
75  GlMainWidget *glWidget;
76  double animationDurationMsec;
77 };
78 } // namespace tlp
79 
80 #endif /* QTGLSCENEZOOMANDPANANIMATOR_H_ */
A convenient class to perform Zoom and Pan animation on Tulip OpenGL scene.
A convenient class to perform a Zoom and Pan animation on a GlMainWidget.
This class represents the 3D bounding box of an object. It is mostly used to determine whether or not...
Definition: BoundingBox.h:66
This widget provide a simple system to visualize data/graph with OpenGL 3D engine.
Definition: GlMainWidget.h:66