Tulip 5.7.1
Large graphs analysis and drawing
Loading...
Searching...
No Matches
GlConvexGraphHull.h
1/*
2 *
3 * This file is part of Tulip (https://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#include <tulip/GlComposite.h>
27
28namespace tlp {
29
30class Graph;
31class LayoutProperty;
32class SizeProperty;
33class DoubleProperty;
34class GlComplexPolygon;
35
36/**
37 * @brief This class is a specific container for GlConvexGraphHull
38 * it allows to indicates if the textures of the hulls have to be applied
39 * or not
40 */
41class TLP_GL_SCOPE GlConvexGraphHullsComposite : public GlComposite {
42 bool textured;
43
44public:
45 GlConvexGraphHullsComposite() : textured(false) {}
46
47 bool hullsTextureActivation() {
48 return textured;
49 }
50 void setHullsTextureActivation(bool);
51};
52
53/**
54 * @brief This class draws a convex hull around a graph.
55 *
56 * Given a graph, this class computes the various control points of a convex hull that embraces the
57 * nodes and edges present into the graph.
58 * If this entity is translated using the translate method, every element of the linked graph will
59 * be translated as well.
60 *
61 * @warning The graph or any of the properties linked to a GlConvexGraphHull should never be deleted
62 * before the entity. Such a thing should be
63 * reported to the user in debug mode, raising an assertion.
64 */
65class TLP_GL_SCOPE GlConvexGraphHull {
66public:
67 /**
68 * @brief ...
69 *
70 * @param parent ...
71 * @param name ...
72 * @param fcolor The color used to fill the hull.
73 * @param graph The graph whose elements should be inside the hull.
74 * @param layout The property used to layout the elements in the graph.
75 * @param size The property defining the graph's elements' sizes.
76 * @param rotation The property defining the graph's elements' rotation.
77 **/
78 GlConvexGraphHull(GlConvexGraphHullsComposite *parent, const std::string &name,
79 const tlp::Color &fcolor, const std::string &texName, Graph *graph,
80 LayoutProperty *layout, SizeProperty *size, DoubleProperty *rotation);
81
82 ~GlConvexGraphHull();
83
84 /**
85 * Recomputes the whole Hull
86 */
87 void updateHull(LayoutProperty *layout = nullptr, SizeProperty *size = nullptr,
88 DoubleProperty *rotation = nullptr);
89
90 void setVisible(bool visible);
91 bool isVisible();
92 void setTextureZoom(float zoom);
93
94private:
95 GlConvexGraphHullsComposite *_parent;
96 std::string _name;
97 Color _fcolor;
98 std::string _tex;
99 GlComplexPolygon *_polygon;
100 Graph *graph;
101 LayoutProperty *_layout;
102 SizeProperty *_size;
103 DoubleProperty *_rotation;
104 static int bezierValue;
105};
106} // namespace tlp
107
108#endif /* GLCONVEXGRAPHHULL_H_ */
109///@endcond