Tulip 5.7.1
Large graphs analysis and drawing
Loading...
Searching...
No Matches
GraphPropertiesSelectionWidget.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 GRAPHPROPERTYSELECTIONWIDGET_H_
22#define GRAPHPROPERTYSELECTIONWIDGET_H_
23
24#include "StringsListSelectionWidget.h"
25
26namespace tlp {
27
28class Graph;
29/** \brief A widget which allows the user to select a subset of graph properties
30 *
31 * This widget allows the user to select a subset of graph properties. The properties
32 * to select can be filtered according to their datatypes.
33 */
34class TLP_QT_SCOPE GraphPropertiesSelectionWidget : public StringsListSelectionWidget {
35
36public:
37 /**
38 * Default Constructor (useful for qt designer)
39 */
40 GraphPropertiesSelectionWidget(QWidget *parent = nullptr,
41 const StringsListSelectionWidget::ListType &listType =
42 StringsListSelectionWidget::SIMPLE_LIST,
43 const unsigned int maxNbSelectedProperties = 0);
44
45 /**
46 * Constructor which creates a GraphPropertiesSelectionWidget for a given graph
47 *
48 * \param graph The graph on which we want to select properties
49 * \param propertiesType To select properties with particular datatypes, fill a vector of string
50 * with the wanted datatypes name and passed it as parameter of this constructor. The datatypes
51 * name must be the same as those returned by the getTypename method of the PropertyInterface
52 * class (e.g. "int", "double", "string"). If the vector is empty, there is no restriction on
53 * property datatypes.
54 * \param includeViewProperties If true, the view properties (e.g. "viewLabel", "viewMetric")
55 * will be selectable
56 */
57 GraphPropertiesSelectionWidget(
58 Graph *graph, QWidget *parent = nullptr,
59 const StringsListSelectionWidget::ListType &listType =
60 StringsListSelectionWidget::SIMPLE_LIST,
61 const unsigned int maxNbSelectedProperties = 0,
62 const std::vector<std::string> &propertiesTypes = std::vector<std::string>(),
63 const bool includeViewProperties = false);
64
65 /**
66 * Method to set the widget parameters
67 *
68 * \param graph The graph on which we want to select properties
69 * \param propertiesType To select properties with particular datatypes, fill a vector of string
70 * with the wanted datatypes name and passed it as parameter of this constructor. The datatypes
71 * name must be the same as those returned by the getTypename method of the PropertyInterface
72 * class (e.g. "int", "double", "string"). If the vector is empty, there is no restriction on
73 * property datatypes.
74 * \param includeViewProperties If true, the view properties (e.g. "viewLabel", "viewMetric") will
75 * be selectable
76 */
77 void
78 setWidgetParameters(Graph *graph,
79 const std::vector<std::string> &propertiesTypes = std::vector<std::string>(),
80 const bool includeViewProperties = false);
81
82 /**
83 * Method to set the input graph properties list
84 * If there is datatypes restriction, the types of properties are checked before inserting them in
85 * the input list
86 * \param inputPropertiesList A vector containing input properties names
87 */
88 void setInputPropertiesList(const std::vector<std::string> &inputPropertiesList);
89
90 /**
91 * Method to set the output graph properties list
92 * If there is datatypes restriction, the types of properties are checked before inserting them in
93 * the output list
94 * \param outputPropertiesList A vector containing output properties names
95 */
96 void setOutputPropertiesList(const std::vector<std::string> &outputPropertiesList);
97
98 /**
99 * Method which returns the names of the graph properties selected by the user
100 */
101 std::vector<std::string> getSelectedProperties() const;
102
103 /**
104 * Method which clears the content of the input list and the output list
105 */
106 void clearLists();
107
108private:
109 void initWidget();
110 bool propertySelectable(const std::string &propertyName);
111
112 Graph *graph;
113 std::vector<std::string> propertiesTypes;
114 bool includeViewProperties;
115};
116} // namespace tlp
117
118#endif /* GRAPHPROPERTYSELECTIONWIDGET_H_ */
119///@endcond