SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GLHelper.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // Some methods which help to draw certain geometrical objects in openGL
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef GLHelper_h
23 #define GLHelper_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <vector>
36 #include <utility>
37 #include <utils/common/RGBColor.h>
39 #include <utils/geom/Line.h>
40 
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
51 class GLHelper {
52 public:
58  static void drawFilledPoly(const PositionVector& v, bool close) ;
59 
60 
70  static void drawBoxLine(const Position& beg, SUMOReal rot,
71  SUMOReal visLength, SUMOReal width) ;
72 
73 
84  static void drawBoxLine(const Position& beg1, const Position& beg2,
85  SUMOReal rot, SUMOReal visLength, SUMOReal width) ;
86 
87 
98  static void drawBoxLines(const PositionVector& geom,
99  const std::vector<SUMOReal> &rots, const std::vector<SUMOReal> &lengths,
100  SUMOReal width) ;
101 
102 
114  static void drawBoxLines(const PositionVector& geom1,
115  const PositionVector& geom2,
116  const std::vector<SUMOReal> &rots, const std::vector<SUMOReal> &lengths,
117  SUMOReal width) ;
118 
119 
129  static void drawBoxLines(const PositionVector& geom, SUMOReal width) ;
130 
131 
140  static void drawLine(const Position& beg, SUMOReal rot,
141  SUMOReal visLength) ;
142 
143 
153  static void drawLine(const Position& beg1, const Position& beg2,
154  SUMOReal rot, SUMOReal visLength) ;
155 
156 
163  static void drawLine(const PositionVector& v) ;
164 
165 
173  static void drawLine(const Position& beg, const Position& end) ;
174 
175 
183  static void drawFilledCircle(SUMOReal width, int steps = 8) ;
184 
185 
195  static void drawFilledCircle(SUMOReal width, int steps,
196  SUMOReal beg, SUMOReal end) ;
197 
198 
207  static void drawOutlineCircle(SUMOReal width, SUMOReal iwidth,
208  int steps = 8) ;
209 
210 
221  static void drawOutlineCircle(SUMOReal width, SUMOReal iwidth,
222  int steps, SUMOReal beg, SUMOReal end) ;
223 
224 
231  static void drawTriangleAtEnd(const Line& l, SUMOReal tLength,
232  SUMOReal tWidth) ;
233 
235  static void setColor(const RGBColor& c);
236 
238  static RGBColor getColor();
239 
241  static void drawText(const std::string& text, const Position& pos,
242  const SUMOReal layer, const SUMOReal size,
243  const RGBColor& col = RGBColor(0, 0, 0), const SUMOReal angle = 0);
244 
246  static void drawTextBox(const std::string& text, const Position& pos,
247  const SUMOReal layer, const SUMOReal size,
248  const RGBColor& txtColor = RGBColor(0, 0, 0),
249  const RGBColor& bgColor = RGBColor(1, 1, 1),
250  const RGBColor& borderColor = RGBColor(0, 0, 0),
251  const SUMOReal angle = 0);
252 
253 private:
255  static std::vector<std::pair<SUMOReal, SUMOReal> > myCircleCoords;
256 
257 };
258 
259 
260 #endif
261 
262 /****************************************************************************/
263