SUMO - Simulation of Urban MObility

GLHelper Class Reference

Some methods which help to draw certain geometrical objects in openGL. More...

#include <GLHelper.h>

Static Public Member Functions

static void drawBoxLine (const Position &beg, SUMOReal rot, SUMOReal visLength, SUMOReal width) throw ()
 Draws a thick line.
static void drawBoxLine (const Position &beg1, const Position &beg2, SUMOReal rot, SUMOReal visLength, SUMOReal width) throw ()
 Draws a thick line using the mean of both given points as begin position.
static void drawBoxLines (const PositionVector &geom, const std::vector< SUMOReal > &rots, const std::vector< SUMOReal > &lengths, SUMOReal width) throw ()
 Draws thick lines.
static void drawBoxLines (const PositionVector &geom1, const PositionVector &geom2, const std::vector< SUMOReal > &rots, const std::vector< SUMOReal > &lengths, SUMOReal width) throw ()
 Draws thick lines using the mean of the points given in the point lists as begin positions.
static void drawBoxLines (const PositionVector &geom, SUMOReal width) throw ()
 Draws thick lines.
static void drawFilledCircle (SUMOReal width, int steps=8) throw ()
 Draws a filled circle around (0,0)
static void drawFilledCircle (SUMOReal width, int steps, SUMOReal beg, SUMOReal end) throw ()
 Draws a filled circle around (0,0)
static void drawFilledPoly (const PositionVector &v, bool close) throw ()
 Draws a filled polygon described by the list of points.
static void drawLine (const Position &beg1, const Position &beg2, SUMOReal rot, SUMOReal visLength) throw ()
 Draws a thin line using the mean of both given points as begin position.
static void drawLine (const PositionVector &v) throw ()
 Draws a thin line along the given position vector.
static void drawLine (const Position &beg, const Position &end) throw ()
 Draws a thin line between the two points.
static void drawLine (const Position &beg, SUMOReal rot, SUMOReal visLength) throw ()
 Draws a thin line.
static void drawOutlineCircle (SUMOReal width, SUMOReal iwidth, int steps=8) throw ()
 Draws an unfilled circle around (0,0)
static void drawOutlineCircle (SUMOReal width, SUMOReal iwidth, int steps, SUMOReal beg, SUMOReal end) throw ()
 Draws an unfilled circle around (0,0)
static void drawText (const std::string &text, const Position &pos, const SUMOReal layer, const SUMOReal size, const RGBColor &col=RGBColor(0, 0, 0), const SUMOReal angle=0)
 draw Text with given parameters
static void drawTextBox (const std::string &text, const Position &pos, const SUMOReal layer, const SUMOReal size, const RGBColor &txtColor=RGBColor(0, 0, 0), const RGBColor &bgColor=RGBColor(1, 1, 1), const RGBColor &borderColor=RGBColor(0, 0, 0), const SUMOReal angle=0)
 draw Text box with given parameters
static void drawTriangleAtEnd (const Line &l, SUMOReal tLength, SUMOReal tWidth) throw ()
 Draws a triangle at the end of the given line.
static RGBColor getColor ()
 gets the gl-color
static void setColor (const RGBColor &c)
 Sets the gl-color to this value.

Static Private Attributes

static std::vector< std::pair
< SUMOReal, SUMOReal > > 
myCircleCoords
 Storage for precomputed sin/cos-values describing a circle.

Detailed Description

Some methods which help to draw certain geometrical objects in openGL.

This class offers some static methods for drawing primitives in openGL.

Definition at line 48 of file GLHelper.h.


Member Function Documentation

void GLHelper::drawBoxLine ( const Position &  beg,
SUMOReal  rot,
SUMOReal  visLength,
SUMOReal  width 
) throw () [static]

Draws a thick line.

The line is drawn as a GL_QUADS.

Parameters:
[in]begThe begin position of the line
[in]rotThe direction the line shall be drawn to (in radiants)
[in]visLengthThe length of the line
[in]widthThe width of the line

Definition at line 76 of file GLHelper.cpp.

Referenced by drawAction_drawVehicleAsPoly(), drawBoxLines(), GUIE3Collector::MyWrapper::drawSingleCrossing(), drawTextBox(), and GUILaneWrapper::ROWdrawAction_drawArrows().

void GLHelper::drawBoxLine ( const Position &  beg1,
const Position &  beg2,
SUMOReal  rot,
SUMOReal  visLength,
SUMOReal  width 
) throw () [static]

Draws a thick line using the mean of both given points as begin position.

The line is drawn as a GL_QUADS.

Parameters:
[in]beg1One of the begin positions of the line to use the mean of
[in]beg2One of the begin positions of the line to use the mean of
[in]rotThe direction the line shall be drawn to (in radiants)
[in]visLengthThe length of the line
[in]widthThe width of the line

Definition at line 92 of file GLHelper.cpp.

void GLHelper::drawBoxLines ( const PositionVector &  geom,
const std::vector< SUMOReal > &  rots,
const std::vector< SUMOReal > &  lengths,
SUMOReal  width 
) throw () [static]

Draws thick lines.

Each line is drawn using drawBoxLine.

Parameters:
[in]geomThe list of begin positions of the lines
[in]rotsThe directions the lines shall be drawn to (in radiants)
[in]lengthsThe lengths of the lines
[in]widthThe width of the lines
See also:
drawBoxLine

Definition at line 109 of file GLHelper.cpp.

Referenced by GUIVehicle::draw(), GUIVehicle::drawBestLanes(), GUIPolygon::drawGL(), GUILaneWrapper::drawGL(), GUIBusStop::drawGL(), GUI_E2_ZS_Collector::MyWrapper::drawGL(), and GUILaneWrapper::drawMarkings().

void GLHelper::drawBoxLines ( const PositionVector &  geom1,
const PositionVector &  geom2,
const std::vector< SUMOReal > &  rots,
const std::vector< SUMOReal > &  lengths,
SUMOReal  width 
) throw () [static]

Draws thick lines using the mean of the points given in the point lists as begin positions.

Each line is drawn using drawBoxLine.

Parameters:
[in]geom1One of the lists to obtain the lines' begin positions to use the mean of
[in]geom2One of the lists to obtain the lines' begin positions to use the mean of
[in]rotsThe directions the lines shall be drawn to (in radiants)
[in]lengthsThe lengths of the lines
[in]widthThe width of the lines
See also:
drawBoxLine

Definition at line 121 of file GLHelper.cpp.

References drawBoxLine(), and MIN4().

void GLHelper::drawBoxLines ( const PositionVector &  geom,
SUMOReal  width 
) throw () [static]

Draws thick lines.

Widths and length are computed internally by this method, each line is then drawn using drawBoxLine.

Parameters:
[in]geomThe list of begin positions of the lines
[in]widthThe width of the lines
See also:
drawBoxLine

Definition at line 134 of file GLHelper.cpp.

References Position::distanceTo(), PI, SUMOReal, Position::x(), and Position::y().

void GLHelper::drawFilledCircle ( SUMOReal  width,
int  steps = 8 
) throw () [static]

Draws a filled circle around (0,0)

The circle is drawn by calling drawFilledCircle(width, steps, 0, 360).

Parameters:
[in]widthThe width of the circle
[in]stepsThe number of steps to divide the circle into

Definition at line 199 of file GLHelper.cpp.

Referenced by drawAction_drawBlinker(), drawAction_drawVehicleAsPoly(), drawAction_drawVehicleBrakeLight(), GUITriggeredRerouter::drawGL(), GUITrafficLightLogicWrapper::drawGL(), GUIPointOfInterest::drawGL(), GUILaneSpeedTrigger::drawGL(), and GUIBusStop::drawGL().

void GLHelper::drawFilledCircle ( SUMOReal  width,
int  steps,
SUMOReal  beg,
SUMOReal  end 
) throw () [static]

Draws a filled circle around (0,0)

The circle is drawn use GL_TRIANGLES.

Parameters:
[in]widthThe width of the circle
[in]stepsThe number of steps to divide the circle into
[in]begThe begin angle in degress
[in]endThe end angle in degress

Definition at line 205 of file GLHelper.cpp.

References PI, and SUMOReal.

void GLHelper::drawFilledPoly ( const PositionVector &  v,
bool  close 
) throw () [static]

Draws a filled polygon described by the list of points.

Parameters:
[in]vThe polygon to draw
[in]closeWhether the first point shall be appended

Definition at line 56 of file GLHelper.cpp.

References Position::x(), and Position::y().

Referenced by GUIJunctionWrapper::drawGL().

void GLHelper::drawLine ( const Position &  beg1,
const Position &  beg2,
SUMOReal  rot,
SUMOReal  visLength 
) throw () [static]

Draws a thin line using the mean of both given points as begin position.

The line is drawn as a GL_LINES.

Parameters:
[in]beg1One of the begin positions of the line to use the mean of
[in]beg2One of the begin positions of the line to use the mean of
[in]rotThe direction the line shall be drawn to (in radiants)
[in]visLengthThe length of the line

Definition at line 161 of file GLHelper.cpp.

void GLHelper::drawLine ( const PositionVector &  v) throw () [static]

Draws a thin line along the given position vector.

The line is drawn as a GL_LINES.

Parameters:
[in]vThe positions vector to use

Definition at line 176 of file GLHelper.cpp.

void GLHelper::drawLine ( const Position &  beg,
const Position &  end 
) throw () [static]

Draws a thin line between the two points.

The line is drawn as a GL_LINES.

Parameters:
[in]begBegin of the line
[in]endEnd of the line

Definition at line 189 of file GLHelper.cpp.

void GLHelper::drawLine ( const Position &  beg,
SUMOReal  rot,
SUMOReal  visLength 
) throw () [static]

Draws a thin line.

The line is drawn as a GL_LINES.

Parameters:
[in]begThe begin position of the line
[in]rotThe direction the line shall be drawn to (in radiants)
[in]visLengthThe length of the line

Definition at line 148 of file GLHelper.cpp.

Referenced by GUIVehicle::drawBestLanes(), GUIPolygon::drawGL(), GUILaneWrapper::drawGL(), and GUI_E2_ZS_Collector::MyWrapper::drawGL().

void GLHelper::drawOutlineCircle ( SUMOReal  width,
SUMOReal  iwidth,
int  steps = 8 
) throw () [static]

Draws an unfilled circle around (0,0)

The circle is drawn by calling drawOutlineCircle(width, iwidth, steps, 0, 360).

Parameters:
[in]widthThe (outer) width of the circle
[in]iwidthThe inner width of the circle
[in]stepsThe number of steps to divide the circle into

Definition at line 237 of file GLHelper.cpp.

void GLHelper::drawOutlineCircle ( SUMOReal  width,
SUMOReal  iwidth,
int  steps,
SUMOReal  beg,
SUMOReal  end 
) throw () [static]

Draws an unfilled circle around (0,0)

The circle is drawn use GL_TRIANGLES.

Parameters:
[in]widthThe (outer) width of the circle
[in]iwidthThe inner width of the circle
[in]stepsThe number of steps to divide the circle into
[in]begThe begin angle in degress
[in]endThe end angle in degress

Definition at line 243 of file GLHelper.cpp.

References PI, and SUMOReal.

void GLHelper::drawText ( const std::string &  text,
const Position &  pos,
const SUMOReal  layer,
const SUMOReal  size,
const RGBColor &  col = RGBColor(0,0,0),
const SUMOReal  angle = 0 
) [static]
void GLHelper::drawTextBox ( const std::string &  text,
const Position &  pos,
const SUMOReal  layer,
const SUMOReal  size,
const RGBColor &  txtColor = RGBColor(0,0,0),
const RGBColor &  bgColor = RGBColor(1,1,1),
const RGBColor &  borderColor = RGBColor(0,0,0),
const SUMOReal  angle = 0 
) [static]
void GLHelper::drawTriangleAtEnd ( const Line &  l,
SUMOReal  tLength,
SUMOReal  tWidth 
) throw () [static]

Draws a triangle at the end of the given line.

Parameters:
[in]lThe line at which end the triangle shall be drawn
[in]tLengthThe length of the triangle
[in]tWidthThe width of the triangle

Definition at line 284 of file GLHelper.cpp.

Referenced by GUIE3Collector::MyWrapper::drawSingleCrossing(), GUILaneWrapper::ROWdrawAction_drawArrows(), and GUILaneWrapper::ROWdrawAction_drawLane2LaneConnections().

RGBColor GLHelper::getColor ( ) [static]

gets the gl-color

Definition at line 310 of file GLHelper.cpp.

Referenced by drawAction_drawVehicleAsPoly().

void GLHelper::setColor ( const RGBColor &  c) [static]

Sets the gl-color to this value.

Definition at line 304 of file GLHelper.cpp.

References RGBColor::blue(), RGBColor::green(), and RGBColor::red().

Referenced by GUIPolygon::drawGL(), GUIBusStop::drawGL(), drawText(), and drawTextBox().


Field Documentation

std::vector< std::pair< SUMOReal, SUMOReal > > GLHelper::myCircleCoords [static, private]

Storage for precomputed sin/cos-values describing a circle.

Definition at line 252 of file GLHelper.h.


The documentation for this class was generated from the following files:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines