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