Tulip  5.0.0
Large graphs analysis and drawing
Curves.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
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 CURVES_H
22 #define CURVES_H
23 #ifndef DOXYGEN_NOTFOR_DEVEL
24 
25 #if defined(_MSC_VER)
26 #include <Windows.h>
27 #endif
28 
29 #if defined(__APPLE__)
30 #include <OpenGL/gl.h>
31 #else
32 #include <GL/gl.h>
33 #endif
34 
35 #include <tulip/Coord.h>
36 #include <tulip/Color.h>
37 #include <tulip/tulipconf.h>
38 
39 #include <vector>
40 
41 namespace tlp {
42 
43 template<typename T, unsigned int N>
44 class Matrix;
45 //====================================================================
46 //return vertices, update startN and endN to prevent bad edge drawing
47 TLP_GL_SCOPE void computeCleanVertices(const std::vector<Coord> &bends,
48  const Coord &startPoint, const Coord &endPoint,
49  Coord &startN, Coord &endN,std::vector<Coord> &);
50 TLP_GL_SCOPE void polyLine(const std::vector<Coord> &,/* polyline vertices */
51  const Color &, /* start color */
52  const Color &); /* end color */
53 TLP_GL_SCOPE void polyQuad(const std::vector<Coord> &, /* polyline vertces */
54  const Color &, /* start color */
55  const Color &, /* end color */
56  const float, /* start size */
57  const float, /* end size */
58  const Coord &, /* normal to the begin of the curve */
59  const Coord &, /* normal to the end curve */
60  bool, /* if true : use start and end color to border lines, if false : use borderColor*/
61  const Color &, /* border color */
62  const std::string &textureName="", /* textureName */
63  const float outlineWidth=0);
64 TLP_GL_SCOPE void simpleQuad(const std::vector<Coord> &, /* quad vertces */
65  const Color &, /* start color */
66  const Color &, /* end color */
67  const float, /* start size */
68  const float, /* end size */
69  const Coord &, /* normal to the begin of the curve */
70  const Coord &, /* normal to the end curve */
71  const Coord &, /* direction of the camera*/
72  bool, /* if true : use start and end color to border lines, if false : use borderColor*/
73  const Color &, /* border color */
74  const std::string &textureName=""); /* textureName */
75 TLP_GL_SCOPE void splineQuad(const std::vector<Coord> &, /* polyline vertces */
76  const Color &, /* start color */
77  const Color &, /* end color */
78  const float, /* start size */
79  const float, /* end size */
80  const Coord &, /* nomal to the begin of the curve */
81  const Coord &); /* nomal to the end curve */
82 TLP_GL_SCOPE void splineLine(const std::vector<Coord> &, /* polyline vertces */
83  const Color &, /* start color */
84  const Color &); /* end color */
85 //====================================================================
86 TLP_GL_SCOPE void getColors(const Coord *line,unsigned int lineSize, const Color &c1, const Color &c2,std::vector<Color> &);
87 TLP_GL_SCOPE void getSizes(const std::vector<Coord> &line, float s1, float s2, std::vector<float> &);
88 TLP_GL_SCOPE GLfloat* buildCurvePoints (const std::vector<Coord> &vertices,
89  const std::vector<float> &sizes,
90  const Coord &startN,
91  const Coord &endN,
92  unsigned int &resultSize,
93  std::vector<unsigned int> *dec=NULL);
94 TLP_GL_SCOPE void buildCurvePoints (const std::vector<Coord> &vertices,
95  const std::vector<float> &sizes,
96  const Coord &startN,
97  const Coord &endN,
98  std::vector<Coord> &result);
99 
100 }
101 #endif //DOXYGEN_NOTFOR_DEVEL
102 #endif
103 ///@endcond