Definition in file GUILaneWrapper.cpp.
#include <config.h>
#include <string>
#include <iostream>
#include <utility>
#include <microsim/MSLane.h>
#include <microsim/MSGlobals.h>
#include <utils/geom/Position2DVector.h>
#include <microsim/MSNet.h>
#include <gui/GUIGlobals.h>
#include <utils/gui/windows/GUISUMOAbstractView.h>
#include "GUILaneWrapper.h"
#include <utils/common/ToString.h>
#include <utils/geom/GeomHelper.h>
#include <guisim/GUINet.h>
#include <utils/gui/windows/GUIAppEnum.h>
#include <utils/gui/images/GUIIconSubSys.h>
#include <utils/gui/div/GUIParameterTableWindow.h>
#include <utils/gui/globjects/GUIGLObjectPopupMenu.h>
#include <gui/GUIApplicationWindow.h>
#include <utils/gui/div/GUIGlobalSelection.h>
#include <utils/common/RandHelper.h>
#include <utils/gui/div/GLHelper.h>
#include <gui/GUIViewTraffic.h>
#include <utils/gui/images/GUITexturesHelper.h>
#include <guisim/GUIVehicle.h>
#include <foreign/polyfonts/polyfonts.h>
#include <utils/common/HelpersHarmonoise.h>
Go to the source code of this file.
Functions | |
| void | ROWdrawAction_drawArrows (const GUILaneWrapper &lane, bool showToolTips) |
| void | ROWdrawAction_drawLane2LaneConnections (const GUILaneWrapper &lane) |
| void | ROWdrawAction_drawLinkNo (const GUILaneWrapper &lane) |
| void | ROWdrawAction_drawLinkRules (const GUINet &net, const GUILaneWrapper &lane, bool showToolTips) |
| void | ROWdrawAction_drawTLSLinkNo (const GUINet &net, const GUILaneWrapper &lane) |
| void ROWdrawAction_drawArrows | ( | const GUILaneWrapper & | lane, | |
| bool | showToolTips | |||
| ) |
Definition at line 305 of file GUILaneWrapper.cpp.
References GUITexturesHelper::drawDirectionArrow(), Position2DVector::getEnd(), GUILaneWrapper::getLinkDirection(), GUILaneWrapper::getLinkNumber(), GUILaneWrapper::getLinkState(), GUILaneWrapper::getShape(), MSLink::LINKDIR_NODIR, MSLink::LINKSTATE_TL_OFF_NOSIGNAL, PI, SUMOReal, Position2D::x(), and Position2D::y().
Referenced by GUILaneWrapper::drawGL().
00305 { 00306 unsigned int noLinks = lane.getLinkNumber(); 00307 if (noLinks==0) { 00308 return; 00309 } 00310 // draw all links 00311 const Position2D &end = lane.getShape().getEnd(); 00312 const Position2D &f = lane.getShape()[-2]; 00313 const Position2D &s = end; 00314 SUMOReal rot = (SUMOReal) atan2((s.x()-f.x()), (f.y()-s.y()))*(SUMOReal) 180.0/(SUMOReal) PI; 00315 glPushMatrix(); 00316 if (showToolTips) { 00317 glPushName(0); 00318 } 00319 glColor3d(1, 1, 1); 00320 glEnable(GL_TEXTURE_2D); 00321 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 00322 glDisable(GL_CULL_FACE); 00323 //glDisable(GL_DEPTH_TEST); 00324 glDisable(GL_LIGHTING); 00325 glDisable(GL_COLOR_MATERIAL); 00326 glDisable(GL_TEXTURE_GEN_S); 00327 glDisable(GL_TEXTURE_GEN_T); 00328 glDisable(GL_ALPHA_TEST); 00329 glEnable(GL_BLEND); 00330 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 00331 00332 glTranslated(end.x(), end.y(), 0); 00333 glRotated(rot, 0, 0, 1); 00334 for (unsigned int i=0; i<noLinks; ++i) { 00335 MSLink::LinkDirection dir = lane.getLinkDirection(i); 00336 MSLink::LinkState state = lane.getLinkState(i); 00337 if (state==MSLink::LINKSTATE_TL_OFF_NOSIGNAL||dir==MSLink::LINKDIR_NODIR) { 00338 continue; 00339 } 00340 GUITexturesHelper::drawDirectionArrow((GUITexture) dir, 1.5, 4.0, -1.5, 1); 00341 } 00342 glBindTexture(GL_TEXTURE_2D, 0); 00343 glPopMatrix(); 00344 if (showToolTips) { 00345 glPopName(); 00346 } 00347 }
| void ROWdrawAction_drawLane2LaneConnections | ( | const GUILaneWrapper & | lane | ) |
Definition at line 351 of file GUILaneWrapper.cpp.
References GLHelper::drawTriangleAtEnd(), GUILaneWrapper::getLinkLane(), GUILaneWrapper::getLinkNumber(), GUILaneWrapper::getLinkState(), MSLane::getShape(), GUILaneWrapper::getShape(), MSLink::LINKSTATE_DEADEND, MSLink::LINKSTATE_EQUAL, MSLink::LINKSTATE_MAJOR, MSLink::LINKSTATE_MINOR, MSLink::LINKSTATE_TL_GREEN_MAJOR, MSLink::LINKSTATE_TL_GREEN_MINOR, MSLink::LINKSTATE_TL_OFF_BLINKING, MSLink::LINKSTATE_TL_OFF_NOSIGNAL, MSLink::LINKSTATE_TL_RED, MSLink::LINKSTATE_TL_YELLOW_MAJOR, MSLink::LINKSTATE_TL_YELLOW_MINOR, SUMOReal, Position2D::x(), and Position2D::y().
Referenced by GUILaneWrapper::drawGL().
00351 { 00352 unsigned int noLinks = lane.getLinkNumber(); 00353 for (unsigned int i=0; i<noLinks; ++i) { 00354 MSLink::LinkState state = lane.getLinkState(i); 00355 const MSLane *connected = lane.getLinkLane(i); 00356 if (connected==0) { 00357 continue; 00358 } 00359 switch (state) { 00360 case MSLink::LINKSTATE_TL_GREEN_MAJOR: 00361 case MSLink::LINKSTATE_TL_GREEN_MINOR: 00362 glColor3d(0, 1, 0); 00363 break; 00364 case MSLink::LINKSTATE_TL_RED: 00365 glColor3d(1, 0, 0); 00366 break; 00367 case MSLink::LINKSTATE_TL_YELLOW_MAJOR: 00368 case MSLink::LINKSTATE_TL_YELLOW_MINOR: 00369 glColor3d(1, 1, 0); 00370 break; 00371 case MSLink::LINKSTATE_TL_OFF_BLINKING: 00372 glColor3d(1, 1, 0); 00373 break; 00374 case MSLink::LINKSTATE_TL_OFF_NOSIGNAL: 00375 glColor3d(0, 1, 1); 00376 break; 00377 case MSLink::LINKSTATE_MAJOR: 00378 glColor3d(1, 1, 1); 00379 break; 00380 case MSLink::LINKSTATE_MINOR: 00381 glColor3d(.2, .2, .2); 00382 break; 00383 case MSLink::LINKSTATE_EQUAL: 00384 glColor3d(.5, .5, .5); 00385 break; 00386 case MSLink::LINKSTATE_DEADEND: 00387 glColor3d(0, 0, 0); 00388 break; 00389 } 00390 00391 glBegin(GL_LINES); 00392 const Position2D &p1 = lane.getShape()[-1]; 00393 const Position2D &p2 = connected->getShape()[0]; 00394 glVertex2f(p1.x(), p1.y()); 00395 glVertex2f(p2.x(), p2.y()); 00396 glEnd(); 00397 GLHelper::drawTriangleAtEnd(Line2D(p1, p2), (SUMOReal) .4, (SUMOReal) .2); 00398 } 00399 }
| void ROWdrawAction_drawLinkNo | ( | const GUILaneWrapper & | lane | ) |
Definition at line 123 of file GUILaneWrapper.cpp.
References Position2DVector::getEnd(), GUILaneWrapper::getLinkNumber(), GUILaneWrapper::getLinkRespondIndex(), GUILaneWrapper::getShape(), pfdkGetStringWidth(), pfDrawString(), pfSetPosition(), pfSetScale(), PI, SUMO_const_laneWidth, SUMOReal, toString(), Position2D::x(), and Position2D::y().
Referenced by GUILaneWrapper::drawGL().
00123 { 00124 unsigned int noLinks = lane.getLinkNumber(); 00125 if (noLinks==0) { 00126 return; 00127 } 00128 00129 // draw all links 00130 SUMOReal w = SUMO_const_laneWidth / (SUMOReal) noLinks; 00131 SUMOReal x1 = SUMO_const_laneWidth / (SUMOReal) 2.; 00132 glPushMatrix(); 00133 glColor3d(.5, .5, 1); 00134 const Position2DVector &g = lane.getShape(); 00135 const Position2D &end = g.getEnd(); 00136 const Position2D &f = g[-2]; 00137 const Position2D &s = end; 00138 SUMOReal rot = (SUMOReal) atan2((s.x()-f.x()), (f.y()-s.y()))*(SUMOReal) 180.0/(SUMOReal) PI; 00139 glTranslated(end.x(), end.y(), 0); 00140 glRotated(rot, 0, 0, 1); 00141 for (unsigned int i=0; i<noLinks; ++i) { 00142 SUMOReal x2 = x1 - (SUMOReal)(w/2.); 00143 int linkNo = lane.getLinkRespondIndex(i); 00144 glPushMatrix(); 00145 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 00146 pfSetPosition(0, 0); 00147 pfSetScale(1); 00148 SUMOReal tw = pfdkGetStringWidth(toString(linkNo).c_str()); 00149 glRotated(180, 0, 1, 0); 00150 glTranslated(x2-tw/2., 0.5, 0); 00151 pfDrawString(toString(linkNo).c_str()); 00152 glPopMatrix(); 00153 x1 -= w; 00154 } 00155 glPopMatrix(); 00156 }
| void ROWdrawAction_drawLinkRules | ( | const GUINet & | net, | |
| const GUILaneWrapper & | lane, | |||
| bool | showToolTips | |||
| ) |
Definition at line 200 of file GUILaneWrapper.cpp.
References Position2DVector::getEnd(), GUIGlObject::getGlID(), GUILaneWrapper::getLinkNumber(), GUILaneWrapper::getLinkState(), GUILaneWrapper::getLinkTLID(), GUILaneWrapper::getShape(), MSLink::LINKSTATE_DEADEND, MSLink::LINKSTATE_EQUAL, MSLink::LINKSTATE_MAJOR, MSLink::LINKSTATE_MINOR, MSLink::LINKSTATE_TL_GREEN_MAJOR, MSLink::LINKSTATE_TL_GREEN_MINOR, MSLink::LINKSTATE_TL_OFF_BLINKING, MSLink::LINKSTATE_TL_OFF_NOSIGNAL, MSLink::LINKSTATE_TL_RED, MSLink::LINKSTATE_TL_YELLOW_MAJOR, MSLink::LINKSTATE_TL_YELLOW_MINOR, PI, SUMO_const_halfLaneWidth, SUMO_const_laneWidth, SUMOReal, Position2D::x(), and Position2D::y().
Referenced by GUILaneWrapper::drawGL().
00201 { 00202 unsigned int noLinks = lane.getLinkNumber(); 00203 const Position2DVector &g = lane.getShape(); 00204 const Position2D &end = g.getEnd(); 00205 const Position2D &f = g[-2]; 00206 const Position2D &s = end; 00207 SUMOReal rot = (SUMOReal) atan2((s.x()-f.x()), (f.y()-s.y()))*(SUMOReal) 180.0/(SUMOReal) PI; 00208 if (noLinks==0) { 00209 if (showToolTips) { 00210 glPushName(lane.getGlID()); 00211 } 00212 // draw a grey bar if no links are on the street 00213 glColor3d(0.5, 0.5, 0.5); 00214 glPushMatrix(); 00215 glTranslated(end.x(), end.y(), 0); 00216 glRotated(rot, 0, 0, 1); 00217 glBegin(GL_QUADS); 00218 glVertex2d(-SUMO_const_halfLaneWidth, 0.0); 00219 glVertex2d(-SUMO_const_halfLaneWidth, 0.5); 00220 glVertex2d(SUMO_const_halfLaneWidth, 0.5); 00221 glVertex2d(SUMO_const_halfLaneWidth, 0.0); 00222 glEnd(); 00223 glPopMatrix(); 00224 if (showToolTips) { 00225 glPopName(); 00226 } 00227 return; 00228 } 00229 // draw all links 00230 SUMOReal w = SUMO_const_laneWidth / (SUMOReal) noLinks; 00231 SUMOReal x1 = 0; 00232 glPushMatrix(); 00233 glTranslated(end.x(), end.y(), 0); 00234 glRotated(rot, 0, 0, 1); 00235 for (unsigned int i=0; i<noLinks; ++i) { 00236 SUMOReal x2 = x1 + w; 00237 MSLink::LinkState state = lane.getLinkState(i); 00238 if (showToolTips) { 00239 switch (state) { 00240 case MSLink::LINKSTATE_TL_GREEN_MAJOR: 00241 case MSLink::LINKSTATE_TL_GREEN_MINOR: 00242 case MSLink::LINKSTATE_TL_RED: 00243 case MSLink::LINKSTATE_TL_YELLOW_MAJOR: 00244 case MSLink::LINKSTATE_TL_YELLOW_MINOR: 00245 case MSLink::LINKSTATE_TL_OFF_BLINKING: 00246 glPushName(lane.getLinkTLID(net, i)); 00247 break; 00248 case MSLink::LINKSTATE_MAJOR: 00249 case MSLink::LINKSTATE_MINOR: 00250 case MSLink::LINKSTATE_EQUAL: 00251 case MSLink::LINKSTATE_TL_OFF_NOSIGNAL: 00252 default: 00253 glPushName(lane.getGlID()); 00254 break; 00255 } 00256 } 00257 switch (state) { 00258 case MSLink::LINKSTATE_TL_GREEN_MAJOR: 00259 case MSLink::LINKSTATE_TL_GREEN_MINOR: 00260 glColor3d(0, 1, 0); 00261 break; 00262 case MSLink::LINKSTATE_TL_RED: 00263 glColor3d(1, 0, 0); 00264 break; 00265 case MSLink::LINKSTATE_TL_YELLOW_MAJOR: 00266 case MSLink::LINKSTATE_TL_YELLOW_MINOR: 00267 glColor3d(1, 1, 0); 00268 break; 00269 case MSLink::LINKSTATE_TL_OFF_BLINKING: 00270 glColor3d(1, 1, 0); 00271 break; 00272 case MSLink::LINKSTATE_TL_OFF_NOSIGNAL: 00273 glColor3d(0, 1, 1); 00274 break; 00275 case MSLink::LINKSTATE_MAJOR: 00276 glColor3d(1, 1, 1); 00277 break; 00278 case MSLink::LINKSTATE_MINOR: 00279 glColor3d(.2, .2, .2); 00280 break; 00281 case MSLink::LINKSTATE_EQUAL: 00282 glColor3d(.5, .5, .5); 00283 break; 00284 case MSLink::LINKSTATE_DEADEND: 00285 glColor3d(0, 0, 0); 00286 break; 00287 } 00288 glBegin(GL_QUADS); 00289 glVertex2d(x1-SUMO_const_halfLaneWidth, 0.0); 00290 glVertex2d(x1-SUMO_const_halfLaneWidth, 0.5); 00291 glVertex2d(x2-SUMO_const_halfLaneWidth, 0.5); 00292 glVertex2d(x2-SUMO_const_halfLaneWidth,0.0); 00293 glEnd(); 00294 if (showToolTips) { 00295 glPopName(); 00296 } 00297 x1 = x2; 00298 x2 += w; 00299 } 00300 glPopMatrix(); 00301 }
| void ROWdrawAction_drawTLSLinkNo | ( | const GUINet & | net, | |
| const GUILaneWrapper & | lane | |||
| ) |
Definition at line 160 of file GUILaneWrapper.cpp.
References Position2DVector::getEnd(), GUILaneWrapper::getLinkNumber(), GUILaneWrapper::getLinkTLIndex(), GUILaneWrapper::getShape(), pfdkGetStringWidth(), pfDrawString(), pfSetPosition(), pfSetScale(), PI, SUMO_const_laneWidth, SUMOReal, toString(), Position2D::x(), and Position2D::y().
Referenced by GUILaneWrapper::drawGL().
00160 { 00161 unsigned int noLinks = lane.getLinkNumber(); 00162 if (noLinks==0) { 00163 return; 00164 } 00165 00166 // draw all links 00167 SUMOReal w = SUMO_const_laneWidth / (SUMOReal) noLinks; 00168 SUMOReal x1 = (SUMOReal)(SUMO_const_laneWidth / 2.); 00169 glPushMatrix(); 00170 glColor3d(.5, .5, 1); 00171 const Position2DVector &g = lane.getShape(); 00172 const Position2D &end = g.getEnd(); 00173 const Position2D &f = g[-2]; 00174 const Position2D &s = end; 00175 SUMOReal rot = (SUMOReal) atan2((s.x()-f.x()), (f.y()-s.y()))*(SUMOReal) 180.0/(SUMOReal) PI; 00176 glTranslated(end.x(), end.y(), 0); 00177 glRotated(rot, 0, 0, 1); 00178 for (unsigned int i=0; i<noLinks; ++i) { 00179 SUMOReal x2 = x1 - (SUMOReal)(w/2.); 00180 int linkNo = lane.getLinkTLIndex(net, i); 00181 if (linkNo<0) { 00182 continue; 00183 } 00184 glPushMatrix(); 00185 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 00186 pfSetPosition(0, 0); 00187 pfSetScale(1); 00188 SUMOReal tw = pfdkGetStringWidth(toString(linkNo).c_str()); 00189 glRotated(180, 0, 1, 0); 00190 glTranslated(x2-tw/2., 0.5, 0); 00191 pfDrawString(toString(linkNo).c_str()); 00192 glPopMatrix(); 00193 x1 -= w; 00194 } 00195 glPopMatrix(); 00196 }
1.5.6