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, int cornerDetail=0) |
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 | drawFilledPolyTesselated (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::BLACK, 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::BLACK, const RGBColor &bgColor=RGBColor::WHITE, const RGBColor &borderColor=RGBColor::BLACK, 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.
|
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 124 of file GLHelper.cpp.
References Position::x(), and Position::y().
Referenced by GUIVehicle::drawAction_drawVehicleAsPoly(), GUILane::drawArrows(), drawBoxLines(), GUIE3Collector::MyWrapper::drawSingleCrossing(), and drawTextBox().
|
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 140 of file GLHelper.cpp.
References Position::x(), and Position::y().
|
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 |
[in] | cornerDetail | Detail level for filling the corners between angled segments |
Definition at line 157 of file GLHelper.cpp.
References drawBoxLine(), and drawFilledCircle().
Referenced by GUIVehicle::drawBestLanes(), GUIPerson::drawGL(), GUIBusStop::drawGL(), GUI_E2_ZS_Collector::MyWrapper::drawGL(), GUILane::drawGL(), GUILane::drawMarkings(), GUIVehicle::drawRouteHelper(), and GUIPolygon::performTesselation().
|
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 178 of file GLHelper.cpp.
References drawBoxLine(), and MIN4().
|
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 191 of file GLHelper.cpp.
References Position::distanceTo(), drawBoxLine(), RAD2DEG, Position::x(), and Position::y().
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 256 of file GLHelper.cpp.
Referenced by GUIPerson::drawAction_drawAsPoly(), drawAction_drawBlinker(), GUIVehicle::drawAction_drawVehicleAsPoly(), drawAction_drawVehicleBrakeLight(), drawBoxLines(), GUITrafficLightLogicWrapper::drawGL(), GUILaneSpeedTrigger::drawGL(), GUIPointOfInterest::drawGL(), GUIBusStop::drawGL(), GUITriggeredRerouter::GUITriggeredRerouterEdge::drawGL(), and GUIVehicle::drawLinkItem().
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 262 of file GLHelper.cpp.
References DEG2RAD, myCircleCoords, and SUMOReal.
|
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 71 of file GLHelper.cpp.
References Position::x(), and Position::y().
Referenced by GUIJunctionWrapper::drawGL(), and GUILane::drawGL().
|
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 90 of file GLHelper.cpp.
References combCallback().
Referenced by GUIJunctionWrapper::drawGL(), and GUILane::drawGL().
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 205 of file GLHelper.cpp.
References Position::x(), and Position::y().
Referenced by GUIVehicle::drawBestLanes(), GUI_E2_ZS_Collector::MyWrapper::drawGL(), GUILane::drawGL(), and GUIPolygon::performTesselation().
|
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 218 of file GLHelper.cpp.
References Position::x(), and Position::y().
|
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 233 of file GLHelper.cpp.
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 246 of file GLHelper.cpp.
References Position::x(), and Position::y().
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 294 of file GLHelper.cpp.
|
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 300 of file GLHelper.cpp.
References DEG2RAD, myCircleCoords, and SUMOReal.
|
static |
draw Text with given parameters
Definition at line 378 of file GLHelper.cpp.
References pfdkGetStringWidth(), pfDrawString(), pfSetPosition(), pfSetScale(), setColor(), SUMOReal, Position::x(), and Position::y().
Referenced by GUIBusStop::drawGL(), GUIEdge::drawGL(), GUILane::drawGL(), GUIVehicle::drawLinkItem(), GUIGlObject::drawName(), and GUILane::drawTextAtEnd().
|
static |
draw Text box with given parameters
Definition at line 396 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().
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 341 of file GLHelper.cpp.
References Line::atan2DegreeAngle(), Line::getPositionAtDistance(), Line::length(), and Line::p2().
Referenced by GUILane::drawArrows(), GUILane::drawLane2LaneConnections(), and GUIE3Collector::MyWrapper::drawSingleCrossing().
|
static |
gets the gl-color
Definition at line 367 of file GLHelper.cpp.
Referenced by GUIPerson::drawAction_drawAsPoly(), GUIVehicle::drawAction_drawRailCarriages(), and GUIVehicle::drawAction_drawVehicleAsPoly().
|
static |
Sets the gl-color to this value.
Definition at line 361 of file GLHelper.cpp.
References RGBColor::alpha(), RGBColor::blue(), RGBColor::green(), and RGBColor::red().
Referenced by GUIJunctionWrapper::drawGL(), GUIBusStop::drawGL(), drawText(), drawTextBox(), and GUITLLogicPhasesTrackerWindow::drawValues().
Storage for precomputed sin/cos-values describing a circle.
Definition at line 267 of file GLHelper.h.
Referenced by drawFilledCircle(), and drawOutlineCircle().