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