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-sim.org/
12 // Copyright (C) 2001-2014 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:
59  static void drawFilledPoly(const PositionVector& v, bool close);
60 
61 
69  static void drawFilledPolyTesselated(const PositionVector& v, bool close);
70 
71 
81  static void drawBoxLine(const Position& beg, SUMOReal rot,
82  SUMOReal visLength, SUMOReal width);
83 
84 
95  static void drawBoxLine(const Position& beg1, const Position& beg2,
96  SUMOReal rot, SUMOReal visLength, SUMOReal width);
97 
98 
110  static void drawBoxLines(const PositionVector& geom,
111  const std::vector<SUMOReal>& rots, const std::vector<SUMOReal>& lengths,
112  SUMOReal width, int cornerDetail = 0);
113 
114 
126  static void drawBoxLines(const PositionVector& geom1,
127  const PositionVector& geom2,
128  const std::vector<SUMOReal>& rots, const std::vector<SUMOReal>& lengths,
129  SUMOReal width);
130 
131 
141  static void drawBoxLines(const PositionVector& geom, SUMOReal width);
142 
143 
152  static void drawLine(const Position& beg, SUMOReal rot,
153  SUMOReal visLength);
154 
155 
165  static void drawLine(const Position& beg1, const Position& beg2,
166  SUMOReal rot, SUMOReal visLength);
167 
168 
175  static void drawLine(const PositionVector& v);
176 
177 
185  static void drawLine(const Position& beg, const Position& end);
186 
187 
195  static void drawFilledCircle(SUMOReal width, int steps = 8);
196 
197 
207  static void drawFilledCircle(SUMOReal width, int steps,
208  SUMOReal beg, SUMOReal end);
209 
210 
219  static void drawOutlineCircle(SUMOReal width, SUMOReal iwidth,
220  int steps = 8);
221 
222 
233  static void drawOutlineCircle(SUMOReal width, SUMOReal iwidth,
234  int steps, SUMOReal beg, SUMOReal end);
235 
236 
243  static void drawTriangleAtEnd(const Line& l, SUMOReal tLength,
244  SUMOReal tWidth);
245 
247  static void setColor(const RGBColor& c);
248 
250  static RGBColor getColor();
251 
253  static void drawText(const std::string& text, const Position& pos,
254  const SUMOReal layer, const SUMOReal size,
255  const RGBColor& col = RGBColor::BLACK, const SUMOReal angle = 0);
256 
258  static void drawTextBox(const std::string& text, const Position& pos,
259  const SUMOReal layer, const SUMOReal size,
260  const RGBColor& txtColor = RGBColor::BLACK,
261  const RGBColor& bgColor = RGBColor::WHITE,
262  const RGBColor& borderColor = RGBColor::BLACK,
263  const SUMOReal angle = 0);
264 
265 private:
267  static std::vector<std::pair<SUMOReal, SUMOReal> > myCircleCoords;
268 
269 };
270 
271 
272 #endif
273 
274 /****************************************************************************/
275