Tulip  5.7.4
Large graphs analysis and drawing
GlCurve.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 Tulip_GLCURVE_H
22 #define Tulip_GLCURVE_H
23 
24 #include <tulip/GlSimpleEntity.h>
25 
26 namespace tlp {
27 /** \brief This class is use to display an OpenGl curve
28  *
29  */
30 class TLP_GL_SCOPE GlCurve : public GlSimpleEntity {
31 public:
32  /**
33  * Basic constructor with vector of coord, begin/end color and begin/end size
34  */
35  GlCurve(const std::vector<tlp::Coord> &points, const Color &beginFColor, const Color &endFColor,
36  const float &beginSize = 0., const float &endSize = 0.);
37 
38  /**
39  * Basic constructor with number of points
40  */
41  GlCurve(const unsigned int nbPoints = 3u);
42  ~GlCurve() override;
43 
44  /**
45  * Draw the curve
46  */
47  void draw(float lod, Camera *camera) override;
48 
49  /**
50  * Set the texture of the curve (if you want texture)
51  */
52  void setTexture(const std::string &texture);
53 
54  /**
55  * Change the number of points
56  */
57  virtual void resizePoints(const unsigned int nbPoints);
58 
59  /**
60  * Return the ith coord
61  */
62  virtual const tlp::Coord &point(const unsigned int i) const;
63  /**
64  * Return the ith coord
65  */
66  virtual tlp::Coord &point(const unsigned int i);
67 
68  /**
69  * Translate entity
70  */
71  void translate(const Coord &mouvement) override;
72 
73  /**
74  * Function to export data in outString (in XML format)
75  */
76  void getXML(std::string &outString) override;
77 
78  /**
79  * Function to set data with inString (in XML format)
80  */
81  void setWithXML(const std::string &inString, unsigned int &currentPosition) override;
82 
83 protected:
84  std::vector<tlp::Coord> _points;
85  Color _beginFillColor;
86  Color _endFillColor;
87  float _beginSize;
88  float _endSize;
89  std::string texture;
90 };
91 } // namespace tlp
92 #endif
93 ///@endcond