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