Tulip  5.1.0
Large graphs analysis and drawing
GlOverviewGraphicsItem.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 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef GLOVERVIEWGRAPHICSITEM_H
22 #define GLOVERVIEWGRAPHICSITEM_H
23 
24 #include <tulip/tulipconf.h>
25 #include <tulip/Camera.h>
26 #include <tulip/Color.h>
27 
28 #include <QGraphicsPixmapItem>
29 #include <QGraphicsPathItem>
30 
31 #include <set>
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 setFrameColor(const Color &color) {
56  _frameColor = color;
57  }
58 
59  void setFrameWidth(int width) {
60  _frameWidth = width;
61  }
62 
63  void setLayerVisible(const std::string &name,bool visible);
64 
65 public slots :
66 
67  void draw(bool generatePixmap);
68 
69 private :
70 
71  void mousePressEvent(QGraphicsSceneMouseEvent* event);
72  void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
73  void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
74  void setScenePosition(QPointF pos);
75 
76  GlMainView *view;
77  GlScene &baseScene;
78  unsigned int width, height;
79 
80  QGraphicsPixmapItem overview;
81  QGraphicsPathItem overviewBorder;
82  QGraphicsLineItem line[8];
83  QGraphicsPolygonItem poly[4];
84 
85  bool mouseClicked;
86 
87  std::set<std::string> _hiddenLayers;
88 
89  std::vector<Camera> _oldCameras;
90 
91  Color _frameColor;
92  int _frameWidth;
93 
94 };
95 
96 }
97 
98 #endif // GLOVERVIEWGRAPHICSITEM_H
99 ///@endcond