Tulip  4.10.0
Better Visualization Through Research
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  void addRemoveItemToSelection(bool pushGraph = true, bool forceSelect = false);
74  void addItemToSelection();
75  void selectItem();
76  void deleteItem();
77  void editColor();
78  void editLabel();
79  void editShape();
80  void editSize();
81  void goInsideItem();
82  void ungroupItem();
83  void setZOrdering(bool);
84  void showGridControl();
85  void fillContextMenu(QMenu *menu,const QPointF &point);
86  void displayToolTips(bool display);
87  void addRemoveInNodesToSelection(bool pushGraph = true, bool forceSelect = false);
88  void addRemoveOutNodesToSelection(bool pushGraph = true, bool forceSelect = false);
89  void addRemoveInEdgesToSelection(bool pushGraph = true, bool forceSelect = false);
90  void addRemoveOutEdgesToSelection(bool pushGraph = true, bool forceSelect = false);
91  void addRemoveNodeAndAllNeighbourNodesAndEdges(bool forceSelect = false);
92  void addRemoveExtremitiesToSelection(bool pushGraph = true, bool forceSelect = false);
93  void addRemoveEdgeAndExtremitiesToSelection(bool forceSelect = false);
94  void addInNodesToSelection(bool pushGraph = true);
95  void addOutNodesToSelection(bool pushGraph = true);
96  void addInEdgesToSelection(bool pushGraph = true);
97  void addOutEdgesToSelection(bool pushGraph = true);
98  void addNodeAndAllNeighbourNodesAndEdges();
99  void addExtremitiesToSelection(bool pushGraph = true);
100  void addEdgeAndExtremitiesToSelection();
101 
102 protected:
103  bool isNode;
104  unsigned int itemId;
105 
106  void graphChanged(tlp::Graph *);
107 
108  void createScene(Graph *graph,DataSet dataSet);
109  DataSet sceneData() const;
110  void loadGraphOnScene(Graph *graph);
111  void useHulls(bool hasHulls);
112  bool hasHulls() const;
113  void setupWidget();
114  bool eventFilter(QObject *,QEvent *e);
115  void editValue(PropertyInterface* pi);
116 };
117 }
118 
119 #endif /* NODELINKDIAGRAMCOMPONENT_H_ */
120 
121 
122 
123 
124 
125 
126 ///@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:172
#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