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