Tulip  4.4.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 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();
74  void selectItem();
75  void deleteItem();
76  void editColor();
77  void editLabel();
78  void editShape();
79  void editSize();
80  void goInsideItem();
81  void ungroupItem();
82  void setZOrdering(bool);
83  void showGridControl();
84  void fillContextMenu(QMenu *menu,const QPointF &point);
85  void displayToolTips(bool display);
86 
87 protected:
88  bool isNode;
89  unsigned int itemId;
90 
91  void graphChanged(tlp::Graph *);
92 
93  void createScene(Graph *graph,DataSet dataSet);
94  DataSet sceneData() const;
95  void loadGraphOnScene(Graph *graph);
96  void useHulls(bool hasHulls);
97  bool hasHulls() const;
98  void setupWidget();
99  bool eventFilter(QObject *,QEvent *e);
100  void editValue(PropertyInterface* pi);
101 };
102 }
103 
104 #endif /* NODELINKDIAGRAMCOMPONENT_H_ */
105 
106 
107 
108 
109 
110 
111 ///@endcond