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