SUMO - Simulation of Urban MObility
|
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) |
Draws a thick line. | |
static void | drawBoxLine (const Position &beg1, const Position &beg2, SUMOReal rot, SUMOReal visLength, SUMOReal width) |
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) |
Draws thick lines. | |
static void | drawBoxLines (const PositionVector &geom1, const PositionVector &geom2, const std::vector< SUMOReal > &rots, const std::vector< SUMOReal > &lengths, SUMOReal width) |
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) |
Draws thick lines. | |
static void | drawFilledCircle (SUMOReal width, int steps=8) |
Draws a filled circle around (0,0) | |
static void | drawFilledCircle (SUMOReal width, int steps, SUMOReal beg, SUMOReal end) |
Draws a filled circle around (0,0) | |
static void | drawFilledPoly (const PositionVector &v, bool close) |
Draws a filled polygon described by the list of points. | |
static void | drawLine (const Position &beg, SUMOReal rot, SUMOReal visLength) |
Draws a thin line. | |
static void | drawLine (const Position &beg1, const Position &beg2, SUMOReal rot, SUMOReal visLength) |
Draws a thin line using the mean of both given points as begin position. | |
static void | drawLine (const PositionVector &v) |
Draws a thin line along the given position vector. | |
static void | drawLine (const Position &beg, const Position &end) |
Draws a thin line between the two points. | |
static void | drawOutlineCircle (SUMOReal width, SUMOReal iwidth, int steps=8) |
Draws an unfilled circle around (0,0) | |
static void | drawOutlineCircle (SUMOReal width, SUMOReal iwidth, int steps, SUMOReal beg, SUMOReal end) |
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) |
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. |
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 51 of file GLHelper.h.
void GLHelper::drawBoxLine | ( | const Position & | beg, |
SUMOReal | rot, | ||
SUMOReal | visLength, | ||
SUMOReal | width | ||
) | [static] |
Draws a thick line.
The line is drawn as a GL_QUADS.
[in] | beg | The begin position of the line |
[in] | rot | The direction the line shall be drawn to (in radiants) |
[in] | visLength | The length of the line |
[in] | width | The width of the line |
Definition at line 78 of file GLHelper.cpp.
References Position::x(), and Position::y().
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 | ||
) | [static] |
Draws a thick line using the mean of both given points as begin position.
The line is drawn as a GL_QUADS.
[in] | beg1 | One of the begin positions of the line to use the mean of |
[in] | beg2 | One of the begin positions of the line to use the mean of |
[in] | rot | The direction the line shall be drawn to (in radiants) |
[in] | visLength | The length of the line |
[in] | width | The width of the line |
Definition at line 94 of file GLHelper.cpp.
References Position::x(), and Position::y().
void GLHelper::drawBoxLines | ( | const PositionVector & | geom, |
const std::vector< SUMOReal > & | rots, | ||
const std::vector< SUMOReal > & | lengths, | ||
SUMOReal | width | ||
) | [static] |
Draws thick lines.
Each line is drawn using drawBoxLine.
[in] | geom | The list of begin positions of the lines |
[in] | rots | The directions the lines shall be drawn to (in radiants) |
[in] | lengths | The lengths of the lines |
[in] | width | The width of the lines |
Definition at line 111 of file GLHelper.cpp.
References drawBoxLine(), and PositionVector::size().
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 | ||
) | [static] |
Draws thick lines using the mean of the points given in the point lists as begin positions.
Each line is drawn using drawBoxLine.
[in] | geom1 | One of the lists to obtain the lines' begin positions to use the mean of |
[in] | geom2 | One of the lists to obtain the lines' begin positions to use the mean of |
[in] | rots | The directions the lines shall be drawn to (in radiants) |
[in] | lengths | The lengths of the lines |
[in] | width | The width of the lines |
Definition at line 123 of file GLHelper.cpp.
References drawBoxLine(), MIN4(), and PositionVector::size().
void GLHelper::drawBoxLines | ( | const PositionVector & | geom, |
SUMOReal | width | ||
) | [static] |
Draws thick lines.
Widths and length are computed internally by this method, each line is then drawn using drawBoxLine.
[in] | geom | The list of begin positions of the lines |
[in] | width | The width of the lines |
Definition at line 136 of file GLHelper.cpp.
References Position::distanceTo(), drawBoxLine(), PI, PositionVector::size(), SUMOReal, Position::x(), and Position::y().
void GLHelper::drawFilledCircle | ( | SUMOReal | width, |
int | steps = 8 |
||
) | [static] |
Draws a filled circle around (0,0)
The circle is drawn by calling drawFilledCircle(width, steps, 0, 360).
[in] | width | The width of the circle |
[in] | steps | The number of steps to divide the circle into |
Definition at line 201 of file GLHelper.cpp.
Referenced by drawAction_drawBlinker(), drawAction_drawVehicleAsPoly(), drawAction_drawVehicleBrakeLight(), GUITrafficLightLogicWrapper::drawGL(), GUIPointOfInterest::drawGL(), GUITriggeredRerouter::drawGL(), GUILaneSpeedTrigger::drawGL(), GUIBusStop::drawGL(), and GUIVehicle::drawGLAdditional().
void GLHelper::drawFilledCircle | ( | SUMOReal | width, |
int | steps, | ||
SUMOReal | beg, | ||
SUMOReal | end | ||
) | [static] |
Draws a filled circle around (0,0)
The circle is drawn use GL_TRIANGLES.
[in] | width | The width of the circle |
[in] | steps | The number of steps to divide the circle into |
[in] | beg | The begin angle in degress |
[in] | end | The end angle in degress |
Definition at line 207 of file GLHelper.cpp.
References myCircleCoords, PI, and SUMOReal.
void GLHelper::drawFilledPoly | ( | const PositionVector & | v, |
bool | close | ||
) | [static] |
Draws a filled polygon described by the list of points.
[in] | v | The polygon to draw |
[in] | close | Whether the first point shall be appended |
Definition at line 59 of file GLHelper.cpp.
References PositionVector::begin(), PositionVector::end(), PositionVector::size(), Position::x(), and Position::y().
Referenced by GUIJunctionWrapper::drawGL().
void GLHelper::drawLine | ( | const Position & | beg, |
SUMOReal | rot, | ||
SUMOReal | visLength | ||
) | [static] |
Draws a thin line.
The line is drawn as a GL_LINES.
[in] | beg | The begin position of the line |
[in] | rot | The direction the line shall be drawn to (in radiants) |
[in] | visLength | The length of the line |
Definition at line 150 of file GLHelper.cpp.
References Position::x(), and Position::y().
Referenced by GUIVehicle::drawBestLanes(), GUIPolygon::drawGL(), GUILaneWrapper::drawGL(), and GUI_E2_ZS_Collector::MyWrapper::drawGL().
void GLHelper::drawLine | ( | const Position & | beg1, |
const Position & | beg2, | ||
SUMOReal | rot, | ||
SUMOReal | visLength | ||
) | [static] |
Draws a thin line using the mean of both given points as begin position.
The line is drawn as a GL_LINES.
[in] | beg1 | One of the begin positions of the line to use the mean of |
[in] | beg2 | One of the begin positions of the line to use the mean of |
[in] | rot | The direction the line shall be drawn to (in radiants) |
[in] | visLength | The length of the line |
Definition at line 163 of file GLHelper.cpp.
References Position::x(), and Position::y().
void GLHelper::drawLine | ( | const PositionVector & | v | ) | [static] |
Draws a thin line along the given position vector.
The line is drawn as a GL_LINES.
[in] | v | The positions vector to use |
Definition at line 178 of file GLHelper.cpp.
References PositionVector::size().
void GLHelper::drawLine | ( | const Position & | beg, |
const Position & | end | ||
) | [static] |
Draws a thin line between the two points.
The line is drawn as a GL_LINES.
[in] | beg | Begin of the line |
[in] | end | End of the line |
Definition at line 191 of file GLHelper.cpp.
References Position::x(), and Position::y().
void GLHelper::drawOutlineCircle | ( | SUMOReal | width, |
SUMOReal | iwidth, | ||
int | steps = 8 |
||
) | [static] |
Draws an unfilled circle around (0,0)
The circle is drawn by calling drawOutlineCircle(width, iwidth, steps, 0, 360).
[in] | width | The (outer) width of the circle |
[in] | iwidth | The inner width of the circle |
[in] | steps | The number of steps to divide the circle into |
Definition at line 239 of file GLHelper.cpp.
void GLHelper::drawOutlineCircle | ( | SUMOReal | width, |
SUMOReal | iwidth, | ||
int | steps, | ||
SUMOReal | beg, | ||
SUMOReal | end | ||
) | [static] |
Draws an unfilled circle around (0,0)
The circle is drawn use GL_TRIANGLES.
[in] | width | The (outer) width of the circle |
[in] | iwidth | The inner width of the circle |
[in] | steps | The number of steps to divide the circle into |
[in] | beg | The begin angle in degress |
[in] | end | The end angle in degress |
Definition at line 245 of file GLHelper.cpp.
References myCircleCoords, 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] |
draw Text with given parameters
Definition at line 320 of file GLHelper.cpp.
References pfdkGetStringWidth(), pfDrawString(), pfSetPosition(), pfSetScale(), setColor(), SUMOReal, Position::x(), and Position::y().
Referenced by GUIBusStop::drawGL(), GUIEdge::drawGL(), GUIGlObject::drawName(), GUILaneWrapper::ROWdrawAction_drawLinkNo(), and GUILaneWrapper::ROWdrawAction_drawTLSLinkNo().
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] |
draw Text box with given parameters
Definition at line 338 of file GLHelper.cpp.
References Position::add(), drawBoxLine(), pfdkGetStringWidth(), pfDrawString(), pfSetPosition(), pfSetScale(), setColor(), Position::sub(), SUMOReal, Position::x(), and Position::y().
Referenced by GUISUMOAbstractView::showToolTipFor().
void GLHelper::drawTriangleAtEnd | ( | const Line & | l, |
SUMOReal | tLength, | ||
SUMOReal | tWidth | ||
) | [static] |
Draws a triangle at the end of the given line.
[in] | l | The line at which end the triangle shall be drawn |
[in] | tLength | The length of the triangle |
[in] | tWidth | The width of the triangle |
Definition at line 286 of file GLHelper.cpp.
References Line::atan2DegreeAngle(), Line::getPositionAtDistance(), Line::length(), and Line::p2().
Referenced by GUIE3Collector::MyWrapper::drawSingleCrossing(), GUILaneWrapper::ROWdrawAction_drawArrows(), and GUILaneWrapper::ROWdrawAction_drawLane2LaneConnections().
RGBColor GLHelper::getColor | ( | ) | [static] |
gets the gl-color
Definition at line 312 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 306 of file GLHelper.cpp.
References RGBColor::blue(), RGBColor::green(), and RGBColor::red().
Referenced by drawAction_drawVehicleAsPoly(), GUIBusStop::drawGL(), drawText(), and drawTextBox().
std::vector< std::pair< SUMOReal, SUMOReal > > GLHelper::myCircleCoords [static, private] |
Storage for precomputed sin/cos-values describing a circle.
Definition at line 255 of file GLHelper.h.
Referenced by drawFilledCircle(), and drawOutlineCircle().