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