Tulip 5.7.1
Large graphs analysis and drawing
Loading...
Searching...
No Matches
NodeLinkDiagramComponent.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 _Tulip_NODELINKDIAGRAMCOMPONENT_H
22#define _Tulip_NODELINKDIAGRAMCOMPONENT_H
23
24#include <tulip/GlMainView.h>
25#include <tulip/Camera.h>
26
27namespace Ui {
28class GridOptionsWidget;
29}
30
31class QDialog;
32class QAction;
33
34namespace tlp {
35class GlGrid;
36class GlCompositeHierarchyManager;
37class GlGraphRenderingParameters;
38class PropertyInterface;
39class StringProperty;
40
41class TLP_QT_SCOPE NodeLinkDiagramComponent : public tlp::GlMainView {
42 Q_OBJECT
43
44 GlGrid *_grid;
45 QDialog *_gridOptions;
46 GlCompositeHierarchyManager *manager;
47 bool _hasHulls;
48
49 void registerTriggers();
50 void updateGrid();
51
52 Ui::GridOptionsWidget *grid_ui;
53
54public:
55 static const std::string viewName;
56 PLUGININFORMATION(NodeLinkDiagramComponent::viewName, "Tulip Team", "16/04/2008",
57 "The Node Link Diagram view is the standard representation of relational data, "
58 "where entities are represented as nodes, and their relation as edges.<br>"
59 "This view allows you to change the glyph used to represent nodes (e.g. "
60 "square, round, cross, ...), as well as the shape of the arrows indicating the "
61 "direction of the relationship.",
62 "1.0", "relational")
63
64 NodeLinkDiagramComponent(const tlp::PluginContext *context = nullptr);
65 ~NodeLinkDiagramComponent() override;
66 std::string icon() const override {
67 return ":/tulip/gui/icons/32/node_link_diagram_view.png";
68 }
69 void setState(const tlp::DataSet &) override;
70 tlp::DataSet state() const override;
71 // default initialization of scene rendering parameters
72 // can be used by other view
73 static void initRenderingParameters(tlp::GlGraphRenderingParameters *);
74
75public slots:
76 void draw() override;
77 void requestChangeGraph(Graph *graph);
78 const Camera &goInsideItem(node meta);
79
80protected slots:
81
82 void deleteItem();
83 void editColor();
84 void editLabel();
85 void editShape();
86 void editSize();
87 void goInsideItem();
88 void ungroupItem();
89 void setZOrdering(bool);
90 void showGridControl();
91 void fillContextMenu(QMenu *menu, const QPointF &point) override;
92
93 void addRemoveItemToSelection(bool pushGraph = true, bool toggleSelection = true,
94 bool selectValue = false, bool resetSelection = false);
95 void addRemoveInNodesToSelection(bool pushGraph = true, bool toggleSelection = true,
96 bool selectValue = false, bool resetSelection = false);
97 void addRemoveOutNodesToSelection(bool pushGraph = true, bool toggleSelection = true,
98 bool selectValue = false, bool resetSelection = false);
99 void addRemoveInEdgesToSelection(bool pushGraph = true, bool toggleSelection = true,
100 bool selectValue = false, bool resetSelection = false);
101 void addRemoveOutEdgesToSelection(bool pushGraph = true, bool toggleSelection = true,
102 bool selectValue = false, bool resetSelection = false);
103 void addRemoveNodeAndAllNeighbourNodesAndEdges(bool toggleSelection = true,
104 bool selectValue = false,
105 bool resetSelection = false);
106 void addRemoveExtremitiesToSelection(bool pushGraph = true, bool toggleSelection = true,
107 bool selectValue = false, bool resetSelection = false);
108 void addRemoveEdgeAndExtremitiesToSelection(bool toggleSelection = true, bool selectValue = false,
109 bool resetSelection = false);
110
111 void selectItem();
112 void selectInNodes(bool pushGraph = true);
113 void selectOutNodes(bool pushGraph = true);
114 void selectInEdges(bool pushGraph = true);
115 void selectOutEdges(bool pushGraph = true);
116 void selectNodeAndAllNeighbourNodesAndEdges();
117 void selectExtremities(bool pushGraph = true);
118 void selectEdgeAndExtremities();
119
120 void addItemToSelection();
121 void addInNodesToSelection(bool pushGraph = true);
122 void addOutNodesToSelection(bool pushGraph = true);
123 void addInEdgesToSelection(bool pushGraph = true);
124 void addOutEdgesToSelection(bool pushGraph = true);
125 void addNodeAndAllNeighbourNodesAndEdgesToSelection();
126 void addExtremitiesToSelection(bool pushGraph = true);
127 void addEdgeAndExtremitiesToSelection();
128
129 void removeItemFromSelection();
130 void removeInNodesFromSelection(bool pushGraph = true);
131 void removeOutNodesFromSelection(bool pushGraph = true);
132 void removeInEdgesFromSelection(bool pushGraph = true);
133 void removeOutEdgesFromSelection(bool pushGraph = true);
134 void removeNodeAndAllNeighbourNodesAndEdgesFromSelection();
135 void removeExtremitiesFromSelection(bool pushGraph = true);
136 void removeEdgeAndExtremitiesFromSelection();
137
138protected:
139 bool isNode;
140 unsigned int itemId;
141
142 void graphChanged(tlp::Graph *) override;
143
144 void createScene(Graph *graph, const DataSet &dataSet = DataSet());
145 DataSet sceneData() const;
146 void loadGraphOnScene(Graph *graph);
147 void useHulls(bool hasHulls);
148 bool hasHulls() const;
149 void editValue(PropertyInterface *pi);
150};
151} // namespace tlp
152
153#endif /* NODELINKDIAGRAMCOMPONENT_H_ */
154
155///@endcond
A container that can store data from any type.
Definition: DataSet.h:195
That class defines all the parameters used by GlGraphComposite to render a graph.
An abstract view that displays a GlMainWidget as its central widget.
Definition: GlMainView.h:68
#define PLUGININFORMATION(NAME, AUTHOR, DATE, INFO, RELEASE, GROUP)
Declare meta-information for a plugin This is an helper macro that defines every function related to ...
Definition: Plugin.h:233