Tulip  4.3.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
GlOverviewGraphicsItem.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 #ifndef GLOVERVIEWGRAPHICSITEM_H
22 #define GLOVERVIEWGRAPHICSITEM_H
23 
24 #include <tulip/tulipconf.h>
25 #include <tulip/Camera.h>
26 
27 #include <QGraphicsPixmapItem>
28 
29 #include <set>
30 
31 class QGLFramebufferObject;
32 
33 namespace tlp {
34 
35 class GlMainView;
36 class GlScene;
37 
38 class TLP_QT_SCOPE GlOverviewGraphicsItem : public QObject, public QGraphicsRectItem {
39 
40  Q_OBJECT
41 
42 public:
43 
44  GlOverviewGraphicsItem(GlMainView *view,GlScene &scene);
45  ~GlOverviewGraphicsItem();
46 
47  void setSize(unsigned int width, unsigned int height);
48  inline unsigned int getWidth() {
49  return width;
50  }
51  inline unsigned int getHeight() {
52  return height;
53  }
54 
55  void setLayerVisible(const std::string &name,bool visible);
56 
57 public slots :
58 
59  void draw(bool generatePixmap);
60 
61 private :
62 
63  void mousePressEvent(QGraphicsSceneMouseEvent* event);
64  void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
65  void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
66  void setScenePosition(QPointF pos);
67 
68 
69  GlMainView *view;
70  GlScene &baseScene;
71  unsigned int width, height;
72  QGLFramebufferObject *glFrameBuffer;
73 
74  QGraphicsPixmapItem overview;
75  QGraphicsLineItem line[4];
76  QGraphicsPolygonItem poly[4];
77 
78  bool mouseClicked;
79 
80  std::set<std::string> _hiddenLayers;
81 
82  static std::map<std::pair<int,int>,QGLFramebufferObject*> framebufferObjects;
83 
84  std::vector<Camera> _oldCameras;
85 
86 };
87 
88 }
89 
90 #endif // GLOVERVIEWGRAPHICSITEM_H
91 ///@endcond