SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00009 // Some methods which help to draw certain geometrical objects in openGL 00010 /****************************************************************************/ 00011 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00012 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00013 /****************************************************************************/ 00014 // 00015 // This file is part of SUMO. 00016 // SUMO is free software: you can redistribute it and/or modify 00017 // it under the terms of the GNU General Public License as published by 00018 // the Free Software Foundation, either version 3 of the License, or 00019 // (at your option) any later version. 00020 // 00021 /****************************************************************************/ 00022 #ifndef GLHelper_h 00023 #define GLHelper_h 00024 00025 00026 // =========================================================================== 00027 // included modules 00028 // =========================================================================== 00029 #ifdef _MSC_VER 00030 #include <windows_config.h> 00031 #else 00032 #include <config.h> 00033 #endif 00034 00035 #include <vector> 00036 #include <utility> 00037 #include <utils/common/RGBColor.h> 00038 #include <utils/geom/PositionVector.h> 00039 #include <utils/geom/Line.h> 00040 00041 00042 // =========================================================================== 00043 // class definitions 00044 // =========================================================================== 00051 class GLHelper { 00052 public: 00058 static void drawFilledPoly(const PositionVector& v, bool close) ; 00059 00060 00070 static void drawBoxLine(const Position& beg, SUMOReal rot, 00071 SUMOReal visLength, SUMOReal width) ; 00072 00073 00084 static void drawBoxLine(const Position& beg1, const Position& beg2, 00085 SUMOReal rot, SUMOReal visLength, SUMOReal width) ; 00086 00087 00098 static void drawBoxLines(const PositionVector& geom, 00099 const std::vector<SUMOReal> &rots, const std::vector<SUMOReal> &lengths, 00100 SUMOReal width) ; 00101 00102 00114 static void drawBoxLines(const PositionVector& geom1, 00115 const PositionVector& geom2, 00116 const std::vector<SUMOReal> &rots, const std::vector<SUMOReal> &lengths, 00117 SUMOReal width) ; 00118 00119 00129 static void drawBoxLines(const PositionVector& geom, SUMOReal width) ; 00130 00131 00140 static void drawLine(const Position& beg, SUMOReal rot, 00141 SUMOReal visLength) ; 00142 00143 00153 static void drawLine(const Position& beg1, const Position& beg2, 00154 SUMOReal rot, SUMOReal visLength) ; 00155 00156 00163 static void drawLine(const PositionVector& v) ; 00164 00165 00173 static void drawLine(const Position& beg, const Position& end) ; 00174 00175 00183 static void drawFilledCircle(SUMOReal width, int steps = 8) ; 00184 00185 00195 static void drawFilledCircle(SUMOReal width, int steps, 00196 SUMOReal beg, SUMOReal end) ; 00197 00198 00207 static void drawOutlineCircle(SUMOReal width, SUMOReal iwidth, 00208 int steps = 8) ; 00209 00210 00221 static void drawOutlineCircle(SUMOReal width, SUMOReal iwidth, 00222 int steps, SUMOReal beg, SUMOReal end) ; 00223 00224 00231 static void drawTriangleAtEnd(const Line& l, SUMOReal tLength, 00232 SUMOReal tWidth) ; 00233 00235 static void setColor(const RGBColor& c); 00236 00238 static RGBColor getColor(); 00239 00241 static void drawText(const std::string& text, const Position& pos, 00242 const SUMOReal layer, const SUMOReal size, 00243 const RGBColor& col = RGBColor(0, 0, 0), const SUMOReal angle = 0); 00244 00246 static void drawTextBox(const std::string& text, const Position& pos, 00247 const SUMOReal layer, const SUMOReal size, 00248 const RGBColor& txtColor = RGBColor(0, 0, 0), 00249 const RGBColor& bgColor = RGBColor(1, 1, 1), 00250 const RGBColor& borderColor = RGBColor(0, 0, 0), 00251 const SUMOReal angle = 0); 00252 00253 private: 00255 static std::vector<std::pair<SUMOReal, SUMOReal> > myCircleCoords; 00256 00257 }; 00258 00259 00260 #endif 00261 00262 /****************************************************************************/ 00263