Tulip  4.3.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
CaptionGraphicsItem.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 CAPTIONGRAPHICSITEM_H
22 #define CAPTIONGRAPHICSITEM_H
23 
24 #include <QObject>
25 
26 #include <vector>
27 #include <string>
28 
29 class QGradient;
30 class QGraphicsProxyWidget;
31 class QGraphicsSimpleTextItem;
32 class QPushButton;
33 
34 namespace tlp {
35 
36 class GlMainView;
37 class View;
38 class CaptionGraphicsBackgroundItem;
39 
40 class CaptionGraphicsItem : public QObject {
41 
42  Q_OBJECT
43 
44 public:
45 
46  CaptionGraphicsItem(View *view);
47  ~CaptionGraphicsItem();
48 
49  void setType(unsigned int type);
50 
51  void loadConfiguration();
52 
53  void generateColorCaption(const QGradient &activeGradient, const QGradient &hideGradient, const std::string &propertyName, double minValue, double maxValue);
54 
55  void generateSizeCaption(const std::vector< std::pair <double,float> > &metricToSizeFilteredList,const std::string &propertyName, double minValue, double maxValue);
56 
57  CaptionGraphicsBackgroundItem *getCaptionItem() const {
58  return _rondedRectItem;
59  }
60 
61  std::string usedProperty();
62 
63 signals :
64 
65  void filterChanged(float begin, float end);
66  void selectedPropertyChanged(std::string propertyName);
67 
68 protected slots :
69 
70  void filterChangedSlot(float begin, float end);
71  void selectPropertyButtonClicked();
72  void propertySelectedSlot();
73 
74 private :
75  QString wrappedPropName(const QString& originalName) const;
76 
77  void constructConfigWidget();
78 
79  View *_view;
80 
81  CaptionGraphicsBackgroundItem *_rondedRectItem;
82 
83  QGraphicsProxyWidget *_confPropertySelectionItem;
84  QGraphicsSimpleTextItem *_nodesEdgesTextItem;
85  QPushButton* _confPropertySelectionWidget;
86 };
87 
88 }
89 
90 #endif // CAPTIONGRAPHICSITEM_H
91 ///@endcond