Tulip  5.3.0
Large graphs analysis and drawing
CaptionGraphicsItem.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 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  CaptionGraphicsItem(View *view);
46  ~CaptionGraphicsItem() override;
47 
48  void setType(unsigned int type);
49 
50  void loadConfiguration();
51 
52  void generateColorCaption(const QGradient &activeGradient, const QGradient &hideGradient,
53  const std::string &propertyName, double minValue, double maxValue);
54 
55  void generateSizeCaption(const std::vector<std::pair<double, float>> &metricToSizeFilteredList,
56  const std::string &propertyName, double minValue, double maxValue);
57 
58  CaptionGraphicsBackgroundItem *getCaptionItem() const {
59  return _rondedRectItem;
60  }
61 
62  std::string usedProperty();
63 
64 signals:
65 
66  void filterChanged(float begin, float end);
67  void selectedPropertyChanged(std::string propertyName);
68 
69 protected slots:
70 
71  void filterChangedSlot(float begin, float end);
72  void selectPropertyButtonClicked();
73  void propertySelectedSlot();
74 
75 private:
76  QString wrappedPropName(const QString &originalName) const;
77 
78  void constructConfigWidget();
79 
80  View *_view;
81 
82  CaptionGraphicsBackgroundItem *_rondedRectItem;
83 
84  QGraphicsProxyWidget *_confPropertySelectionItem;
85  QGraphicsSimpleTextItem *_nodesEdgesTextItem;
86  QPushButton *_confPropertySelectionWidget;
87 };
88 } // namespace tlp
89 
90 #endif // CAPTIONGRAPHICSITEM_H
91 ///@endcond