![]() |
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 #ifndef _TLP_GLLINES 00022 #define _TLP_GLLINES 00023 #ifndef DOXYGEN_NOTFOR_DEVEL 00024 #include <vector> 00025 00026 #if defined(_MSC_VER) 00027 #include <Windows.h> 00028 #endif 00029 00030 #if defined(__APPLE__) 00031 #include <OpenGL/gl.h> 00032 #else 00033 #include <GL/gl.h> 00034 #endif 00035 00036 #include <tulip/Coord.h> 00037 #include <tulip/Color.h> 00038 00039 #include <tulip/tulipconf.h> 00040 00041 namespace tlp { 00042 00043 struct TLP_GL_SCOPE GlLines { 00044 //Curves types: linear, bezier, spline order 3, spline order 4 00045 enum InterpolationMethod {LINEAR=0, BEZIER, SPLINE3, SPLINE4}; 00046 enum StippleType {TLP_PLAIN=0, TLP_DOT, TLP_DASHED, TLP_ALTERNATE}; 00047 00048 static void glDrawPoint(const Coord &p); 00049 00050 static void glDrawLine(const Coord &startPoint,const Coord &endPoint,const double width,const unsigned int stippleType, 00051 const Color &startColor,const Color &endColor,const bool arrow=false,const double arrowWidth=1, 00052 const double arrowHeight=1); 00053 static void glDrawCurve(const Coord &startPoint,const std::vector<Coord> &bends,const Coord &endPoint,const double width, 00054 const unsigned int stippleType,const Color &startColor,const Color &endColor,const bool arrow=false, 00055 const double arrowWidth=1,const double arrowHeight=1); 00056 static void glDrawBezierCurve(const Coord &startPoint,const std::vector<Coord> &bends,const Coord &endPoint,unsigned int steps, 00057 const double width,const unsigned int stippleType,const Color &startColor,const Color &endColor, 00058 const bool arrow=false,const double arrowWidth=1,const double arrowHeight=1); 00059 static void glDrawSplineCurve(const Coord &startPoint,const std::vector<Coord> &bends,const Coord &endPoint,unsigned int steps, 00060 const double width,const unsigned int stippleType,const Color &startColor,const Color &endColor, 00061 const bool arrow=false,const double arrowWidth=1,const double arrowHeight=1); 00062 static void glDrawSpline2Curve(const Coord &startPoint,const std::vector<Coord> &bends,const Coord &endPoint,unsigned int steps, 00063 const double width,const unsigned int stippleType,const Color &startColor,const Color &endColor, 00064 const bool arrow=false,const double arrowWidth=1,const double arrowHeight=1); 00065 00066 private: 00067 static void glDisableLineStipple(unsigned int stippleType); 00068 static void glEnableLineStipple(unsigned int stippleType); 00069 static GLfloat *buildCurvePoints(const Coord &startPoint,const std::vector<Coord> &bends,const Coord &endPoint); 00070 static GLfloat *buildCurvePoints(const Coord &p0,const Coord &p1,const Coord &p2,const Coord &p3); 00071 }; 00072 00073 } 00074 #endif //DOXYGEN_NOTFOR_DEVEL 00075 #endif 00076 ///@endcond