Eclipse SUMO - Simulation of Urban MObility
GUIViewTraffic.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
19 // A view on the simulation; this view is a microscopic one
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #ifdef HAVE_FFMPEG
30 #endif
31 
32 #include <iostream>
33 #include <utility>
34 #include <cmath>
35 #include <limits>
36 #include <guisim/GUINet.h>
37 #include <guisim/GUIEdge.h>
38 #include <guisim/GUILane.h>
39 #include <guisim/GUIVehicle.h>
40 #include <microsim/MSGlobals.h>
41 #include <microsim/MSEdge.h>
42 #include <microsim/MSLane.h>
46 #include <utils/common/RGBColor.h>
48 #include "GUISUMOViewParent.h"
49 #include "GUIViewTraffic.h"
61 #include <utils/gui/div/GLHelper.h>
64 
65 /* -------------------------------------------------------------------------
66  * GUIViewTraffic - FOX callback mapping
67  * ----------------------------------------------------------------------- */
68 FXDEFMAP(GUIViewTraffic) GUIViewTrafficMap[] = {
69  FXMAPFUNC(SEL_COMMAND, MID_CLOSE_LANE, GUIViewTraffic::onCmdCloseLane),
70  FXMAPFUNC(SEL_COMMAND, MID_CLOSE_EDGE, GUIViewTraffic::onCmdCloseEdge),
71  FXMAPFUNC(SEL_COMMAND, MID_ADD_REROUTER, GUIViewTraffic::onCmdAddRerouter),
72 };
73 
74 
75 FXIMPLEMENT_ABSTRACT(GUIViewTraffic, GUISUMOAbstractView, GUIViewTrafficMap, ARRAYNUMBER(GUIViewTrafficMap))
76 
77 
78 // ===========================================================================
79 // member method definitions
80 // ===========================================================================
82  FXComposite* p,
83  GUIMainWindow& app,
84  GUISUMOViewParent* parent,
85  GUINet& net, FXGLVisual* glVis,
86  FXGLCanvas* share) :
87  GUISUMOAbstractView(p, app, parent, net.getVisualisationSpeedUp(), glVis, share),
88  myTrackedID(GUIGlObject::INVALID_ID),
89  myTLSGame(OptionsCont::getOptions().getString("game.mode") == "tls")
90 #ifdef HAVE_FFMPEG
91  , myCurrentVideo(nullptr)
92 #endif
93 {}
94 
95 
97  endSnapshot();
98 }
99 
100 
101 void
103  // build coloring tools
104  {
105  const std::vector<std::string>& names = gSchemeStorage.getNames();
106  for (std::vector<std::string>::const_iterator i = names.begin(); i != names.end(); ++i) {
107  v.getColoringSchemesCombo()->appendItem(i->c_str());
108  if ((*i) == myVisualizationSettings->name) {
109  v.getColoringSchemesCombo()->setCurrentItem(v.getColoringSchemesCombo()->getNumItems() - 1);
110  }
111  }
112  v.getColoringSchemesCombo()->setNumVisible(MAX2(5, (int)names.size() + 1));
113  }
114  // for junctions
115  new FXButton(v.getLocatorPopup(),
116  "\tLocate Junction\tLocate a junction within the network.",
118  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
119  // for edges
120  new FXButton(v.getLocatorPopup(),
121  "\tLocate Street\tLocate a street within the network.",
123  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
124 
125  // for vehicles
126  new FXButton(v.getLocatorPopup(),
127  "\tLocate Vehicle\tLocate a vehicle within the network.",
129  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
130 
131  // for persons
132  if (!MSGlobals::gUseMesoSim) { // there are no persons in mesosim (yet)
133  new FXButton(v.getLocatorPopup(),
134  "\tLocate Vehicle\tLocate a person within the network.",
136  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
137  }
138 
139  // for tls
140  new FXButton(v.getLocatorPopup(),
141  "\tLocate TLS\tLocate a tls within the network.",
143  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
144  // for additional stuff
145  new FXButton(v.getLocatorPopup(),
146  "\tLocate Additional\tLocate an additional structure within the network.",
148  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
149  // for pois
150  new FXButton(v.getLocatorPopup(),
151  "\tLocate PoI\tLocate a PoI within the network.",
153  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
154  // for polygons
155  new FXButton(v.getLocatorPopup(),
156  "\tLocate Polygon\tLocate a Polygon within the network.",
158  ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
159 }
160 
161 
162 bool
163 GUIViewTraffic::setColorScheme(const std::string& name) {
164  if (!gSchemeStorage.contains(name)) {
165  return false;
166  }
167  if (myVisualizationChanger != nullptr) {
168  if (myVisualizationChanger->getCurrentScheme() != name) {
170  }
171  }
172  myVisualizationSettings = &gSchemeStorage.get(name.c_str());
174  update();
175  return true;
176 }
177 
178 
179 void
181  bool hide, double hideThreshold) {
182  assert(!scheme.isFixed());
183  double minValue = std::numeric_limits<double>::infinity();
184  double maxValue = -std::numeric_limits<double>::infinity();
185  // retrieve range
186  if (objectType == GLO_LANE) {
187  // XXX (see #3409) multi-colors are not currently handled. this is a quick hack
188  if (active == 22) {
189  active = 21; // segment height, fall back to start height
190  } else if (active == 24) {
191  active = 23; // segment incline, fall back to total incline
192  }
193  const MSEdgeVector& edges = MSEdge::getAllEdges();
194  for (MSEdgeVector::const_iterator it = edges.begin(); it != edges.end(); ++it) {
196  const double val = static_cast<GUIEdge*>(*it)->getColorValue(s, active);
197  minValue = MIN2(minValue, val);
198  maxValue = MAX2(maxValue, val);
199  } else {
200  const std::vector<MSLane*>& lanes = (*it)->getLanes();
201  for (std::vector<MSLane*>::const_iterator it_l = lanes.begin(); it_l != lanes.end(); it_l++) {
202  const double val = static_cast<GUILane*>(*it_l)->getColorValue(s, active);
203  minValue = MIN2(minValue, val);
204  maxValue = MAX2(maxValue, val);
205  }
206  }
207  }
208  } else if (objectType == GLO_JUNCTION) {
209  if (active == 3) {
210  std::set<const MSJunction*> junctions;
211  for (MSEdge* edge : MSEdge::getAllEdges()) {
212  junctions.insert(edge->getFromJunction());
213  junctions.insert(edge->getToJunction());
214  }
215  for (const MSJunction* junction : junctions) {
216  minValue = MIN2(minValue, junction->getPosition().z());
217  maxValue = MAX2(maxValue, junction->getPosition().z());
218  }
219  }
220  }
222  scheme.clear();
223  // add threshold for every distinct value
224  std::set<SVCPermissions> codes;
225  for (MSEdge* edge : MSEdge::getAllEdges()) {
226  for (MSLane* lane : edge->getLanes()) {
227  codes.insert(lane->getPermissions());
228  }
229  }
230  int step = MAX2(1, 360 / (int)codes.size());
231  int hue = 0;
232  for (SVCPermissions p : codes) {
233  scheme.addColor(RGBColor::fromHSV(hue, 1, 1), p);
234  hue = (hue + step) % 360;
235  }
236  return;
237  }
238 
239  if (minValue != std::numeric_limits<double>::infinity()) {
240  scheme.clear();
241  // add new thresholds
242  if (hide) {
243  minValue = MAX2(hideThreshold + 1, minValue);
244  scheme.addColor(RGBColor(204, 204, 204), hideThreshold);
245  }
246  double range = maxValue - minValue;
247  scheme.addColor(RGBColor::RED, (minValue));
248  scheme.addColor(RGBColor::ORANGE, (minValue + range * 1 / 6.0));
249  scheme.addColor(RGBColor::YELLOW, (minValue + range * 2 / 6.0));
250  scheme.addColor(RGBColor::GREEN, (minValue + range * 3 / 6.0));
251  scheme.addColor(RGBColor::CYAN, (minValue + range * 4 / 6.0));
252  scheme.addColor(RGBColor::BLUE, (minValue + range * 5 / 6.0));
253  scheme.addColor(RGBColor::MAGENTA, (maxValue));
254  }
255 }
256 
257 
258 std::vector<std::string>
260  if (GUINet::getGUIInstance() != nullptr) {
262  }
263  return std::vector<std::string>();
264 }
265 
266 
267 std::vector<std::string>
269  std::set<std::string> keys;
270  for (const MSEdge* e : MSEdge::getAllEdges()) {
271  if (edgeKeys) {
272  for (const auto& item : e->getParametersMap()) {
273  keys.insert(item.first);
274  }
275  } else {
276  for (const auto lane : e->getLanes()) {
277  for (const auto& item : lane->getParametersMap()) {
278  keys.insert(item.first);
279  }
280  }
281  }
282  }
283  return std::vector<std::string>(keys.begin(), keys.end());
284 }
285 
286 
287 int
288 GUIViewTraffic::doPaintGL(int mode, const Boundary& bound) {
289  // (uncomment the next line to check select mode)
290  //myVisualizationSettings->drawForSelecting = true;
291  // init view settings
292  glRenderMode(mode);
293  glMatrixMode(GL_MODELVIEW);
294  glPushMatrix();
295  glDisable(GL_TEXTURE_2D);
296  glDisable(GL_ALPHA_TEST);
297  glEnable(GL_BLEND);
298  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
299  glEnable(GL_DEPTH_TEST);
300 
301  // draw decals (if not in grabbing mode)
302  if (!myUseToolTips) {
303  drawDecals();
305  paintGLGrid();
306  }
307  }
308 
309  glLineWidth(1);
310  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
311  const float minB[2] = { (float)bound.xmin(), (float)bound.ymin() };
312  const float maxB[2] = { (float)bound.xmax(), (float)bound.ymax() };
314  glEnable(GL_POLYGON_OFFSET_FILL);
315  glEnable(GL_POLYGON_OFFSET_LINE);
316  int hits2 = myGrid->Search(minB, maxB, *myVisualizationSettings);
317  // Draw additional objects
318  if (myAdditionallyDrawn.size() > 0) {
319  glTranslated(0, 0, -.01);
321  for (auto i : myAdditionallyDrawn) {
322  i.first->drawGLAdditional(this, *myVisualizationSettings);
323  }
325  glTranslated(0, 0, .01);
326  }
327  glPopMatrix();
328  /*
329  // draw legends
330  glMatrixMode(GL_MODELVIEW);
331  glLoadIdentity();
332  glTranslated(1.-.2, 1.-.5, 0.);
333  glScaled(.2, .5, 1.);
334  GUIColoringSchemesMap<GUILane> &sm = GUIViewTraffic::getLaneSchemesMap(); //!!!
335  sm.getColorer(myVisualizationSettings->laneEdgeMode)->drawLegend();
336  */
337  return hits2;
338 }
339 
340 
341 void
343  myTrackedID = id;
344 }
345 
346 
347 void
350 }
351 
352 
353 GUIGlID
355  return myTrackedID;
356 }
357 
358 
359 void
361  if (myTLSGame) {
363  const std::vector<MSTrafficLightLogic*>& logics = tlsControl.getAllLogics();
364  MSTrafficLightLogic* minTll = nullptr;
365  double minDist = std::numeric_limits<double>::infinity();
366  for (std::vector<MSTrafficLightLogic*>::const_iterator i = logics.begin(); i != logics.end(); ++i) {
367  // get the logic
368  MSTrafficLightLogic* tll = (*i);
369  if (tlsControl.isActive(tll) && tll->getProgramID() != "off") {
370  // get the links
371  const MSTrafficLightLogic::LaneVector& lanes = tll->getLanesAt(0);
372  if (lanes.size() > 0) {
373  const Position& endPos = lanes[0]->getShape().back();
374  if (endPos.distanceTo(pos) < minDist) {
375  minDist = endPos.distanceTo(pos);
376  minTll = tll;
377  }
378  }
379  }
380  }
381  if (minTll != nullptr) {
382  const MSTLLogicControl::TLSLogicVariants& vars = tlsControl.get(minTll->getID());
383  const std::vector<MSTrafficLightLogic*> logics = vars.getAllLogics();
384  if (logics.size() > 1) {
386  for (int i = 0; i < (int)logics.size() - 1; ++i) {
387  if (minTll->getProgramID() == logics[i]->getProgramID()) {
388  l = (MSSimpleTrafficLightLogic*) logics[i + 1];
389  tlsControl.switchTo(minTll->getID(), l->getProgramID());
390  }
391  }
392  if (l == logics[0]) {
393  tlsControl.switchTo(minTll->getID(), l->getProgramID());
394  }
396  update();
397  }
398  }
399  } else {
400  // DRT game
402  return;
403  }
404  const std::set<GUIGlID>& sel = gSelected.getSelected(GLO_VEHICLE);
405  if (sel.size() == 0) {
406  // find closest pt vehicle
407  double minDist = std::numeric_limits<double>::infinity();
408  GUIVehicle* closest = nullptr;
412  for (it = vc.loadedVehBegin(); it != end; ++it) {
413  GUIVehicle* veh = dynamic_cast<GUIVehicle*>(it->second);
414  assert(veh != 0);
415  if (veh->getParameter().line != "") {
416  const double dist = veh->getPosition().distanceTo2D(pos);
417  if (dist < minDist) {
418  minDist = dist;
419  closest = veh;
420  }
421  }
422  }
423  if (closest != nullptr) {
424  gSelected.select(closest->getGlID());
426  }
427  } else {
428  // find closest pt stop
429  double minDist = std::numeric_limits<double>::infinity();
430  MSStoppingPlace* closestStop = nullptr;
432  for (auto it = stops.begin(); it != stops.end(); ++it) {
433  MSStoppingPlace* stop = it->second;
434  const double dist = pos.distanceTo2D(stop->getLane().geometryPositionAtOffset(stop->getEndLanePosition()));
435  if (dist < minDist) {
436  minDist = dist;
437  closestStop = stop;
438  }
439  }
440  if (closestStop != 0) {
441  GUIGlID id = *sel.begin();
442  GUIVehicle* veh = dynamic_cast<GUIVehicle*>(GUIGlObjectStorage::gIDStorage.getObjectBlocking(id));
443  assert(veh != 0);
444  MSLane* lane = veh->getLane();
445  lane->getVehiclesSecure();
446  veh->rerouteDRTStop(closestStop);
448  lane->releaseVehicles();
449  }
450  }
451  }
452 }
453 
454 
455 void
457  const std::set<GUIGlID>& sel = gSelected.getSelected(GLO_VEHICLE);
458  if (sel.size() > 0) {
459  GUIGlID id = *sel.begin();
460  GUIVehicle* veh = dynamic_cast<GUIVehicle*>(GUIGlObjectStorage::gIDStorage.getObjectBlocking(id));
461  if (veh != 0) {
463  }
465  }
466  gSelected.clear();
467 }
468 
469 
470 SUMOTime
473 }
474 
475 
476 GUILane*
478  if (makeCurrent()) {
479  int id = getObjectUnderCursor();
480  if (id != 0) {
482  if (o != nullptr) {
483  return dynamic_cast<GUILane*>(o);
484  }
485  }
486  makeNonCurrent();
487  }
488  return nullptr;
489 }
490 
491 long
492 GUIViewTraffic::onCmdCloseLane(FXObject*, FXSelector, void*) {
493  GUILane* lane = getLaneUnderCursor();
494  if (lane != nullptr) {
495  lane->closeTraffic();
497  update();
498  }
499  return 1;
500 }
501 
502 
503 long
504 GUIViewTraffic::onCmdCloseEdge(FXObject*, FXSelector, void*) {
505  GUILane* lane = getLaneUnderCursor();
506  if (lane != nullptr) {
507  dynamic_cast<GUIEdge*>(&lane->getEdge())->closeTraffic(lane);
509  update();
510  }
511  return 1;
512 }
513 
514 
515 long
516 GUIViewTraffic::onCmdAddRerouter(FXObject*, FXSelector, void*) {
517  GUILane* lane = getLaneUnderCursor();
518  if (lane != nullptr) {
519  dynamic_cast<GUIEdge*>(&lane->getEdge())->addRerouter();
521  update();
522  }
523  return 1;
524 }
525 
526 
527 long
528 GUIViewTraffic::onDoubleClicked(FXObject*, FXSelector, void*) {
529  // leave fullscreen mode
530  if (myApp->isFullScreen()) {
531  myApp->onCmdFullScreen(nullptr, 0, nullptr);
532  } else {
533  stopTrack();
534  }
535  return 1;
536 }
537 
538 
539 
540 void
541 GUIViewTraffic::saveFrame(const std::string& destFile, FXColor* buf) {
542 #ifdef HAVE_FFMPEG
543  if (myCurrentVideo == nullptr) {
544  myCurrentVideo = new GUIVideoEncoder(destFile.c_str(), getWidth(), getHeight(), myApp->getDelay());
545  }
546  myCurrentVideo->writeFrame((uint8_t*)buf);
547 #else
548  UNUSED_PARAMETER(destFile);
549  UNUSED_PARAMETER(buf);
550 #endif
551 }
552 
553 
554 void
556 #ifdef HAVE_FFMPEG
557  if (myCurrentVideo != nullptr) {
558  delete myCurrentVideo;
559  myCurrentVideo = nullptr;
560  }
561 #endif
562 }
563 
564 
565 void
567 #ifdef HAVE_FFMPEG
568  if (myCurrentVideo != nullptr) {
570  }
571 #endif
573 }
574 
575 
576 const std::vector<SUMOTime>
578  return myApp->retrieveBreakpoints();
579 }
580 
581 
582 /****************************************************************************/
MSLane::releaseVehicles
virtual void releaseVehicles() const
Allows to use the container for microsimulation again.
Definition: MSLane.h:458
MID_LOCATEPOI
Locate poi - button.
Definition: GUIAppEnum.h:323
GUICompleteSchemeStorage.h
MSStoppingPlace::getLane
const MSLane & getLane() const
Returns the lane this stop is located at.
Definition: MSStoppingPlace.cpp:58
GUIViewTraffic.h
MID_LOCATETLS
Locate TLS - button.
Definition: GUIAppEnum.h:319
UNUSED_PARAMETER
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:32
GUIVisualizationSettings::name
std::string name
The name of this setting.
Definition: GUIVisualizationSettings.h:397
GUISUMOAbstractView::makeCurrent
FXbool makeCurrent()
A reimplementation due to some internal reasons.
Definition: GUISUMOAbstractView.cpp:821
GUIMainWindow::getDelay
virtual double getDelay() const
Returns the delay (should be overwritten by subclasses if applicable)
Definition: GUIMainWindow.h:107
MSLane::getVehiclesSecure
virtual const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
Definition: MSLane.h:428
GUIViewTraffic::endSnapshot
void endSnapshot()
Ends a video snapshot.
Definition: GUIViewTraffic.cpp:555
MID_CLOSE_EDGE
close edge
Definition: GUIAppEnum.h:544
MFXImageHelper.h
MSSimpleTrafficLightLogic::getPhase
const MSPhaseDefinition & getPhase(int givenstep) const
Returns the definition of the phase from the given position within the plan.
Definition: MSSimpleTrafficLightLogic.cpp:116
MSBaseVehicle::getParameter
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
Definition: MSBaseVehicle.cpp:143
MSStoppingPlace
A lane area vehicles can halt at.
Definition: MSStoppingPlace.h:60
MIN2
T MIN2(T a, T b)
Definition: StdDefs.h:74
MID_LOCATEEDGE
Locate edge - button.
Definition: GUIAppEnum.h:309
GUIVehicle.h
MSTLLogicControl::isActive
bool isActive(const MSTrafficLightLogic *tl) const
Returns whether the given tls program is the currently active for his tls.
Definition: MSTLLogicControl.cpp:648
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:73
MSTLLogicControl.h
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
GUISUMOViewParent
A single child window which contains a view of the simulation area.
Definition: GUISUMOViewParent.h:59
GUIViewTraffic
Definition: GUIViewTraffic.h:55
Boundary::ymin
double ymin() const
Returns minimum y-coordinate.
Definition: Boundary.cpp:131
MSJunction
The base class for an intersection.
Definition: MSJunction.h:61
MSStoppingPlace::getEndLanePosition
double getEndLanePosition() const
Returns the end position of this stop.
Definition: MSStoppingPlace.cpp:70
MSTrafficLightLogic::getProgramID
const std::string & getProgramID() const
Returns this tl-logic's id.
Definition: MSTrafficLightLogic.h:172
DELTA_T
SUMOTime DELTA_T
Definition: SUMOTime.cpp:35
GUINet::getGUIInstance
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
Definition: GUINet.cpp:516
GUIViewTraffic::stopTrack
void stopTrack()
Stops vehicle tracking.
Definition: GUIViewTraffic.cpp:348
GUIVideoEncoder
A simple video encoder from RGBA pics to anything ffmpeg can handle.
Definition: GUIVideoEncoder.h:71
GUISUMOAbstractView::m2p
double m2p(double meter) const
meter-to-pixels conversion method
Definition: GUISUMOAbstractView.cpp:751
GUIVisualizationSettings::SCHEME_NAME_PERMISSION_CODE
static const std::string SCHEME_NAME_PERMISSION_CODE
Definition: GUIVisualizationSettings.h:646
GUIVisualizationSettings::showGrid
bool showGrid
Information whether a grid shall be shown.
Definition: GUIVisualizationSettings.h:418
RGBColor::YELLOW
static const RGBColor YELLOW
Definition: RGBColor.h:193
GUISUMOAbstractView::getObjectUnderCursor
GUIGlID getObjectUnderCursor()
returns the id of the front object under the cursor using GL_SELECT
Definition: GUISUMOAbstractView.cpp:327
GUIGlobalSelection.h
GUIVehicle::rerouteDRTStop
void rerouteDRTStop(MSStoppingPlace *busStop)
handle route to accomodate to given stop
Definition: GUIVehicle.cpp:858
RGBColor::CYAN
static const RGBColor CYAN
Definition: RGBColor.h:194
MSTLLogicControl::getAllLogics
std::vector< MSTrafficLightLogic * > getAllLogics() const
Returns a vector which contains all logics.
Definition: MSTLLogicControl.cpp:573
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
GUIViewTraffic::getEdgeDataAttrs
std::vector< std::string > getEdgeDataAttrs() const
return list of loaded edgeData attributes
Definition: GUIViewTraffic.cpp:259
GUIViewTraffic::onCmdCloseLane
long onCmdCloseLane(FXObject *, FXSelector, void *)
interaction with the simulation
Definition: GUIViewTraffic.cpp:492
Boundary::xmax
double xmax() const
Returns maximum x-coordinate.
Definition: Boundary.cpp:125
GUIViewTraffic::getLaneUnderCursor
GUILane * getLaneUnderCursor()
Definition: GUIViewTraffic.cpp:477
GUIMainWindow::isFullScreen
bool isFullScreen()
Definition: GUIMainWindow.h:134
MSJunctionControl.h
ICON_LOCATEEDGE
Definition: GUIIcons.h:77
SUMO_const_laneWidth
const double SUMO_const_laneWidth
Definition: StdDefs.h:50
MSGlobals::gUseMesoSim
static bool gUseMesoSim
Definition: MSGlobals.h:91
GUISUMOAbstractView::checkSnapshots
virtual void checkSnapshots()
Checks whether it is time for a snapshot.
Definition: GUISUMOAbstractView.cpp:1235
MID_LOCATEPERSON
Locate person - button.
Definition: GUIAppEnum.h:317
MSEdge.h
GLO_VEHICLE
Definition: GUIGlObjectTypes.h:142
GLHelper.h
ICON_LOCATETLS
Definition: GUIIcons.h:82
GUINet.h
GUIIconSubSys::getIcon
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
Definition: GUIIconSubSys.cpp:602
GUILane::closeTraffic
void closeTraffic(bool rebuildAllowed=true)
close this lane for traffic
Definition: GUILane.cpp:1290
MSVehicleControl::constVehIt
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
Definition: MSVehicleControl.h:75
MSSimpleTrafficLightLogic.h
GUIViewTraffic::onGamingClick
void onGamingClick(Position pos)
handle mouse click in gaming mode
Definition: GUIViewTraffic.cpp:360
RGBColor.h
GUIMainWindow::retrieveBreakpoints
virtual const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve breakpoints if provided by the application
Definition: GUIMainWindow.h:139
GUIGlObjectStorage.h
GUIAppEnum.h
ICON_LOCATEADD
Definition: GUIIcons.h:83
GUIGlObjectType
GUIGlObjectType
Definition: GUIGlObjectTypes.h:40
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:80
GUICompleteSchemeStorage::getNames
const std::vector< std::string > & getNames() const
Returns a list of stored settings names.
Definition: GUICompleteSchemeStorage.cpp:100
SUMOVehicleParameter::line
std::string line
The vehicle's line (mainly for public transport)
Definition: SUMOVehicleParameter.h:555
GUISUMOAbstractView.h
RGBColor
Definition: RGBColor.h:40
GUIBaseVehicle::removeActiveAddVisualisation
void removeActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIBaseVehicle.cpp:685
MSTrafficLightLogic::LaneVector
std::vector< MSLane * > LaneVector
Definition of the list of arrival lanes subjected to this tls.
Definition: MSTrafficLightLogic.h:71
MSTLLogicControl::TLSLogicVariants::getAllLogics
std::vector< MSTrafficLightLogic * > getAllLogics() const
Definition: MSTLLogicControl.cpp:180
MSPhaseDefinition::duration
SUMOTime duration
The duration of the phase.
Definition: MSPhaseDefinition.h:71
RGBColor::MAGENTA
static const RGBColor MAGENTA
Definition: RGBColor.h:195
GUIGlObject::INVALID_ID
static const GUIGlID INVALID_ID
Definition: GUIGlObject.h:70
MSNet::getStoppingPlaces
const NamedObjectCont< MSStoppingPlace * > & getStoppingPlaces(SumoXMLTag category) const
Definition: MSNet.cpp:922
MSTLLogicControl::get
TLSLogicVariants & get(const std::string &id) const
Returns the variants of a named tls.
Definition: MSTLLogicControl.cpp:584
GUIMainWindow::isGaming
bool isGaming() const
return whether the gui is in gaming mode
Definition: GUIMainWindow.h:83
NamedObjectCont
A map of named object pointers.
Definition: NamedObjectCont.h:44
ICON_LOCATEJUNCTION
Definition: GUIIcons.h:76
Boundary::xmin
double xmin() const
Returns minimum x-coordinate.
Definition: Boundary.cpp:119
GUISelectedStorage::select
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
Definition: GUISelectedStorage.cpp:114
SVCPermissions
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
Definition: SUMOVehicleClass.h:219
GUIPerspectiveChanger.h
RGBColor::ORANGE
static const RGBColor ORANGE
Definition: RGBColor.h:196
GUIPropertyScheme::clear
void clear()
Definition: GUIPropertyScheme.h:105
GUILane.h
Position::distanceTo
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
Definition: Position.h:234
GUIPropertyScheme::isFixed
bool isFixed() const
Definition: GUIPropertyScheme.h:158
SUMORTree.h
GUIViewTraffic::getTrackedID
GUIGlID getTrackedID() const
Returns the id of the tracked vehicle (-1 if none)
Definition: GUIViewTraffic.cpp:354
MSNet::getCurrentTimeStep
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:284
GUIVehicle
A MSVehicle extended by some values for usage within the gui.
Definition: GUIVehicle.h:54
MSVehicleControl::loadedVehEnd
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
Definition: MSVehicleControl.h:186
NamedObjectCont::begin
IDMap::const_iterator begin() const
Returns a reference to the begin iterator for the internal map.
Definition: NamedObjectCont.h:145
ICON_LOCATEPOI
Definition: GUIIcons.h:84
GUISUMOAbstractView::addSnapshot
void addSnapshot(SUMOTime time, const std::string &file, const int width=-1, const int height=-1)
Sets the snapshot time to file map.
Definition: GUISUMOAbstractView.cpp:1059
GUIGlObject::getGlID
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.cpp:150
MID_ADD_REROUTER
add rerouter
Definition: GUIAppEnum.h:546
update
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
RGBColor::BLUE
static const RGBColor BLUE
Definition: RGBColor.h:192
GUIVisualizationSettings::scale
double scale
information about a lane's width (temporary, used for a single view)
Definition: GUIVisualizationSettings.h:623
ICON_LOCATEPOLY
Definition: GUIIcons.h:85
GUIApplicationWindow.h
GUISUMOViewParent.h
GUISUMOAbstractView::myAdditionallyDrawn
std::map< const GUIGlObject *, int > myAdditionallyDrawn
List of objects for which GUIGlObject::drawGLAdditional is called.
Definition: GUISUMOAbstractView.h:500
GUIViewTraffic::onDoubleClicked
long onDoubleClicked(FXObject *, FXSelector, void *)
Definition: GUIViewTraffic.cpp:528
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
gSchemeStorage
GUICompleteSchemeStorage gSchemeStorage
Definition: GUICompleteSchemeStorage.cpp:39
MSSimpleTrafficLightLogic
A fixed traffic light logic.
Definition: MSSimpleTrafficLightLogic.h:55
MSGlobals.h
GUIViewTraffic::retrieveBreakpoints
const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve breakpoints from the current runThread
Definition: GUIViewTraffic.cpp:577
RGBColor::RED
static const RGBColor RED
named colors
Definition: RGBColor.h:190
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:90
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:76
GLO_LANE
a lane
Definition: GUIGlObjectTypes.h:49
GUIViewTraffic::buildColorRainbow
void buildColorRainbow(const GUIVisualizationSettings &s, GUIColorScheme &scheme, int active, GUIGlObjectType objectType, bool hide=false, double hideThreshold=0)
recalibrate color scheme according to the current value range
Definition: GUIViewTraffic.cpp:180
MSTrafficLightLogic
The parent class for traffic light logics.
Definition: MSTrafficLightLogic.h:56
GUISUMOAbstractView::myVisualizationSettings
GUIVisualizationSettings * myVisualizationSettings
visualization settings
Definition: GUISUMOAbstractView.h:461
GUISUMOAbstractView::drawDecals
void drawDecals()
Draws the stored decals.
Definition: GUISUMOAbstractView.cpp:1497
RGBColor::fromHSV
static RGBColor fromHSV(double h, double s, double v)
Converts the given hsv-triplet to rgb, inspired by http://alvyray.com/Papers/CG/hsv2rgb....
Definition: RGBColor.cpp:299
GUIGlObjectStorage::getObjectBlocking
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
Definition: GUIGlObjectStorage.cpp:63
GUIViewTraffic::setColorScheme
bool setColorScheme(const std::string &name)
set color scheme
Definition: GUIViewTraffic.cpp:163
GUIGlObject
Definition: GUIGlObject.h:66
GUIDialog_ViewSettings.h
GUINet::lock
void lock()
grant exclusive access to the simulation state
Definition: GUINet.cpp:532
GUIViewTraffic::~GUIViewTraffic
virtual ~GUIViewTraffic()
destructor
Definition: GUIViewTraffic.cpp:96
ICON_LOCATEPERSON
Definition: GUIIcons.h:81
MSVehicle::getLane
MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:561
GUISelectedStorage::clear
void clear()
Clears the list of selected objects.
Definition: GUISelectedStorage.cpp:177
MSLane::getEdge
MSEdge & getEdge() const
Returns the lane's edge.
Definition: MSLane.h:670
GUIIconSubSys.h
Position::distanceTo2D
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:244
INVALID_ID
#define INVALID_ID
Definition: NWWriter_OpenDrive.cpp:41
GUIViewTraffic::getEdgeLaneParamKeys
std::vector< std::string > getEdgeLaneParamKeys(bool edgeKeys) const
return list of available edge parameters
Definition: GUIViewTraffic.cpp:268
GUIViewTraffic::checkSnapshots
void checkSnapshots()
Checks whether it is time for a snapshot.
Definition: GUIViewTraffic.cpp:566
ICON_LOCATEVEHICLE
Definition: GUIIcons.h:78
GLIncludes.h
GUIBaseVehicle::VO_SHOW_FUTURE_ROUTE
show vehicle's current continued from the current position
Definition: GUIBaseVehicle.h:307
GUIGlObjectStorage::unblockObject
void unblockObject(GUIGlID id)
Marks an object as unblocked.
Definition: GUIGlObjectStorage.cpp:120
MSNet::getTLSControl
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
Definition: MSNet.h:410
GUILane
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:62
SUMO_TAG_BUS_STOP
A bus stop.
Definition: SUMOXMLDefinitions.h:98
GUIVideoEncoder.h
MSTLLogicControl::switchTo
void switchTo(const std::string &id, const std::string &programID)
Switches the named (id) tls to the named (programID) program.
Definition: MSTLLogicControl.cpp:668
MSNet::getInstance
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:168
GUIMainWindow
Definition: GUIMainWindow.h:47
GUIDialog_ViewSettings::setCurrentScheme
void setCurrentScheme(const std::string &)
Sets the named scheme as the current.
Definition: GUIDialog_ViewSettings.cpp:1747
MID_LOCATEJUNCTION
Locate junction - button.
Definition: GUIAppEnum.h:307
MID_CLOSE_LANE
close lane
Definition: GUIAppEnum.h:542
FXDEFMAP
FXDEFMAP(GUIViewTraffic) GUIViewTrafficMap[]
GUIViewTraffic::onCmdCloseEdge
long onCmdCloseEdge(FXObject *, FXSelector, void *)
Definition: GUIViewTraffic.cpp:504
MSSimpleTrafficLightLogic::changeStepAndDuration
void changeStepAndDuration(MSTLLogicControl &tlcontrol, SUMOTime simStep, int step, SUMOTime stepDuration)
Changes the current phase and her duration.
Definition: MSSimpleTrafficLightLogic.cpp:188
NamedObjectCont::end
IDMap::const_iterator end() const
Returns a reference to the end iterator for the internal map.
Definition: NamedObjectCont.h:150
GUIMainWindow::onCmdFullScreen
virtual long onCmdFullScreen(FXObject *, FXSelector, void *)
Toggle full screen mode.
Definition: GUIMainWindow.h:130
GUIGlID
unsigned int GUIGlID
Definition: GUIGlObject.h:43
GUISUMOAbstractView::myApp
GUIMainWindow * myApp
The application.
Definition: GUISUMOAbstractView.h:437
GUIViewTraffic::myTrackedID
GUIGlID myTrackedID
Definition: GUIViewTraffic.h:132
GUIViewTraffic::doPaintGL
int doPaintGL(int mode, const Boundary &bound)
paint GL
Definition: GUIViewTraffic.cpp:288
GUIEdge.h
MSEdgeVector
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:72
GUINet::unlock
void unlock()
release exclusive access to the simulation state
Definition: GUINet.cpp:538
GUIPropertyScheme::getName
const std::string & getName() const
Definition: GUIPropertyScheme.h:138
GUIViewTraffic::buildViewToolBars
virtual void buildViewToolBars(GUIGlChildWindow &)
builds the view toolbars
Definition: GUIViewTraffic.cpp:102
GUISUMOAbstractView::myGrid
SUMORTree * myGrid
The visualization speed-up.
Definition: GUISUMOAbstractView.h:443
GUIGlObjectStorage::gIDStorage
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
Definition: GUIGlObjectStorage.h:141
GUISUMOAbstractView::paintGLGrid
void paintGLGrid()
paints a grid
Definition: GUISUMOAbstractView.cpp:520
gSelected
GUISelectedStorage gSelected
A global holder of selected objects.
Definition: GUIGlobalSelection.cpp:34
GUIGlChildWindow::getColoringSchemesCombo
FXComboBox * getColoringSchemesCombo()
return combobox with the current coloring schemes (standard, fastest standard, real world....
Definition: GUIGlChildWindow.cpp:184
MID_LOCATEVEHICLE
Locate vehicle - button.
Definition: GUIAppEnum.h:311
GUISUMOAbstractView::myUseToolTips
bool myUseToolTips
use tool tips
Definition: GUISUMOAbstractView.h:464
MSTLLogicControl::TLSLogicVariants
Storage for all programs of a single tls.
Definition: MSTLLogicControl.h:86
GUIPropertyScheme::addColor
int addColor(const T &color, const double threshold, const std::string &name="")
Definition: GUIPropertyScheme.h:81
GUIViewTraffic::getCurrentTimeStep
SUMOTime getCurrentTimeStep() const
get the current simulation time
Definition: GUIViewTraffic.cpp:471
config.h
SUMORTree::Search
virtual int Search(const float a_min[2], const float a_max[2], const GUIVisualizationSettings &c) const
Find all within search rectangle.
Definition: SUMORTree.h:119
MSVehicleControl
The class responsible for building and deletion of vehicles.
Definition: MSVehicleControl.h:72
GUIViewTraffic::saveFrame
void saveFrame(const std::string &destFile, FXColor *buf)
Adds a frame to a video snapshot which will be initialized if neccessary.
Definition: GUIViewTraffic.cpp:541
GUISUMOAbstractView::myVisualizationChanger
GUIDialog_ViewSettings * myVisualizationChanger
Visualization changer.
Definition: GUISUMOAbstractView.h:476
GLO_JUNCTION
a junction
Definition: GUIGlObjectTypes.h:51
MSLane::geometryPositionAtOffset
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
Definition: MSLane.h:505
MSTLLogicControl
A class that stores and controls tls and switching of their programs.
Definition: MSTLLogicControl.h:60
RGBColor::GREEN
static const RGBColor GREEN
Definition: RGBColor.h:191
MSVehicleControl::loadedVehBegin
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
Definition: MSVehicleControl.h:178
MSLane.h
GUIGlChildWindow
Definition: GUIGlChildWindow.h:41
GUIViewTraffic::myTLSGame
bool myTLSGame
whether game mode was set to 'tls'
Definition: GUIViewTraffic.h:135
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346
GUISelectedStorage::getSelected
const std::set< GUIGlID > & getSelected() const
Returns the set of ids of all selected objects.
Definition: GUISelectedStorage.cpp:165
MID_LOCATEPOLY
Locate polygons - button.
Definition: GUIAppEnum.h:325
GUINet
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:83
GUIVehicle::getPosition
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: GUIVehicle.h:74
GUINet::getEdgeDataAttrs
std::vector< std::string > getEdgeDataAttrs() const
return list of loaded edgeData attributes
Definition: GUINet.cpp:620
GUIViewTraffic::startTrack
void startTrack(int id)
Starts vehicle tracking.
Definition: GUIViewTraffic.cpp:342
MSEdge::getAllEdges
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
Definition: MSEdge.cpp:837
GUICompleteSchemeStorage::contains
bool contains(const std::string &name) const
Returns the information whether a setting with the given name is stored.
Definition: GUICompleteSchemeStorage.cpp:75
GUIVideoEncoder::writeFrame
void writeFrame(uint8_t *buffer)
Definition: GUIVideoEncoder.h:199
MID_LOCATEADD
Locate addtional structure - button.
Definition: GUIAppEnum.h:321
GUIVisualizationSettings::gaming
bool gaming
whether the application is in gaming mode or not
Definition: GUIVisualizationSettings.h:626
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:77
GUIViewTraffic::onCmdAddRerouter
long onCmdAddRerouter(FXObject *, FXSelector, void *)
Definition: GUIViewTraffic.cpp:516
GUICompleteSchemeStorage::get
GUIVisualizationSettings & get(const std::string &name)
Returns the named scheme.
Definition: GUICompleteSchemeStorage.cpp:63
PositionVector.h
GUIGlChildWindow::getLocatorPopup
FXPopup * getLocatorPopup()
@ brief return a pointer to locator popup
Definition: GUIGlChildWindow.cpp:178
GUIDialog_ViewSettings::getCurrentScheme
std::string getCurrentScheme() const
Returns the name of the currently chosen scheme.
Definition: GUIDialog_ViewSettings.cpp:1741
MSNet::getVehicleControl
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:337
GUIPropertyScheme
Definition: GUIPropertyScheme.h:46
GUIViewTraffic::onGamingRightClick
void onGamingRightClick(Position pos)
Definition: GUIViewTraffic.cpp:456
MFXCheckableButton.h
Boundary::ymax
double ymax() const
Returns maximum y-coordinate.
Definition: Boundary.cpp:137
GUIVisualizationSettings::drawForSelecting
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
Definition: GUIVisualizationSettings.h:635
GUIBaseVehicle::addActiveAddVisualisation
void addActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIBaseVehicle.cpp:675
MSTrafficLightLogic::getLanesAt
const LaneVector & getLanesAt(int i) const
Returns the list of lanes that are controlled by the signals at the given position.
Definition: MSTrafficLightLogic.h:189