void GUILane::drawTLSLinkNo(const GUINet& net) const { unsigned int noLinks = (unsigned int)myLinks.size(); if (noLinks == 0) { return; } // draw all links SUMOReal w = myWidth / (SUMOReal) noLinks; SUMOReal x1 = myHalfLaneWidth; glPushMatrix(); const PositionVector& g = getShape(); const Position& end = g.back(); const Position& f = g[-2]; const Position& s = end; const SUMOReal rot = RAD2DEG(atan2((s.x() - f.x()), (f.y() - s.y()))); glTranslated(end.x(), end.y(), 0); glRotated(rot, 0, 0, 1); for (int i = noLinks; --i >= 0;) { SUMOReal x2 = x1 - (SUMOReal)(w / 2.); int linkNo = net.getLinkTLIndex(myLinks[i]); if (linkNo < 0) { continue; } GLHelper::drawText(toString(linkNo), Position(x2, 0), 0, .6, RGBColor(128, 128, 255, 255), 180); x1 -= w; } glPopMatrix(); }
void GUILaneWrapper::drawTLSLinkNo(const GUINet& net) const { unsigned int noLinks = getLinkNumber(); if (noLinks == 0) { return; } // draw all links SUMOReal w = myLane.getWidth() / (SUMOReal) noLinks; SUMOReal x1 = (SUMOReal)(myLane.getWidth() / 2.); glPushMatrix(); const PositionVector& g = getShape(); const Position& end = g.back(); const Position& f = g[-2]; const Position& s = end; SUMOReal rot = (SUMOReal) atan2((s.x() - f.x()), (f.y() - s.y())) * (SUMOReal) 180.0 / (SUMOReal) PI; glTranslated(end.x(), end.y(), 0); glRotated(rot, 0, 0, 1); for (int i = noLinks; --i >= 0;) { SUMOReal x2 = x1 - (SUMOReal)(w / 2.); int linkNo = net.getLinkTLIndex(getLane().getLinkCont()[i]); if (linkNo < 0) { continue; } GLHelper::drawText(toString(linkNo), Position(x2, 0), 0, .6, RGBColor(128, 128, 255, 255), 180); x1 -= w; } glPopMatrix(); }
void ROWdrawAction_drawTLSLinkNo(const GUINet &net, const GUILaneWrapper &lane) { unsigned int noLinks = lane.getLinkNumber(); if (noLinks==0) { return; } // draw all links SUMOReal w = SUMO_const_laneWidth / (SUMOReal) noLinks; SUMOReal x1 = (SUMOReal)(SUMO_const_laneWidth / 2.); glPushMatrix(); glColor3d(.5, .5, 1); const Position2DVector &g = lane.getShape(); const Position2D &end = g.getEnd(); const Position2D &f = g[-2]; const Position2D &s = end; SUMOReal rot = (SUMOReal) atan2((s.x()-f.x()), (f.y()-s.y()))*(SUMOReal) 180.0/(SUMOReal) PI; glTranslated(end.x(), end.y(), 0); glRotated(rot, 0, 0, 1); for (unsigned int i=0; i<noLinks; ++i) { SUMOReal x2 = x1 - (SUMOReal)(w/2.); int linkNo = net.getLinkTLIndex(lane.getLane().getLinkCont()[i]); if (linkNo<0) { continue; } glPushMatrix(); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); pfSetPosition(0, 0); pfSetScale(1); SUMOReal tw = pfdkGetStringWidth(toString(linkNo).c_str()); glRotated(180, 0, 1, 0); glTranslated(x2-tw/2., 0.5, 0); pfDrawString(toString(linkNo).c_str()); glPopMatrix(); x1 -= w; } glPopMatrix(); }