Tulip  4.0.0
Better Visualization Through Research
 All Classes Files Functions Variables Enumerations Enumerator Properties Groups Pages
CaptionItem.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 CAPTIONITEM_H
22 #define CAPTIONITEM_H
23 
24 #include <QtCore/QObject>
25 
26 #include <tulip/View.h>
27 #include <tulip/CaptionGraphicsItem.h>
28 #include <tulip/DoubleProperty.h>
29 #include <tulip/ColorProperty.h>
30 #include <tulip/SizeProperty.h>
31 
32 namespace tlp {
33 
34 class CaptionItem : public QObject, public Observable {
35 
36  Q_OBJECT
37 
38 public:
39 
40  enum CaptionType {
41  NodesColorCaption=1,
42  NodesSizeCaption=2,
43  EdgesColorCaption=3,
44  EdgesSizeCaption=4
45  };
46 
47  CaptionItem(View *view);
48  ~CaptionItem();
49 
50  void create(CaptionType captionType);
51 
52  void initCaption();
53 
54  void generateColorCaption(CaptionType captionType);
55 
56  void generateSizeCaption(CaptionType captionType);
57 
58  CaptionGraphicsBackgroundItem *captionGraphicsItem();
59 
60  void treatEvent(const Event &ev);
61 
62 signals :
63 
64  void filtering(bool);
65 
66 public slots :
67 
68  void removeObservation(bool);
69 
70  void applyNewFilter(float begin,float end);
71  void selectedPropertyChanged(std::string propertyName);
72 
73 private :
74 
75  void clearObservers();
76 
77  void generateGradients(const std::vector<std::pair <double,Color> > &metricToColorFiltered, QGradient &activeGradient, QGradient &hideGradient);
78 
79  View *view;
80 
81  CaptionType _captionType;
82  CaptionGraphicsItem *_captionGraphicsItem;
83 
84  Graph *_graph;
85  DoubleProperty *_metricProperty;
86  ColorProperty *_colorProperty;
87  SizeProperty *_sizeProperty;
88  ColorProperty *_backupColorProperty;
89  ColorProperty *_backupBorderColorProperty;
90 };
91 
92 }
93 
94 #endif // CAPTIONITEM_H
95 ///@endcond