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();
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();
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 /****************************************************************************/
Locate junction - button.
Definition: GUIAppEnum.h:307
void paintGLGrid()
paints a grid
static const RGBColor BLUE
Definition: RGBColor.h:192
show vehicle&#39;s current continued from the current position
double ymin() const
Returns minimum y-coordinate.
Definition: Boundary.cpp:131
const std::set< GUIGlID > & getSelected() const
Returns the set of ids of all selected objects.
virtual void buildViewToolBars(GUIGlChildWindow &)
builds the view toolbars
double xmax() const
Returns maximum x-coordinate.
Definition: Boundary.cpp:125
GUICompleteSchemeStorage gSchemeStorage
MSEdge & getEdge() const
Returns the lane&#39;s edge.
Definition: MSLane.h:670
long onCmdCloseLane(FXObject *, FXSelector, void *)
interaction with the simulation
long long int SUMOTime
Definition: SUMOTime.h:35
double scale
information about a lane&#39;s width (temporary, used for a single view)
add rerouter
Definition: GUIAppEnum.h:546
close edge
Definition: GUIAppEnum.h:544
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
Storage for all programs of a single tls.
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: GUIVehicle.h:74
bool setColorScheme(const std::string &name)
set color scheme
GUIGlObjectType
const std::string & getName() const
A lane area vehicles can halt at.
void unlock()
release exclusive access to the simulation state
Definition: GUINet.cpp:538
SUMORTree * myGrid
The visualization speed-up.
MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:561
void switchTo(const std::string &id, const std::string &programID)
Switches the named (id) tls to the named (programID) program.
const std::vector< std::string > & getNames() const
Returns a list of stored settings names.
static RGBColor fromHSV(double h, double s, double v)
Converts the given hsv-triplet to rgb, inspired by http://alvyray.com/Papers/CG/hsv2rgb.htm.
Definition: RGBColor.cpp:299
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:244
void closeTraffic(bool rebuildAllowed=true)
close this lane for traffic
Definition: GUILane.cpp:1290
bool gaming
whether the application is in gaming mode or not
Locate addtional structure - button.
Definition: GUIAppEnum.h:321
void onGamingRightClick(Position pos)
Stores the information about how to visualize structures.
The base class for an intersection.
Definition: MSJunction.h:61
void changeStepAndDuration(MSTLLogicControl &tlcontrol, SUMOTime simStep, int step, SUMOTime stepDuration)
Changes the current phase and her duration.
const double SUMO_const_laneWidth
Definition: StdDefs.h:50
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
GUIMainWindow * myApp
The application.
const SUMOVehicleParameter & getParameter() const
Returns the vehicle&#39;s parameter (including departure definition)
virtual long onCmdFullScreen(FXObject *, FXSelector, void *)
Toggle full screen mode.
virtual const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve breakpoints if provided by the application
void writeFrame(uint8_t *buffer)
bool isActive(const MSTrafficLightLogic *tl) const
Returns whether the given tls program is the currently active for his tls.
static const RGBColor ORANGE
Definition: RGBColor.h:196
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:168
T MAX2(T a, T b)
Definition: StdDefs.h:80
SUMOTime DELTA_T
Definition: SUMOTime.cpp:35
virtual const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
Definition: MSLane.h:428
void lock()
grant exclusive access to the simulation state
Definition: GUINet.cpp:532
void rerouteDRTStop(MSStoppingPlace *busStop)
handle route to accomodate to given stop
Definition: GUIVehicle.cpp:858
const std::string & getID() const
Returns the id.
Definition: Named.h:77
GUIDialog_ViewSettings * myVisualizationChanger
Visualization changer.
A map of named object pointers.
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:32
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
A fixed traffic light logic.
const LaneVector & getLanesAt(int i) const
Returns the list of lanes that are controlled by the signals at the given position.
std::map< const GUIGlObject *, int > myAdditionallyDrawn
List of objects for which GUIGlObject::drawGLAdditional is called.
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:62
A class that stores and controls tls and switching of their programs.
A road/street connecting two junctions (gui-version)
Definition: GUIEdge.h:53
A road/street connecting two junctions.
Definition: MSEdge.h:76
double getEndLanePosition() const
Returns the end position of this stop.
close lane
Definition: GUIAppEnum.h:542
SUMOTime duration
The duration of the phase.
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIEdge.cpp:484
std::vector< MSTrafficLightLogic * > getAllLogics() const
static const RGBColor GREEN
Definition: RGBColor.h:191
Locate polygons - button.
Definition: GUIAppEnum.h:325
int addColor(const T &color, const double threshold, const std::string &name="")
std::string name
The name of this setting.
void setCurrentScheme(const std::string &)
Sets the named scheme as the current.
const std::string & getProgramID() const
Returns this tl-logic&#39;s id.
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
Definition: GUINet.cpp:516
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
long onCmdAddRerouter(FXObject *, FXSelector, void *)
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
Definition: MSNet.h:410
Locate person - button.
Definition: GUIAppEnum.h:317
long onCmdCloseEdge(FXObject *, FXSelector, void *)
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:337
bool myTLSGame
whether game mode was set to &#39;tls&#39;
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
static const std::string SCHEME_NAME_PERMISSION_CODE
GUIVisualizationSettings & get(const std::string &name)
Returns the named scheme.
Locate vehicle - button.
Definition: GUIAppEnum.h:311
bool isGaming() const
return whether the gui is in gaming mode
Definition: GUIMainWindow.h:83
std::vector< std::string > getEdgeDataAttrs() const
return list of loaded edgeData attributes
Definition: GUINet.cpp:620
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:284
static const RGBColor MAGENTA
Definition: RGBColor.h:195
T MIN2(T a, T b)
Definition: StdDefs.h:74
double xmin() const
Returns minimum x-coordinate.
Definition: Boundary.cpp:119
void onGamingClick(Position pos)
handle mouse click in gaming mode
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
Definition: GUILane.cpp:1049
A simple video encoder from RGBA pics to anything ffmpeg can handle.
void startTrack(int id)
Starts vehicle tracking.
Locate edge - button.
Definition: GUIAppEnum.h:309
const NamedObjectCont< MSStoppingPlace * > & getStoppingPlaces(SumoXMLTag category) const
Definition: MSNet.cpp:922
virtual void checkSnapshots()
Checks whether it is time for a snapshot.
FXDEFMAP(GUIViewTraffic) GUIViewTrafficMap[]
std::vector< std::string > getEdgeLaneParamKeys(bool edgeKeys) const
return list of available edge parameters
long onDoubleClicked(FXObject *, FXSelector, void *)
bool isFullScreen()
bool myUseToolTips
use tool tips
void checkSnapshots()
Checks whether it is time for a snapshot.
std::string line
The vehicle&#39;s line (mainly for public transport)
SUMOTime getCurrentTimeStep() const
get the current simulation time
A single child window which contains a view of the simulation area.
void endSnapshot()
Ends a video snapshot.
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
unsigned int GUIGlID
Definition: GUIGlObject.h:43
FXbool makeCurrent()
A reimplementation due to some internal reasons.
static const RGBColor YELLOW
Definition: RGBColor.h:193
std::vector< MSLane * > LaneVector
Definition of the list of arrival lanes subjected to this tls.
static const RGBColor RED
named colors
Definition: RGBColor.h:190
double m2p(double meter) const
meter-to-pixels conversion method
Locate TLS - button.
Definition: GUIAppEnum.h:319
void removeActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
static const RGBColor CYAN
Definition: RGBColor.h:194
GUIVisualizationSettings * myVisualizationSettings
visualization settings
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:83
void saveFrame(const std::string &destFile, FXColor *buf)
Adds a frame to a video snapshot which will be initialized if neccessary.
virtual ~GUIViewTraffic()
destructor
int doPaintGL(int mode, const Boundary &bound)
paint GL
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
Definition: MSEdge.cpp:837
bool contains(const std::string &name) const
Returns the information whether a setting with the given name is stored.
#define INVALID_ID
A storage for options typed value containers)
Definition: OptionsCont.h:90
static const GUIGlID INVALID_ID
Definition: GUIGlObject.h:70
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
Definition: MSLane.h:505
const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve breakpoints from the current runThread
void clear()
Clears the list of selected objects.
std::string getCurrentScheme() const
Returns the name of the currently chosen scheme.
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
virtual double getDelay() const
Returns the delay (should be overwritten by subclasses if applicable)
bool showGrid
Information whether a grid shall be shown.
void drawDecals()
Draws the stored decals.
FXComboBox * getColoringSchemesCombo()
return combobox with the current coloring schemes (standard, fastest standard, real world...
void addSnapshot(SUMOTime time, const std::string &file, const int width=-1, const int height=-1)
Sets the snapshot time to file map.
GUIGlID getGlID() const
Returns the numerical id of the object.
The parent class for traffic light logics.
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
Definition: Position.h:234
void unblockObject(GUIGlID id)
Marks an object as unblocked.
TLSLogicVariants & get(const std::string &id) const
Returns the variants of a named tls.
IDMap::const_iterator end() const
Returns a reference to the end iterator for the internal map.
The class responsible for building and deletion of vehicles.
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:72
const MSLane & getLane() const
Returns the lane this stop is located at.
GUIGlID getObjectUnderCursor()
returns the id of the front object under the cursor using GL_SELECT
Locate poi - button.
Definition: GUIAppEnum.h:323
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
GUIGlID getTrackedID() const
Returns the id of the tracked vehicle (-1 if none)
double ymax() const
Returns maximum y-coordinate.
Definition: Boundary.cpp:137
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
virtual void releaseVehicles() const
Allows to use the container for microsimulation again.
Definition: MSLane.h:458
std::vector< std::string > getEdgeDataAttrs() const
return list of loaded edgeData attributes
void addActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
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
GUISelectedStorage gSelected
A global holder of selected objects.
static bool gUseMesoSim
Definition: MSGlobals.h:91
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
std::vector< MSTrafficLightLogic * > getAllLogics() const
Returns a vector which contains all logics.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
const MSPhaseDefinition & getPhase(int givenstep) const
Returns the definition of the phase from the given position within the plan.
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
void stopTrack()
Stops vehicle tracking.
GUILane * getLaneUnderCursor()
FXPopup * getLocatorPopup()
@ brief return a pointer to locator popup
a junction
IDMap::const_iterator begin() const
Returns a reference to the begin iterator for the internal map.
A MSVehicle extended by some values for usage within the gui.
Definition: GUIVehicle.h:54