Tulip  5.1.0
Large graphs analysis and drawing
GlLines.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 _TLP_GLLINES
22 #define _TLP_GLLINES
23 #ifndef DOXYGEN_NOTFOR_DEVEL
24 #include <vector>
25 
26 #include <tulip/OpenGlIncludes.h>
27 
28 #include <tulip/Coord.h>
29 #include <tulip/Color.h>
30 
31 #include <tulip/tulipconf.h>
32 
33 namespace tlp {
34 
35 struct TLP_GL_SCOPE GlLines {
36  //Curves types: linear, bezier, spline order 3, spline order 4
37  enum InterpolationMethod {LINEAR=0, BEZIER, SPLINE3, SPLINE4};
38  enum StippleType {TLP_PLAIN=0, TLP_DOT, TLP_DASHED, TLP_ALTERNATE};
39 
40  static void glDrawPoint(const Coord &p);
41 
42  static void glDrawLine(const Coord &startPoint,const Coord &endPoint,const double width,const unsigned int stippleType,
43  const Color &startColor,const Color &endColor,const bool arrow=false,const double arrowWidth=1,
44  const double arrowHeight=1);
45  static void glDrawCurve(const Coord &startPoint,const std::vector<Coord> &bends,const Coord &endPoint,const double width,
46  const unsigned int stippleType,const Color &startColor,const Color &endColor,const bool arrow=false,
47  const double arrowWidth=1,const double arrowHeight=1);
48  static void glDrawBezierCurve(const Coord &startPoint,const std::vector<Coord> &bends,const Coord &endPoint,unsigned int steps,
49  const double width,const unsigned int stippleType,const Color &startColor,const Color &endColor,
50  const bool arrow=false,const double arrowWidth=1,const double arrowHeight=1);
51  static void glDrawSplineCurve(const Coord &startPoint,const std::vector<Coord> &bends,const Coord &endPoint,unsigned int steps,
52  const double width,const unsigned int stippleType,const Color &startColor,const Color &endColor,
53  const bool arrow=false,const double arrowWidth=1,const double arrowHeight=1);
54  static void glDrawSpline2Curve(const Coord &startPoint,const std::vector<Coord> &bends,const Coord &endPoint,unsigned int steps,
55  const double width,const unsigned int stippleType,const Color &startColor,const Color &endColor,
56  const bool arrow=false,const double arrowWidth=1,const double arrowHeight=1);
57 
58 private:
59  static void glDisableLineStipple(unsigned int stippleType);
60  static void glEnableLineStipple(unsigned int stippleType);
61  static GLfloat *buildCurvePoints(const Coord &startPoint,const std::vector<Coord> &bends,const Coord &endPoint);
62  static GLfloat *buildCurvePoints(const Coord &p0,const Coord &p1,const Coord &p2,const Coord &p3);
63 };
64 
65 }
66 #endif //DOXYGEN_NOTFOR_DEVEL
67 #endif
68 ///@endcond