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 
109  static void drawBoxLines(const PositionVector& geom,
110  const std::vector<SUMOReal>& rots, const std::vector<SUMOReal>& lengths,
111  SUMOReal width);
112 
113 
125  static void drawBoxLines(const PositionVector& geom1,
126  const PositionVector& geom2,
127  const std::vector<SUMOReal>& rots, const std::vector<SUMOReal>& lengths,
128  SUMOReal width);
129 
130 
140  static void drawBoxLines(const PositionVector& geom, SUMOReal width);
141 
142 
151  static void drawLine(const Position& beg, SUMOReal rot,
152  SUMOReal visLength);
153 
154 
164  static void drawLine(const Position& beg1, const Position& beg2,
165  SUMOReal rot, SUMOReal visLength);
166 
167 
174  static void drawLine(const PositionVector& v);
175 
176 
184  static void drawLine(const Position& beg, const Position& end);
185 
186 
194  static void drawFilledCircle(SUMOReal width, int steps = 8);
195 
196 
206  static void drawFilledCircle(SUMOReal width, int steps,
207  SUMOReal beg, SUMOReal end);
208 
209 
218  static void drawOutlineCircle(SUMOReal width, SUMOReal iwidth,
219  int steps = 8);
220 
221 
232  static void drawOutlineCircle(SUMOReal width, SUMOReal iwidth,
233  int steps, SUMOReal beg, SUMOReal end);
234 
235 
242  static void drawTriangleAtEnd(const Line& l, SUMOReal tLength,
243  SUMOReal tWidth);
244 
246  static void setColor(const RGBColor& c);
247 
249  static RGBColor getColor();
250 
252  static void drawText(const std::string& text, const Position& pos,
253  const SUMOReal layer, const SUMOReal size,
254  const RGBColor& col = RGBColor::BLACK, const SUMOReal angle = 0);
255 
257  static void drawTextBox(const std::string& text, const Position& pos,
258  const SUMOReal layer, const SUMOReal size,
259  const RGBColor& txtColor = RGBColor::BLACK,
260  const RGBColor& bgColor = RGBColor::WHITE,
261  const RGBColor& borderColor = RGBColor::BLACK,
262  const SUMOReal angle = 0);
263 
264 private:
266  static std::vector<std::pair<SUMOReal, SUMOReal> > myCircleCoords;
267 
268 };
269 
270 
271 #endif
272 
273 /****************************************************************************/
274 
static const RGBColor WHITE
Definition: RGBColor.h:194
static void drawOutlineCircle(SUMOReal width, SUMOReal iwidth, int steps=8)
Draws an unfilled circle around (0,0)
Definition: GLHelper.cpp:285
static void drawFilledPoly(const PositionVector &v, bool close)
Draws a filled polygon described by the list of points.
Definition: GLHelper.cpp:71
static const RGBColor BLACK
Definition: RGBColor.h:195
static void drawText(const std::string &text, const Position &pos, const SUMOReal layer, const SUMOReal size, const RGBColor &col=RGBColor::BLACK, const SUMOReal angle=0)
draw Text with given parameters
Definition: GLHelper.cpp:369
Some methods which help to draw certain geometrical objects in openGL.
Definition: GLHelper.h:51
static void drawFilledPolyTesselated(const PositionVector &v, bool close)
Draws a filled polygon described by the list of points.
Definition: GLHelper.cpp:90
static void drawFilledCircle(SUMOReal width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:247
static std::vector< std::pair< SUMOReal, SUMOReal > > myCircleCoords
Storage for precomputed sin/cos-values describing a circle.
Definition: GLHelper.h:266
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:352
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
A list of positions.
Definition: Line.h:51
static void drawBoxLines(const PositionVector &geom, const std::vector< SUMOReal > &rots, const std::vector< SUMOReal > &lengths, SUMOReal width)
Draws thick lines.
Definition: GLHelper.cpp:157
static void drawTextBox(const std::string &text, const Position &pos, const SUMOReal layer, const SUMOReal size, const RGBColor &txtColor=RGBColor::BLACK, const RGBColor &bgColor=RGBColor::WHITE, const RGBColor &borderColor=RGBColor::BLACK, const SUMOReal angle=0)
draw Text box with given parameters
Definition: GLHelper.cpp:387
static void drawBoxLine(const Position &beg, SUMOReal rot, SUMOReal visLength, SUMOReal width)
Draws a thick line.
Definition: GLHelper.cpp:124
static void drawTriangleAtEnd(const Line &l, SUMOReal tLength, SUMOReal tWidth)
Draws a triangle at the end of the given line.
Definition: GLHelper.cpp:332
static void drawLine(const Position &beg, SUMOReal rot, SUMOReal visLength)
Draws a thin line.
Definition: GLHelper.cpp:196
#define SUMOReal
Definition: config.h:215
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:358