![]() |
Tulip
4.6.0
Better Visualization Through Research
|
00001 /* 00002 * 00003 * This file is part of Tulip (www.tulip-software.org) 00004 * 00005 * Authors: David Auber and the Tulip development Team 00006 * from LaBRI, University of Bordeaux 00007 * 00008 * Tulip is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License 00010 * as published by the Free Software Foundation, either version 3 00011 * of the License, or (at your option) any later version. 00012 * 00013 * Tulip is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 * See the GNU General Public License for more details. 00017 * 00018 */ 00019 ///@cond DOXYGEN_HIDDEN 00020 00021 00022 #ifndef GLLINE_H 00023 #define GLLINE_H 00024 00025 #ifndef DOXYGEN_NOTFOR_DEVEL 00026 00027 #include <tulip/Color.h> 00028 #include <tulip/Coord.h> 00029 #include <tulip/tulipconf.h> 00030 #include <tulip/GlSimpleEntity.h> 00031 00032 namespace tlp { 00033 00034 /** 00035 * @ingroup OpenGL 00036 * \brief This is a general class to render an OpenGL laine 00037 * This class is use to render an OpenGl line 00038 */ 00039 class TLP_GL_SCOPE GlLine : public GlSimpleEntity { 00040 public: 00041 /** 00042 * Enpty constructor 00043 */ 00044 GlLine():width(1.0),factor(1),pattern(0) {} 00045 /** 00046 * Constructor with a list of coord and a list of color 00047 */ 00048 GlLine(const std::vector<Coord> &points, 00049 const std::vector<Color> &colors); 00050 00051 virtual ~GlLine(); 00052 00053 /** 00054 * Render the line 00055 */ 00056 void draw(float lod,Camera *camera); 00057 00058 /** 00059 * Change number of points 00060 */ 00061 virtual void resizePoints(const unsigned int nbPoints); 00062 /** 00063 * Change number of colors 00064 */ 00065 virtual void resizeColors(const unsigned int nbColors); 00066 00067 virtual const Coord& point(const unsigned int i) const; 00068 /** 00069 * Return the coord of point with given id 00070 */ 00071 virtual Coord& point(const unsigned int i); 00072 /** 00073 * Add a new point with given coord and given color 00074 */ 00075 virtual void addPoint(const Coord& point, const Color& color); 00076 00077 /** 00078 * return the ith color used for draw the line 00079 */ 00080 virtual const Color& color(const unsigned int i) const; 00081 /** 00082 * return the ith color used for draw the line 00083 */ 00084 virtual Color& color(const unsigned int i); 00085 /** 00086 * Set line width 00087 */ 00088 virtual void setLineWidth(float width); 00089 /** 00090 * Set the style of the line (documentation can be found in OpenGL manuel of fuction glLineStipple) 00091 */ 00092 virtual void setLineStipple(unsigned char factor,unsigned int pattern); 00093 00094 /** 00095 * Translate entity 00096 */ 00097 virtual void translate(const Coord& vec); 00098 00099 /** 00100 * Function to export data in outString (in XML format) 00101 */ 00102 virtual void getXML(std::string &outString); 00103 00104 /** 00105 * Function to set data with inString (in XML format) 00106 */ 00107 virtual void setWithXML(const std::string &inString, unsigned int ¤tPosition); 00108 00109 protected: 00110 std::vector<Coord> _points; 00111 std::vector<Color> _colors; 00112 float width; 00113 unsigned char factor; 00114 unsigned int pattern; 00115 }; 00116 00117 } 00118 00119 #endif // DOXYGEN_NOTFOR_DEVEL 00120 00121 #endif 00122 ///@endcond