Tulip  4.3.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
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 1 and Inria Bordeaux - Sud Ouest
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 class QDialog;
28 
29 namespace tlp {
30 class GlGrid;
31 class GlCompositeHierarchyManager;
32 
33 class TLP_QT_SCOPE NodeLinkDiagramComponent: public tlp::GlMainView {
34  Q_OBJECT
35 
36  tlp::GlGrid* _grid;
37  QDialog* _gridOptions;
38  GlCompositeHierarchyManager* manager;
39  bool _hasHulls;
40 
41  void registerTriggers();
42  void updateGrid();
43 
44  bool _tooltips;
45 
46 public:
47  static const std::string viewName;
48  PLUGININFORMATIONS(NodeLinkDiagramComponent::viewName, "Tulip Team", "16/04/2008",
49  "The Node Link Diagram view is the standard representation of relational data, where entities are represented as nodes, and their relation as edges.\n"
50  "This view allows you to change the glyph used to represent nodes (e.g. square, round, donut), as well as the shape of the arrows indicating the direction of the relationship.",
51  "1.0", "relational")
52 
53  NodeLinkDiagramComponent(const tlp::PluginContext* context = NULL);
54  std::string icon() const {
55  return ":/tulip/gui/icons/32/node_link_diagram_view.png";
56  }
57  void setState(const tlp::DataSet &);
58  tlp::DataSet state() const;
59 
60 public slots:
61  void draw();
62  void requestChangeGraph(Graph *graph);
63  const Camera& goInsideItem(node meta);
64 
65 protected slots:
66  void addRemoveItemToSelection();
67  void selectItem();
68  void deleteItem();
69  void goInsideItem();
70  void ungroupItem();
71  void setZOrdering(bool);
72  void showGridControl();
73  void fillContextMenu(QMenu *menu,const QPointF &point);
74  void displayToolTips(bool display);
75 
76 protected:
77  bool isNode;
78  unsigned int itemId;
79 
80  void graphChanged(tlp::Graph *);
81 
82  void createScene(Graph *graph,DataSet dataSet);
83  DataSet sceneData() const;
84  void loadGraphOnScene(Graph *graph);
85  void useHulls(bool hasHulls);
86  bool hasHulls() const;
87  void setupWidget();
88  bool eventFilter(QObject *,QEvent *e);
89 };
90 }
91 
92 #endif /* NODELINKDIAGRAMCOMPONENT_H_ */
93 
94 
95 
96 
97 
98 
99 ///@endcond