Tulip  5.4.0
Large graphs analysis and drawing
GlConvexGraphHull.h
1 /*
2  *
3  * This file is part of Tulip (http://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 GLCONVEXGRAPHHULL_H_
22 #define GLCONVEXGRAPHHULL_H_
23 
24 #include <tulip/Color.h>
25 #include <tulip/tulipconf.h>
26 
27 namespace tlp {
28 
29 class GlComposite;
30 class GlSimpleEntity;
31 class Camera;
32 class Graph;
33 class LayoutProperty;
34 class SizeProperty;
35 class DoubleProperty;
36 class GlComplexPolygon;
37 
38 /**
39  * @brief This class draws a convex hull around a graph.
40  *
41  * Given a graph, this class computes the various control points of a convex hull that embraces the
42  * nodes and edges present into the graph.
43  * If this entity is translated using the translate method, every element of the linked graph will
44  * be translated as well.
45  *
46  * @warning The graph or any of the properties linked to a GlConvexGraphHull should never be deleted
47  * before the entity. Such a thing should be
48  * reported to the user in debug mode, raising an assertion.
49  */
50 class TLP_GL_SCOPE GlConvexGraphHull {
51 public:
52  /**
53  * @brief ...
54  *
55  * @param parent ...
56  * @param name ...
57  * @param fcolor The color used to fill the hull.
58  * @param graph The graph whose elements should be inside the hull.
59  * @param layout The property used to layout the elements in the graph.
60  * @param size The property defining the graph's elements' sizes.
61  * @param rotation The property defining the graph's elements' rotation.
62  **/
63  GlConvexGraphHull(GlComposite *parent, const std::string &name, const tlp::Color &fcolor,
64  Graph *graph, LayoutProperty *layout, SizeProperty *size,
65  DoubleProperty *rotation);
66 
67  ~GlConvexGraphHull();
68 
69  /**
70  * Recomputes the whole Hull
71  */
72  void updateHull(LayoutProperty *layout = nullptr, SizeProperty *size = nullptr,
73  DoubleProperty *rotation = nullptr);
74 
75  void setVisible(bool visible);
76  bool isVisible();
77 
78 private:
79  GlComposite *_parent;
80  std::string _name;
81  Color _fcolor;
82  GlComplexPolygon *_polygon;
83  Graph *graph;
84  LayoutProperty *_layout;
85  SizeProperty *_size;
86  DoubleProperty *_rotation;
87  static int bezierValue;
88 };
89 } // namespace tlp
90 
91 #endif /* GLCONVEXGRAPHHULL_H_ */
92 ///@endcond