SUMO - Simulation of Urban MObility
GUINet.cpp
Go to the documentation of this file.
1 /****************************************************************************/
10 // A MSNet extended by some values for usage within the gui
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <utility>
33 #include <set>
34 #include <vector>
35 #include <map>
43 #include <utils/common/RGBColor.h>
45 #include <microsim/MSNet.h>
46 #include <microsim/MSJunction.h>
48 #include <microsim/MSEdge.h>
54 #include <guisim/GUIEdge.h>
55 #include <guisim/GUILane.h>
62 #include <gui/GUIGlobals.h>
63 #include "GUINet.h"
64 
66 
67 
68 // ===========================================================================
69 // definition of static variables used for visualisation of objects' values
70 // ===========================================================================
71 template std::vector< GLObjectValuePassConnector<double>* > GLObjectValuePassConnector<double>::myContainer;
73 
74 template std::vector< GLObjectValuePassConnector<std::pair<int, class MSPhaseDefinition> >* > GLObjectValuePassConnector<std::pair<int, class MSPhaseDefinition> >::myContainer;
76 
77 
78 // ===========================================================================
79 // member method definitions
80 // ===========================================================================
81 GUINet::GUINet(MSVehicleControl* vc, MSEventControl* beginOfTimestepEvents,
82  MSEventControl* endOfTimestepEvents, MSEventControl* insertionEvents) :
83  MSNet(vc, beginOfTimestepEvents, endOfTimestepEvents, insertionEvents, new GUIShapeContainer(myGrid)),
85  myLastSimDuration(0), /*myLastVisDuration(0),*/ myLastIdleDuration(0),
86  myLastVehicleMovementCount(0), myOverallVehicleCount(0), myOverallSimDuration(0) {
88 }
89 
90 
92  if (myLock.locked()) {
93  myLock.unlock();
94  }
95  // delete allocated wrappers
96  // of junctions
97  for (std::vector<GUIJunctionWrapper*>::iterator i1 = myJunctionWrapper.begin(); i1 != myJunctionWrapper.end(); i1++) {
98  delete(*i1);
99  }
100  // of additional structures
102  // of tl-logics
103  for (Logics2WrapperMap::iterator i3 = myLogics2Wrapper.begin(); i3 != myLogics2Wrapper.end(); i3++) {
104  delete(*i3).second;
105  }
106  // of detectors
107  for (std::vector<GUIDetectorWrapper*>::iterator i = myDetectorWrapper.begin(); i != myDetectorWrapper.end(); ++i) {
108  delete *i;
109  }
110 }
111 
112 
113 const Boundary&
115  return myBoundary;
116 }
117 
118 
121  if (myPersonControl == 0) {
123  }
124  return *myPersonControl;
125 }
126 
127 
130  if (myContainerControl == 0) {
132  }
133  return *myContainerControl;
134 }
135 
136 
137 void
139  // get the list of loaded tl-logics
140  const std::vector<MSTrafficLightLogic*>& logics = getTLSControl().getAllLogics();
141  // allocate storage for the wrappers
142  myTLLogicWrapper.reserve(logics.size());
143  // go through the logics
144  for (std::vector<MSTrafficLightLogic*>::const_iterator i = logics.begin(); i != logics.end(); ++i) {
145  createTLWrapper(*i);
146  }
147 }
148 
149 
150 GUIGlID
152  if (myLogics2Wrapper.count(tll) > 0) {
153  return myLogics2Wrapper[tll]->getGlID();
154  }
155  // get the links
156  const MSTrafficLightLogic::LinkVectorVector& links = tll->getLinks();
157  if (links.size() == 0) { // @legacy this should never happen in 0.13.0+ networks
158  return 0;
159  }
160  // build the wrapper
163  // build the association link->wrapper
164  MSTrafficLightLogic::LinkVectorVector::const_iterator j;
165  for (j = links.begin(); j != links.end(); ++j) {
166  MSTrafficLightLogic::LinkVector::const_iterator j2;
167  for (j2 = (*j).begin(); j2 != (*j).end(); ++j2) {
168  myLinks2Logic[*j2] = tll->getID();
169  }
170  }
172  myLogics2Wrapper[tll] = tllw;
173  return tllw->getGlID();
174 }
175 
176 
177 Position
178 GUINet::getJunctionPosition(const std::string& name) const {
179  // !!! no check for existance!
180  return myJunctions->get(name)->getPosition();
181 }
182 
183 
184 bool
185 GUINet::vehicleExists(const std::string& name) const {
186  return myVehicleControl->getVehicle(name) != 0;
187 }
188 
189 
190 int
192  if (myLinks2Logic.count(link) == 0) {
193  assert(false);
194  return 0;
195  }
196  MSTrafficLightLogic* tll = myLogics->getActive(myLinks2Logic.find(link)->second);
197  if (myLogics2Wrapper.count(tll) == 0) {
198  // tll may have been added via traci. @see ticket #459
199  return 0;
200  }
201  return myLogics2Wrapper.find(tll)->second->getGlID();
202 }
203 
204 
205 int
207  Links2LogicMap::const_iterator i = myLinks2Logic.find(link);
208  if (i == myLinks2Logic.end()) {
209  return -1;
210  }
211  if (myLogics2Wrapper.find(myLogics->getActive((*i).second)) == myLogics2Wrapper.end()) {
212  return -1;
213  }
214  return myLogics2Wrapper.find(myLogics->getActive((*i).second))->second->getLinkIndex(link);
215 }
216 
217 
218 void
222 }
223 
224 
225 void
229 }
230 
231 
232 std::vector<GUIGlID>
233 GUINet::getJunctionIDs(bool includeInternal) const {
234  std::vector<GUIGlID> ret;
235  for (std::vector<GUIJunctionWrapper*>::const_iterator i = myJunctionWrapper.begin(); i != myJunctionWrapper.end(); ++i) {
236  if (!(*i)->isInternal() || includeInternal) {
237  ret.push_back((*i)->getGlID());
238  }
239  }
240  return ret;
241 }
242 
243 
244 std::vector<GUIGlID>
246  std::vector<GUIGlID> ret;
247  std::vector<std::string> ids;
248  for (std::map<MSTrafficLightLogic*, GUITrafficLightLogicWrapper*>::const_iterator i = myLogics2Wrapper.begin(); i != myLogics2Wrapper.end(); ++i) {
249  std::string sid = (*i).second->getMicrosimID();
250  if (find(ids.begin(), ids.end(), sid) == ids.end()) {
251  ret.push_back((*i).second->getGlID());
252  ids.push_back(sid);
253  }
254  }
255  return ret;
256 }
257 
258 
259 void
261  // initialise detector storage for gui
262  const std::vector<SumoXMLTag> types = myDetectorControl->getAvailableTypes();
263  for (std::vector<SumoXMLTag>::const_iterator i = types.begin(); i != types.end(); ++i) {
264  const std::map<std::string, MSDetectorFileOutput*>& dets = myDetectorControl->getTypedDetectors(*i).getMyMap();
265  for (std::map<std::string, MSDetectorFileOutput*>::const_iterator j = dets.begin(); j != dets.end(); ++j) {
266  GUIDetectorWrapper* wrapper = (*j).second->buildDetectorGUIRepresentation();
267  if (wrapper != 0) {
268  myDetectorWrapper.push_back(wrapper);
269  myGrid.addAdditionalGLObject(wrapper);
270  }
271  }
272  }
273  // initialise the tl-map
274  initTLMap();
275  // initialise edge storage for gui
276  const MSEdgeVector& edges = MSEdge::getAllEdges();
277  myEdgeWrapper.reserve(edges.size());
278  for (MSEdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) {
279  // VISIM connector edges shall be drawn (they have lanes)
280  if (!(*i)->isTazConnector() || (*i)->getLanes().size() > 0) {
281  myEdgeWrapper.push_back(static_cast<GUIEdge*>(*i));
282  }
283  }
284  // initialise junction storage for gui
285  int size = myJunctions->size();
286  myJunctionWrapper.reserve(size);
287  const std::map<std::string, MSJunction*>& junctions = myJunctions->getMyMap();
288  for (std::map<std::string, MSJunction*>::const_iterator i = junctions.begin(); i != junctions.end(); ++i) {
289  myJunctionWrapper.push_back(new GUIJunctionWrapper(*(*i).second));
290  }
291  // build the visualization tree
292  for (std::vector<GUIEdge*>::iterator i = myEdgeWrapper.begin(); i != myEdgeWrapper.end(); ++i) {
293  GUIEdge* edge = *i;
294  Boundary b;
295  const std::vector<MSLane*>& lanes = edge->getLanes();
296  for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
297  b.add((*j)->getShape().getBoxBoundary());
298  }
299  // make sure persons are always drawn and selectable since they depend on their edge being drawn
301  const float cmin[2] = { (float)b.xmin(), (float)b.ymin() };
302  const float cmax[2] = { (float)b.xmax(), (float)b.ymax() };
303  myGrid.Insert(cmin, cmax, edge);
304  myBoundary.add(b);
305  if (myBoundary.getWidth() > 10e16 || myBoundary.getHeight() > 10e16) {
306  throw ProcessError("Network size exceeds 1 Lightyear. Please reconsider your inputs.\n");
307  }
308  }
309  for (std::vector<GUIJunctionWrapper*>::iterator i = myJunctionWrapper.begin(); i != myJunctionWrapper.end(); ++i) {
310  GUIJunctionWrapper* junction = *i;
311  Boundary b = junction->getBoundary();
312  b.grow(2.);
313  const float cmin[2] = { (float)b.xmin(), (float)b.ymin() };
314  const float cmax[2] = { (float)b.xmax(), (float)b.ymax() };
315  myGrid.Insert(cmin, cmax, junction);
316  myBoundary.add(b);
317  }
319 }
320 
321 
322 int
324  return myLastSimDuration +/*myLastVisDuration+*/myLastIdleDuration;
325 }
326 
327 
328 int
330  return myLastSimDuration;
331 }
332 
333 /*
334 int
335 GUINet::getVisDuration() const
336 {
337  return myLastVisDuration;
338 }
339 */
340 
341 
342 double
344  if (myLastSimDuration == 0) {
345  return -1;
346  }
347  return (double) 1000. / (double) myLastSimDuration;
348 }
349 
350 
351 double
352 GUINet::getUPS() const {
353  if (myLastSimDuration == 0) {
354  return -1;
355  }
356  return (double) myLastVehicleMovementCount / (double) myLastSimDuration * (double) 1000.;
357 }
358 
359 
360 double
361 GUINet::getMeanRTFactor(int duration) const {
362  if (myOverallSimDuration == 0) {
363  return -1;
364  }
365  return ((double)(duration) * (double) 1000. / (double)myOverallSimDuration);
366 }
367 
368 
369 double
371  if (myOverallSimDuration == 0) {
372  return -1;
373  }
374  return ((double)myVehiclesMoved / (double)myOverallSimDuration * (double) 1000.);
375 }
376 
377 
378 int
380  return myLastIdleDuration;
381 }
382 
383 
384 void
386  myLastSimDuration = val;
387  myOverallSimDuration += val;
390 }
391 
392 /*
393 void
394 GUINet::setVisDuration(int val)
395 {
396  myLastVisDuration = val;
397 }
398 */
399 
400 void
402  myLastIdleDuration = val;
403 }
404 
405 
408  GUISUMOAbstractView& parent) {
409  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
410  buildPopupHeader(ret, app);
413  buildPositionCopyEntry(ret, false);
414  return ret;
415 }
416 
417 
422  new GUIParameterTableWindow(app, *this, 32);
423  // add items
424  ret->mkItem("loaded vehicles [#]", true,
426  ret->mkItem("insertion-backlogged vehicles [#]", true,
428  ret->mkItem("departed vehicles [#]", true,
430  ret->mkItem("running vehicles [#]", true,
432  ret->mkItem("arrived vehicles [#]", true,
434  ret->mkItem("collisions [#]", true,
436  ret->mkItem("teleports [#]", true,
438  ret->mkItem("halting [#]", true,
440  ret->mkItem("mean speed [m/s]", true,
442  ret->mkItem("mean speed relative", true,
444  if (myPersonControl != 0) {
445  ret->mkItem("loaded persons [#]", true,
447  ret->mkItem("running persons [#]", true,
449  ret->mkItem("jammed persons [#]", true,
451  }
452  ret->mkItem("end time [s]", false, OptionsCont::getOptions().getString("end"));
453  ret->mkItem("begin time [s]", false, OptionsCont::getOptions().getString("begin"));
454 // ret->mkItem("time step [s]", true, new FunctionBinding<GUINet, SUMOTime>(this, &GUINet::getCurrentTimeStep));
455  if (logSimulationDuration()) {
456  ret->mkItem("step duration [ms]", true, new FunctionBinding<GUINet, int>(this, &GUINet::getWholeDuration));
457  ret->mkItem("simulation duration [ms]", true, new FunctionBinding<GUINet, int>(this, &GUINet::getSimDuration));
458  /*
459  ret->mkItem("visualisation duration [ms]", true,
460  new CastingFunctionBinding<GUINet, double, int>(
461  &(getNet()), &GUINet::getVisDuration));
462  */
463  ret->mkItem("idle duration [ms]", true, new FunctionBinding<GUINet, int>(this, &GUINet::getIdleDuration));
464  ret->mkItem("duration factor []", true, new FunctionBinding<GUINet, double>(this, &GUINet::getRTFactor));
465  /*
466  ret->mkItem("mean duration factor []", true,
467  new FuncBinding_IntParam<GUINet, double>(
468  &(getNet()), &GUINet::getMeanRTFactor), 1);
469  */
470  ret->mkItem("ups [#]", true, new FunctionBinding<GUINet, double>(this, &GUINet::getUPS));
471  ret->mkItem("mean ups [#]", true, new FunctionBinding<GUINet, double>(this, &GUINet::getMeanUPS));
472  if (OptionsCont::getOptions().getBool("duration-log.statistics")) {
473  ret->mkItem("avg. trip length [m]", true, new FunctionBinding<GUINet, double>(this, &GUINet::getAvgRouteLength));
474  ret->mkItem("avg. trip duration [s]", true, new FunctionBinding<GUINet, double>(this, &GUINet::getAvgDuration));
475  ret->mkItem("avg. trip waiting time [s]", true, new FunctionBinding<GUINet, double>(this, &GUINet::getAvgWaitingTime));
476  ret->mkItem("avg. trip time loss [s]", true, new FunctionBinding<GUINet, double>(this, &GUINet::getAvgTimeLoss));
477  ret->mkItem("avg. trip depart delay [s]", true, new FunctionBinding<GUINet, double>(this, &GUINet::getAvgDepartDelay));
478  ret->mkItem("avg. trip speed [m/s]", true, new FunctionBinding<GUINet, double>(this, &GUINet::getAvgTripSpeed));
479  }
480  }
481  ret->mkItem("nodes [#]", false, (int)getJunctionIDs(false).size());
482  ret->mkItem("edges [#]", false, (int)GUIEdge::getIDs(false).size());
483  ret->mkItem("total edge length [km]", false, GUIEdge::getTotalLength(false, false) / 1000);
484  ret->mkItem("total lane length [km]", false, GUIEdge::getTotalLength(false, true) / 1000);
485  ret->mkItem("network version ", false, toString(myVersion));
486 
487  // close building
488  ret->closeBuilding();
489  return ret;
490 }
491 
492 
493 void
495 }
496 
497 Boundary
499  return getBoundary();
500 }
501 
502 
503 GUINet*
505  GUINet* net = dynamic_cast<GUINet*>(MSNet::getInstance());
506  if (net != 0) {
507  return net;
508  }
509  throw ProcessError("A gui-network was not yet constructed.");
510 }
511 
512 
515  return dynamic_cast<GUIVehicleControl*>(myVehicleControl);
516 }
517 
518 
519 void
521  myLock.lock();
522 }
523 
524 
525 void
527  myLock.unlock();
528 }
529 
532  return dynamic_cast<GUIMEVehicleControl*>(myVehicleControl);
533 }
534 
535 
536 #ifdef HAVE_OSG
537 void
538 GUINet::updateColor(const GUIVisualizationSettings& s) {
539  for (std::vector<GUIEdge*>::const_iterator i = myEdgeWrapper.begin(); i != myEdgeWrapper.end(); ++i) {
540  if (!(*i)->isInternal()) {
541  const std::vector<MSLane*>& lanes = (*i)->getLanes();
542  for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
543  static_cast<GUILane*>(*j)->updateColor(s);
544  }
545  }
546  }
547  for (std::vector<GUIJunctionWrapper*>::iterator i = myJunctionWrapper.begin(); i != myJunctionWrapper.end(); ++i) {
548  (*i)->updateColor(s);
549  }
550 }
551 #endif
552 
553 /****************************************************************************/
554 
Boundary getBoundary() const
Returns the boundary of the junction.
int getIdleDuration() const
Returns the duration of the last step&#39;s idle part (in ms)
Definition: GUINet.cpp:379
int myLastSimDuration
The step durations (simulation, /*visualisation, */idle)
Definition: GUINet.h:365
double xmax() const
Returns maximum x-coordinate.
Definition: Boundary.cpp:132
int getTeleportCount() const
return the number of teleports (including collisions)
Boundary myBoundary
The networks boundary.
Definition: GUINet.h:337
int getRunningNumber() const
Returns the number of build and inserted, but not yet deleted transportables.
The class responsible for building and deletion of vehicles (gui-version)
int getDepartedVehicleNo() const
Returns the number of inserted vehicles.
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
std::vector< GUIJunctionWrapper * > myJunctionWrapper
Wrapped MS-junctions.
Definition: GUINet.h:343
Storage for geometrical objects extended by mutexes.
friend class GUITrafficLightLogicWrapper
Definition: GUINet.h:91
void unlock()
release exclusive access to the simulation state
Definition: GUINet.cpp:526
const std::vector< MSLane * > & getLanes() const
Returns this edge&#39;s lanes.
Definition: MSEdge.h:168
MSVehicleControl * myVehicleControl
Controls vehicle building and deletion;.
Definition: MSNet.h:732
int getLinkTLID(MSLink *link) const
Definition: GUINet.cpp:191
double ymax() const
Returns maximum y-coordinate.
Definition: Boundary.cpp:144
Stores the information about how to visualize structures.
LayeredRTree myGrid
The visualization speed-up.
Definition: GUINet.h:334
void initTLMap()
Initialises the tl-logic map and wrappers.
Definition: GUINet.cpp:138
double getMeanRTFactor(int duration) const
Returns the simulation speed as a factor to real time.
Definition: GUINet.cpp:361
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
MSTrafficLightLogic * getActive(const std::string &id) const
Returns the active program of a named tls.
GUIMEVehicleControl * getGUIMEVehicleControl()
Returns the vehicle control.
Definition: GUINet.cpp:531
The class responsible for building and deletion of vehicles (gui-version)
~GUINet()
Destructor.
Definition: GUINet.cpp:91
double getAvgDepartDelay() const
Definition: GUINet.h:222
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:169
double getAvgDuration() const
Definition: GUINet.h:213
int getCollisionCount() const
return the number of collisions
void initGUIStructures()
Initialises gui wrappers.
Definition: GUINet.cpp:260
static const double SIDEWALK_OFFSET
the offset for computing person positions when walking on edges without a sidewalk ...
Definition: MSPModel.h:117
int getEndedVehicleNo() const
Returns the number of removed vehicles.
double myVersion
the network version
Definition: MSNet.h:817
double getMeanUPS() const
Returns the update per seconds rate.
Definition: GUINet.cpp:370
void lock()
grant exclusive access to the simulation state
Definition: GUINet.cpp:520
Links2LogicMap myLinks2Logic
The link-to-logic-id map.
Definition: GUINet.h:355
Position getJunctionPosition(const std::string &name) const
returns the position of a junction
Definition: GUINet.cpp:178
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
int myLastIdleDuration
Definition: GUINet.h:365
long myOverallVehicleCount
Definition: GUINet.h:367
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used, also builds an entry for copying the geo-position.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUINet.cpp:494
GUIGlID getGlID() const
Returns the numerical id of the object.
const Boundary & getBoundary() const
returns the bounder of the network
Definition: GUINet.cpp:114
int getWaitingVehicleNo() const
Returns the number of waiting vehicles.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
void setIdleDuration(int val)
Sets the duration of the last step&#39;s idle part.
Definition: GUINet.cpp:401
The simulated network and simulation perfomer.
Definition: MSNet.h:89
void setNetObject(GUIGlObject *object)
Sets the given object as the "network" object.
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:65
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:70
T get(const std::string &id) const
Retrieves an item.
double getVehicleMeanSpeedRelative() const
Definition: MSNet.h:709
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUINet.cpp:407
Logics2WrapperMap myLogics2Wrapper
The traffic light-to-wrapper map.
Definition: GUINet.h:361
double getUPS() const
Returns the update per seconds rate.
Definition: GUINet.cpp:352
A road/street connecting two junctions (gui-version)
Definition: GUIEdge.h:60
const std::string & getID() const
Returns the id.
Definition: Named.h:66
long long int myVehiclesMoved
The overall number of vehicle movements.
Definition: MSNet.h:777
const NamedObjectCont< MSDetectorFileOutput * > & getTypedDetectors(SumoXMLTag type) const
Returns the list of detectors of the given type.
int getLoadedNumber() const
Returns the number of build transportables.
GUIGlID createTLWrapper(MSTrafficLightLogic *tll)
creates a wrapper for the given logic and returns the GlID
Definition: GUINet.cpp:151
double getWidth() const
Returns the width of the boudary (x-axis)
Definition: Boundary.cpp:162
std::vector< GUIGlID > getJunctionIDs(bool includeInternal) const
Definition: GUINet.cpp:233
std::vector< LinkVector > LinkVectorVector
Definition of a list that holds lists of links that do have the same attribute.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:56
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUINet.cpp:419
std::vector< GUIDetectorWrapper * > myDetectorWrapper
A detector dictionary.
Definition: GUINet.h:349
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
Definition: GUINet.cpp:504
double getHeight() const
Returns the height of the boundary (y-axis)
Definition: Boundary.cpp:168
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
Definition: MSNet.h:378
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:305
const LinkVectorVector & getLinks() const
Returns the list of lists of all affected links.
MSDetectorControl * myDetectorControl
Controls detectors;.
Definition: MSNet.h:746
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
double getVehicleMeanSpeed() const
Definition: MSNet.h:706
MSTLLogicControl * myLogics
Controls tls logics, realizes waiting on tls rules;.
Definition: MSNet.h:742
double getAvgWaitingTime() const
Definition: GUINet.h:216
int getLinkTLIndex(MSLink *link) const
Definition: GUINet.cpp:206
static void clearDictionary()
Clears the dictionary (the objects will not be deleted)
int getRunningVehicleNo() const
Returns the number of build and inserted, but not yet deleted vehicles.
int getHaltingVehicleNumber() const
count number of standing vehicles in the network
Definition: MSNet.cpp:1027
double getRTFactor() const
Returns the simulation speed as a factor to real time.
Definition: GUINet.cpp:343
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:302
double getAvgRouteLength() const
Definition: GUINet.h:210
MSTransportableControl & getPersonControl()
Returns the person control.
Definition: GUINet.cpp:120
const IDMap & getMyMap() const
Returns a reference to the internal map.
unsigned int GUIGlID
Definition: GUIGlObject.h:50
void unlock()
release mutex lock
Definition: MFXMutex.cpp:94
void setSimDuration(int val)
Sets the duration of the last step&#39;s simulation part.
Definition: GUINet.cpp:385
static std::vector< GUIGlID > getIDs(bool includeInternal)
Definition: GUIEdge.cpp:97
std::vector< GUIEdge * > myEdgeWrapper
Wrapped MS-edges.
Definition: GUINet.h:340
const std::vector< SumoXMLTag > getAvailableTypes() const
Returns the list of available detector types.
void Insert(const float a_min[2], const float a_max[2], GUIGlObject *const &a_dataId)
Insert entry (delegate to appropriate layer)
Definition: LayeredRTree.h:79
double getAvgTimeLoss() const
Definition: GUINet.h:219
MSTransportableControl * myContainerControl
Controls container building and deletion;.
Definition: MSNet.h:736
MSJunctionControl * myJunctions
Controls junctions, realizes right-of-way rules;.
Definition: MSNet.h:740
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:89
void addAdditionalGLObject(GUIGlObject *o)
Adds an additional object (detector/shape/trigger) for visualisation.
Definition: SUMORTree.h:129
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:358
MSTransportableControl * myPersonControl
Controls person building and deletion;.
Definition: MSNet.h:734
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
Definition: MSEdge.cpp:778
A mutex encapsulator which locks/unlocks the given mutex on construction/destruction, respectively.
Definition: AbstractMutex.h:71
double xmin() const
Returns minimum x-coordinate.
Definition: Boundary.cpp:126
int getLoadedVehicleNo() const
Returns the number of build vehicles.
long myOverallSimDuration
Definition: GUINet.h:368
The popup menu of a globject.
int getSimDuration() const
Returns the duration of the last step&#39;s simulation part (in ms)
Definition: GUINet.cpp:329
GUIVehicleControl * getGUIVehicleControl()
Returns the vehicle control.
Definition: GUINet.cpp:514
std::vector< GUIGlID > getTLSIDs() const
Returns the gl-ids of all traffic light logics within the net.
Definition: GUINet.cpp:245
bool vehicleExists(const std::string &name) const
returns the information whether the vehicle still exists
Definition: GUINet.cpp:185
double ymin() const
Returns minimum y-coordinate.
Definition: Boundary.cpp:138
void lock()
lock mutex
Definition: MFXMutex.cpp:84
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
The network - empty.
int getJammedNumber() const
Returns the number of times a transportables was jammed.
std::vector< MSTrafficLightLogic * > myTLLogicWrapper
Wrapped TL-Logics.
Definition: GUINet.h:346
The parent class for traffic light logics.
static void updateAll()
Updates all instances (passes values)
void simulationStep()
Performs a single simulation step (locking the simulation)
Definition: GUINet.cpp:226
FXbool locked()
Definition: MFXMutex.h:70
bool logSimulationDuration() const
Returns whether duration shall be logged.
Definition: MSNet.cpp:761
The class responsible for building and deletion of vehicles.
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:78
std::vector< MSTrafficLightLogic * > getAllLogics() const
Returns a vector which contains all logics.
void simulationStep()
Performs a single simulation step.
Definition: MSNet.cpp:439
double getAvgTripSpeed() const
Definition: GUINet.h:225
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:86
GUINet(MSVehicleControl *vc, MSEventControl *beginOfTimestepEvents, MSEventControl *endOfTimestepEvents, MSEventControl *insertionEvents)
Constructor.
Definition: GUINet.cpp:81
static double getTotalLength(bool includeInternal, bool eachLane)
Definition: GUIEdge.cpp:112
void guiSimulationStep()
Some further steps needed for gui processing.
Definition: GUINet.cpp:219
int getWholeDuration() const
Returns the duration of the last step (sim+visualisation+idle) (in ms)
Definition: GUINet.cpp:323
void mkItem(const char *name, bool dynamic, ValueSource< unsigned > *src)
Adds a row which obtains its value from an unsigned-ValueSource.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUINet.cpp:498
A window containing a gl-object&#39;s parameter.
Stores time-dependant events and executes them at the proper time.
long myLastVehicleMovementCount
Definition: GUINet.h:367
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUINet.h:372
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
MSTransportableControl & getContainerControl()
Returns the container control.
Definition: GUINet.cpp:129
const Position & getPosition() const
Definition: MSJunction.cpp:63
int size() const
Returns the number of stored items within the container.
Class passing values from a GUIGlObject to another object.
GUI-version of the transportable control for building gui persons and containers. ...