SUMO - Simulation of Urban MObility

GLHelper.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // Some methods which help to draw certain geometrical objects in openGL
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright (C) 2001-2011 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This program is free software; you can redistribute it and/or modify
00014 //   it under the terms of the GNU General Public License as published by
00015 //   the Free Software Foundation; either version 2 of the License, or
00016 //   (at your option) any later version.
00017 //
00018 /****************************************************************************/
00019 #ifndef GLHelper_h
00020 #define GLHelper_h
00021 
00022 
00023 // ===========================================================================
00024 // included modules
00025 // ===========================================================================
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031 
00032 #include <vector>
00033 #include <utility>
00034 #include <utils/common/RGBColor.h>
00035 #include <utils/geom/PositionVector.h>
00036 #include <utils/geom/Line.h>
00037 
00038 
00039 // ===========================================================================
00040 // class definitions
00041 // ===========================================================================
00048 class GLHelper {
00049 public:
00055     static void drawFilledPoly(const PositionVector& v, bool close) throw();
00056 
00057 
00067     static void drawBoxLine(const Position& beg, SUMOReal rot,
00068                             SUMOReal visLength, SUMOReal width) throw();
00069 
00070 
00081     static void drawBoxLine(const Position& beg1, const Position& beg2,
00082                             SUMOReal rot, SUMOReal visLength, SUMOReal width) throw();
00083 
00084 
00095     static void drawBoxLines(const PositionVector& geom,
00096                              const std::vector<SUMOReal> &rots, const std::vector<SUMOReal> &lengths,
00097                              SUMOReal width) throw();
00098 
00099 
00111     static void drawBoxLines(const PositionVector& geom1,
00112                              const PositionVector& geom2,
00113                              const std::vector<SUMOReal> &rots, const std::vector<SUMOReal> &lengths,
00114                              SUMOReal width) throw();
00115 
00116 
00126     static void drawBoxLines(const PositionVector& geom, SUMOReal width) throw();
00127 
00128 
00137     static void drawLine(const Position& beg, SUMOReal rot,
00138                          SUMOReal visLength) throw();
00139 
00140 
00150     static void drawLine(const Position& beg1, const Position& beg2,
00151                          SUMOReal rot, SUMOReal visLength) throw();
00152 
00153 
00160     static void drawLine(const PositionVector& v) throw();
00161 
00162 
00170     static void drawLine(const Position& beg, const Position& end) throw();
00171 
00172 
00180     static void drawFilledCircle(SUMOReal width, int steps=8) throw();
00181 
00182 
00192     static void drawFilledCircle(SUMOReal width, int steps,
00193                                  SUMOReal beg, SUMOReal end) throw();
00194 
00195 
00204     static void drawOutlineCircle(SUMOReal width, SUMOReal iwidth,
00205                                   int steps=8) throw();
00206 
00207 
00218     static void drawOutlineCircle(SUMOReal width, SUMOReal iwidth,
00219                                   int steps, SUMOReal beg, SUMOReal end) throw();
00220 
00221 
00228     static void drawTriangleAtEnd(const Line& l, SUMOReal tLength,
00229                                   SUMOReal tWidth) throw();
00230 
00232     static void setColor(const RGBColor& c);
00233 
00235     static RGBColor getColor();
00236 
00238     static void drawText(const std::string& text, const Position& pos,
00239                          const SUMOReal layer, const SUMOReal size,
00240                          const RGBColor& col=RGBColor(0,0,0), const SUMOReal angle=0);
00241 
00243     static void drawTextBox(const std::string& text, const Position& pos,
00244                             const SUMOReal layer, const SUMOReal size,
00245                             const RGBColor& txtColor=RGBColor(0,0,0),
00246                             const RGBColor& bgColor=RGBColor(1,1,1),
00247                             const RGBColor& borderColor=RGBColor(0,0,0),
00248                             const SUMOReal angle=0);
00249 
00250 private:
00252     static std::vector<std::pair<SUMOReal, SUMOReal> > myCircleCoords;
00253 
00254 };
00255 
00256 
00257 #endif
00258 
00259 /****************************************************************************/
00260 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines