Eclipse 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-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 /****************************************************************************/
17 // A MSNet extended by some values for usage within the gui
18 /****************************************************************************/
19 // ===========================================================================
20 // included modules
21 // ===========================================================================
22 #include <config.h>
23 
24 #include <utility>
25 #include <set>
26 #include <vector>
27 #include <map>
35 #include <utils/xml/XMLSubSys.h>
37 #include <utils/common/RGBColor.h>
39 #include <microsim/MSNet.h>
41 #include <microsim/MSJunction.h>
43 #include <microsim/MSEdge.h>
49 #include <guisim/GUIEdge.h>
50 #include <guisim/GUILane.h>
57 #include <gui/GUIGlobals.h>
58 #include "GUINet.h"
59 
61 
62 
63 // ===========================================================================
64 // definition of static variables used for visualisation of objects' values
65 // ===========================================================================
66 template std::vector< GLObjectValuePassConnector<double>* > GLObjectValuePassConnector<double>::myContainer;
68 
69 template std::vector< GLObjectValuePassConnector<std::pair<int, class MSPhaseDefinition> >* > GLObjectValuePassConnector<std::pair<int, class MSPhaseDefinition> >::myContainer;
71 
72 
73 // ===========================================================================
74 // member method definitions
75 // ===========================================================================
76 GUINet::GUINet(MSVehicleControl* vc, MSEventControl* beginOfTimestepEvents,
77  MSEventControl* endOfTimestepEvents,
78  MSEventControl* insertionEvents) :
79  MSNet(vc, beginOfTimestepEvents, endOfTimestepEvents, insertionEvents, new GUIShapeContainer(myGrid)),
81  myLastSimDuration(0), /*myLastVisDuration(0),*/ myLastIdleDuration(0),
82  myLastVehicleMovementCount(0), myOverallVehicleCount(0), myOverallSimDuration(0) {
84 }
85 
86 
88  if (myLock.locked()) {
89  myLock.unlock();
90  }
91  // delete allocated wrappers
92  // of junctions
93  for (std::vector<GUIJunctionWrapper*>::iterator i1 = myJunctionWrapper.begin(); i1 != myJunctionWrapper.end(); i1++) {
94  delete (*i1);
95  }
96  // of additional structures
98  // of tl-logics
99  for (Logics2WrapperMap::iterator i3 = myLogics2Wrapper.begin(); i3 != myLogics2Wrapper.end(); i3++) {
100  delete (*i3).second;
101  }
102  // of detectors
103  for (std::vector<GUIDetectorWrapper*>::iterator i = myDetectorWrapper.begin(); i != myDetectorWrapper.end(); ++i) {
104  delete *i;
105  }
106  for (auto& item : myLoadedEdgeData) {
107  delete item.second;
108  }
109 }
110 
111 
112 const Boundary&
114  return myBoundary;
115 }
116 
117 
120  if (myPersonControl == nullptr) {
122  }
123  return *myPersonControl;
124 }
125 
126 
129  if (myContainerControl == nullptr) {
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  // go through the logics
141  for (std::vector<MSTrafficLightLogic*>::const_iterator i = logics.begin(); i != logics.end(); ++i) {
142  createTLWrapper(*i);
143  }
144 }
145 
146 
147 void
149  if (myLogics2Wrapper.count(tll) > 0) {
150  return;
151  }
152  // get the links
153  const MSTrafficLightLogic::LinkVectorVector& links = tll->getLinks();
154  if (links.size() == 0) { // @legacy this should never happen in 0.13.0+ networks
155  return;
156  }
157  // build the wrapper
160  // build the association link->wrapper
161  MSTrafficLightLogic::LinkVectorVector::const_iterator j;
162  for (j = links.begin(); j != links.end(); ++j) {
163  MSTrafficLightLogic::LinkVector::const_iterator j2;
164  for (j2 = (*j).begin(); j2 != (*j).end(); ++j2) {
165  myLinks2Logic[*j2] = tll->getID();
166  }
167  }
169  myLogics2Wrapper[tll] = tllw;
170  return;
171 }
172 
173 
174 Position
175 GUINet::getJunctionPosition(const std::string& name) const {
176  // !!! no check for existance!
177  return myJunctions->get(name)->getPosition();
178 }
179 
180 
181 bool
182 GUINet::vehicleExists(const std::string& name) const {
183  return myVehicleControl->getVehicle(name) != nullptr;
184 }
185 
186 
187 int
189  if (myLinks2Logic.count(link) == 0) {
190  assert(false);
191  return 0;
192  }
193  MSTrafficLightLogic* tll = myLogics->getActive(myLinks2Logic.find(link)->second);
194  if (myLogics2Wrapper.count(tll) == 0) {
195  // tll may have been added via traci. @see ticket #459
196  return 0;
197  }
198  return myLogics2Wrapper.find(tll)->second->getGlID();
199 }
200 
201 
202 int
204  Links2LogicMap::const_iterator i = myLinks2Logic.find(link);
205  if (i == myLinks2Logic.end()) {
206  return -1;
207  }
208  if (myLogics2Wrapper.find(myLogics->getActive((*i).second)) == myLogics2Wrapper.end()) {
209  return -1;
210  }
211  return myLogics2Wrapper.find(myLogics->getActive((*i).second))->second->getLinkIndex(link);
212 }
213 
214 
215 void
219 }
220 
221 
222 void
224  FXMutexLock locker(myLock);
226 }
227 
228 
229 std::vector<GUIGlID>
230 GUINet::getJunctionIDs(bool includeInternal) const {
231  std::vector<GUIGlID> ret;
232  for (std::vector<GUIJunctionWrapper*>::const_iterator i = myJunctionWrapper.begin(); i != myJunctionWrapper.end(); ++i) {
233  if (!(*i)->isInternal() || includeInternal) {
234  ret.push_back((*i)->getGlID());
235  }
236  }
237  return ret;
238 }
239 
240 
241 std::vector<GUIGlID>
243  std::vector<GUIGlID> ret;
244  std::vector<std::string> ids;
245  for (std::map<MSTrafficLightLogic*, GUITrafficLightLogicWrapper*>::const_iterator i = myLogics2Wrapper.begin(); i != myLogics2Wrapper.end(); ++i) {
246  std::string sid = (*i).second->getMicrosimID();
247  if (find(ids.begin(), ids.end(), sid) == ids.end()) {
248  ret.push_back((*i).second->getGlID());
249  ids.push_back(sid);
250  }
251  }
252  return ret;
253 }
254 
255 
256 void
258  // initialise detector storage for gui
259  const std::vector<SumoXMLTag> types = myDetectorControl->getAvailableTypes();
260  for (std::vector<SumoXMLTag>::const_iterator i = types.begin(); i != types.end(); ++i) {
261  for (const auto& j : myDetectorControl->getTypedDetectors(*i)) {
262  GUIDetectorWrapper* wrapper = j.second->buildDetectorGUIRepresentation();
263  if (wrapper != nullptr) {
264  myDetectorWrapper.push_back(wrapper);
265  myGrid.addAdditionalGLObject(wrapper);
266  }
267  }
268  }
269  // initialise the tl-map
270  initTLMap();
271  // initialise edge storage for gui
272  const MSEdgeVector& edges = MSEdge::getAllEdges();
273  myEdgeWrapper.reserve(edges.size());
274  for (MSEdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) {
275  // VISIM connector edges shall be drawn (they have lanes)
276  if (!(*i)->isTazConnector() || (*i)->getLanes().size() > 0) {
277  myEdgeWrapper.push_back(static_cast<GUIEdge*>(*i));
278  }
279  }
280  // initialise junction storage for gui
281  int size = myJunctions->size();
282  myJunctionWrapper.reserve(size);
283  std::map<MSJunction*, std::string> junction2TLL;
284  for (const auto tls : getTLSControl().getAllLogics()) {
285  for (const auto& links : tls->getLinks()) {
286  for (const MSLink* l : links) {
287  junction2TLL[l->getJunction()] = l->getTLLogic()->getID();
288  }
289  }
290  }
291  for (const auto& i : *myJunctions) {
292  myJunctionWrapper.push_back(new GUIJunctionWrapper(*i.second, junction2TLL[i.second]));
293  }
294  // build the visualization tree
295  for (std::vector<GUIEdge*>::iterator i = myEdgeWrapper.begin(); i != myEdgeWrapper.end(); ++i) {
296  GUIEdge* edge = *i;
297  Boundary b;
298  const std::vector<MSLane*>& lanes = edge->getLanes();
299  for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
300  b.add((*j)->getShape().getBoxBoundary());
301  }
302  // make sure persons are always drawn and selectable since they depend on their edge being drawn
304  const float cmin[2] = { (float)b.xmin(), (float)b.ymin() };
305  const float cmax[2] = { (float)b.xmax(), (float)b.ymax() };
306  myGrid.Insert(cmin, cmax, edge);
307  myBoundary.add(b);
308  if (myBoundary.getWidth() > 10e16 || myBoundary.getHeight() > 10e16) {
309  throw ProcessError("Network size exceeds 1 Lightyear. Please reconsider your inputs.\n");
310  }
311  }
312  for (std::vector<GUIJunctionWrapper*>::iterator i = myJunctionWrapper.begin(); i != myJunctionWrapper.end(); ++i) {
313  GUIJunctionWrapper* junction = *i;
314  Boundary b = junction->getBoundary();
315  b.grow(2.);
316  const float cmin[2] = { (float)b.xmin(), (float)b.ymin() };
317  const float cmax[2] = { (float)b.xmax(), (float)b.ymax() };
318  myGrid.Insert(cmin, cmax, junction);
319  myBoundary.add(b);
320  }
322 }
323 
324 
325 int
327  return myLastSimDuration +/*myLastVisDuration+*/myLastIdleDuration;
328 }
329 
330 
331 int
333  return myLastSimDuration;
334 }
335 
336 /*
337 int
338 GUINet::getVisDuration() const
339 {
340  return myLastVisDuration;
341 }
342 */
343 
344 
345 double
347  if (myLastSimDuration == 0) {
348  return -1;
349  }
350  return (double)DELTA_T / (double)myLastSimDuration;
351 }
352 
353 
354 double
355 GUINet::getUPS() const {
356  if (myLastSimDuration == 0) {
357  return -1;
358  }
359  return (double) myLastVehicleMovementCount / (double) myLastSimDuration * (double) 1000.;
360 }
361 
362 
363 double
364 GUINet::getMeanRTFactor(int duration) const {
365  if (myOverallSimDuration == 0) {
366  return -1;
367  }
368  return ((double)(duration) * (double) 1000. / (double)myOverallSimDuration);
369 }
370 
371 
372 double
374  if (myOverallSimDuration == 0) {
375  return -1;
376  }
377  return ((double)myVehiclesMoved / (double)myOverallSimDuration * (double) 1000.);
378 }
379 
380 
381 int
383  return myLastIdleDuration;
384 }
385 
386 
387 void
389  myLastSimDuration = val;
390  myOverallSimDuration += val;
393 }
394 
395 /*
396 void
397 GUINet::setVisDuration(int val)
398 {
399  myLastVisDuration = val;
400 }
401 */
402 
403 void
405  myLastIdleDuration = val;
406 }
407 
408 
411  GUISUMOAbstractView& parent) {
412  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
413  buildPopupHeader(ret, app);
416  buildPositionCopyEntry(ret, false);
417  return ret;
418 }
419 
420 
423  GUISUMOAbstractView& parent) {
425  new GUIParameterTableWindow(app, *this, 36);
426  // add items
427  ret->mkItem("loaded vehicles [#]", true,
429  ret->mkItem("insertion-backlogged vehicles [#]", true,
431  ret->mkItem("departed vehicles [#]", true,
433  ret->mkItem("running vehicles [#]", true,
435  ret->mkItem("arrived vehicles [#]", true,
437  ret->mkItem("discarded vehicles [#]", true,
439  ret->mkItem("collisions [#]", true,
441  ret->mkItem("teleports [#]", true,
443  ret->mkItem("halting [#]", true,
445  ret->mkItem("avg. speed [m/s]", true,
447  ret->mkItem("avg. relative speed", true,
449  if (myPersonControl != nullptr) {
450  ret->mkItem("loaded persons [#]", true,
452  ret->mkItem("running persons [#]", true,
454  ret->mkItem("jammed persons [#]", true,
456  }
457  ret->mkItem("end time [s]", false, OptionsCont::getOptions().getString("end"));
458  ret->mkItem("begin time [s]", false, OptionsCont::getOptions().getString("begin"));
459 // ret->mkItem("time step [s]", true, new FunctionBinding<GUINet, SUMOTime>(this, &GUINet::getCurrentTimeStep));
460  if (logSimulationDuration()) {
461  ret->mkItem("step duration [ms]", true, new FunctionBinding<GUINet, int>(this, &GUINet::getWholeDuration));
463  ret->mkItem("simulation duration [ms]", true, new FunctionBinding<GUINet, int>(this, &GUINet::getSimDuration));
464  /*
465  ret->mkItem("visualisation duration [ms]", true,
466  new CastingFunctionBinding<GUINet, double, int>(
467  &(getNet()), &GUINet::getVisDuration));
468  */
469  ret->mkItem("idle duration [ms]", true, new FunctionBinding<GUINet, int>(this, &GUINet::getIdleDuration));
470  ret->mkItem("duration factor", true, new FunctionBinding<GUINet, double>(this, &GUINet::getRTFactor));
471  /*
472  ret->mkItem("mean duration factor []", true,
473  new FuncBinding_IntParam<GUINet, double>(
474  &(getNet()), &GUINet::getMeanRTFactor), 1);
475  */
476  ret->mkItem("updates per second", true, new FunctionBinding<GUINet, double>(this, &GUINet::getUPS));
477  ret->mkItem("avg. updates per second", true, new FunctionBinding<GUINet, double>(this, &GUINet::getMeanUPS));
478  if (OptionsCont::getOptions().getBool("duration-log.statistics")) {
479  ret->mkItem("avg. trip length [m]", true, new FunctionBinding<GUINet, double>(this, &GUINet::getAvgRouteLength));
480  ret->mkItem("avg. trip duration [s]", true, new FunctionBinding<GUINet, double>(this, &GUINet::getAvgDuration));
481  ret->mkItem("avg. trip waiting time [s]", true, new FunctionBinding<GUINet, double>(this, &GUINet::getAvgWaitingTime));
482  ret->mkItem("avg. trip time loss [s]", true, new FunctionBinding<GUINet, double>(this, &GUINet::getAvgTimeLoss));
483  ret->mkItem("avg. trip depart delay [s]", true, new FunctionBinding<GUINet, double>(this, &GUINet::getAvgDepartDelay));
484  ret->mkItem("avg. trip speed [m/s]", true, new FunctionBinding<GUINet, double>(this, &GUINet::getAvgTripSpeed));
485  if (myPersonControl != nullptr) {
486  ret->mkItem("avg. walk length [m]", true, new FunctionBinding<GUINet, double>(this, &GUINet::getAvgWalkRouteLength));
487  ret->mkItem("avg. walk duration [s]", true, new FunctionBinding<GUINet, double>(this, &GUINet::getAvgWalkDuration));
488  ret->mkItem("avg. walk time loss [s]", true, new FunctionBinding<GUINet, double>(this, &GUINet::getAvgWalkTimeLoss));
489  }
490  }
491  }
492  ret->mkItem("nodes [#]", false, (int)getJunctionIDs(false).size());
493  ret->mkItem("edges [#]", false, (int)GUIEdge::getIDs(false).size());
494  ret->mkItem("total edge length [km]", false, GUIEdge::getTotalLength(false, false) / 1000);
495  ret->mkItem("total lane length [km]", false, GUIEdge::getTotalLength(false, true) / 1000);
496  ret->mkItem("network version ", false, toString(myVersion));
497 
498  // close building
499  ret->closeBuilding();
500  return ret;
501 }
502 
503 
504 void
506 }
507 
508 Boundary
510  return getBoundary();
511 }
512 
513 
514 GUINet*
516  GUINet* net = dynamic_cast<GUINet*>(MSNet::getInstance());
517  if (net != nullptr) {
518  return net;
519  }
520  throw ProcessError("A gui-network was not yet constructed.");
521 }
522 
523 
526  return dynamic_cast<GUIVehicleControl*>(myVehicleControl);
527 }
528 
529 
530 void
532  myLock.lock();
533 }
534 
535 
536 void
538  myLock.unlock();
539 }
540 
543  return dynamic_cast<GUIMEVehicleControl*>(myVehicleControl);
544 }
545 
546 
547 double
548 GUINet::getEdgeData(const MSEdge* edge, const std::string& attr) {
549  auto it = myLoadedEdgeData.find(attr);
550  if (it != myLoadedEdgeData.end()) {
551  double value;
552  bool found = it->second->retrieveExistingEffort(edge, STEPS2TIME(getCurrentTimeStep()), value);
553  if (found) {
554  return value;
555  } else {
556  return -1;
557  }
558  } else {
559  return -2;
560  }
561 }
562 
563 
564 void
566  if (element == SUMO_TAG_EDGE || element == SUMO_TAG_LANE) {
567  std::vector<std::string> tmp = attrs.getAttributeNames();
568  edgeAttrs.insert(tmp.begin(), tmp.end());
569  } else if (element == SUMO_TAG_INTERVAL) {
570  bool ok;
572  }
573 }
574 
575 std::vector<std::string>
577  edgeAttrs.erase(toString(SUMO_ATTR_ID));
578  return std::vector<std::string>(edgeAttrs.begin(), edgeAttrs.end());
579 }
580 
581 void
583  double value, double begTime, double endTime) const {
584  MSEdge* edge = MSEdge::dictionary(id);
585  if (edge != nullptr) {
586  myWeightStorage->addEffort(edge, begTime, endTime, value);
587  } else {
588  WRITE_ERROR("Trying to set the effort for the unknown edge '" + id + "'.");
589  }
590 }
591 
592 
593 bool
594 GUINet::loadEdgeData(const std::string& file) {
595  // discover edge attributes
596  DiscoverAttributes discoveryHandler(file);
597  XMLSubSys::runParser(discoveryHandler, file);
598  std::vector<std::string> attrs = discoveryHandler.getEdgeAttrs();
599  WRITE_MESSAGE("Loading edgedata from '" + file
600  + "' Found " + toString(attrs.size())
601  + " attributes: " + toString(attrs));
603  // create a retriever for each attribute
604  std::vector<EdgeFloatTimeLineRetriever_GUI> retrieverDefsInternal;
605  retrieverDefsInternal.reserve(attrs.size());
606  std::vector<SAXWeightsHandler::ToRetrieveDefinition*> retrieverDefs;
607  for (const std::string& attr : attrs) {
609  myLoadedEdgeData[attr] = ws;
610  retrieverDefsInternal.push_back(EdgeFloatTimeLineRetriever_GUI(ws));
611  retrieverDefs.push_back(new SAXWeightsHandler::ToRetrieveDefinition(attr, true, retrieverDefsInternal.back()));
612  }
613  SAXWeightsHandler handler(retrieverDefs, "");
614  return XMLSubSys::runParser(handler, file);
615 }
616 
617 
618 std::vector<std::string>
620  std::vector<std::string> result;
621  for (const auto& item : myLoadedEdgeData) {
622  result.push_back(item.first);
623  }
624  return result;
625 }
626 
627 bool
629  const auto it = myLogics2Wrapper.find(const_cast<MSTrafficLightLogic*>(tll));
630  return it != myLogics2Wrapper.end() && gSelected.isSelected(GLO_TLLOGIC, it->second->getGlID());
631 }
632 
633 #ifdef HAVE_OSG
634 void
635 GUINet::updateColor(const GUIVisualizationSettings& s) {
636  for (std::vector<GUIEdge*>::const_iterator i = myEdgeWrapper.begin(); i != myEdgeWrapper.end(); ++i) {
637  if (!(*i)->isInternal()) {
638  const std::vector<MSLane*>& lanes = (*i)->getLanes();
639  for (std::vector<MSLane*>::const_iterator j = lanes.begin(); j != lanes.end(); ++j) {
640  static_cast<GUILane*>(*j)->updateColor(s);
641  }
642  }
643  }
644  for (std::vector<GUIJunctionWrapper*>::iterator i = myJunctionWrapper.begin(); i != myJunctionWrapper.end(); ++i) {
645  (*i)->updateColor(s);
646  }
647 }
648 #endif
649 
650 /****************************************************************************/
651 
GUINet::setIdleDuration
void setIdleDuration(int val)
Sets the duration of the last step's idle part.
Definition: GUINet.cpp:404
GUINet::getUPS
double getUPS() const
Returns the update per seconds rate.
Definition: GUINet.cpp:355
GUINet::myBoundary
Boundary myBoundary
The networks boundary.
Definition: GUINet.h:357
MSEventControl
Stores time-dependant events and executes them at the proper time.
Definition: MSEventControl.h:49
GUITransportableControl.h
GUINet::DiscoverAttributes
class for discovering edge attributes
Definition: GUINet.h:391
GUINet::myLinks2Logic
Links2LogicMap myLinks2Logic
The link-to-logic-id map.
Definition: GUINet.h:372
XMLSubSys::runParser
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false)
Runs the given handler on the given file; returns if everything's ok.
Definition: XMLSubSys.cpp:112
GUINet::myGrid
LayeredRTree myGrid
The visualization speed-up.
Definition: GUINet.h:354
GUIParameterTableWindow
A window containing a gl-object's parameter.
Definition: GUIParameterTableWindow.h:62
MSVehicleControl::getDepartedVehicleNo
int getDepartedVehicleNo() const
Returns the number of inserted vehicles.
Definition: MSVehicleControl.h:265
GUINet::myLoadedEdgeData
std::map< std::string, MSEdgeWeightsStorage * > myLoadedEdgeData
loaded edge data for visualization
Definition: GUINet.h:388
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
MSTLLogicControl.h
MSNet.h
GUINet::getMeanUPS
double getMeanUPS() const
Returns the update per seconds rate.
Definition: GUINet.cpp:373
MSDetectorControl.h
GUINet::getAvgRouteLength
double getAvgRouteLength() const
Definition: GUINet.h:209
GUIParameterTableWindow.h
GUINet::getLinkTLID
int getLinkTLID(MSLink *link) const
Definition: GUINet.cpp:188
GUINet::getIdleDuration
int getIdleDuration() const
Returns the duration of the last step's idle part (in ms)
Definition: GUINet.cpp:382
MSNet::simulationStep
void simulationStep()
Performs a single simulation step.
Definition: MSNet.cpp:466
MSNet::myVehicleControl
MSVehicleControl * myVehicleControl
Controls vehicle building and deletion;.
Definition: MSNet.h:715
Boundary::ymin
double ymin() const
Returns minimum y-coordinate.
Definition: Boundary.cpp:130
GUINet::DiscoverAttributes::myStartElement
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Callback method for an opening tag to implement by derived classes.
Definition: GUINet.cpp:565
GUIDetectorWrapper
Definition: GUIDetectorWrapper.h:42
GUINet::getContainerControl
MSTransportableControl & getContainerControl() override
Returns the container control.
Definition: GUINet.cpp:128
GUINet::isSelected
bool isSelected(const MSTrafficLightLogic *tll) const override
return wheter the given logic (or rather it's wrapper) is selected in the GUI
Definition: GUINet.cpp:628
DELTA_T
SUMOTime DELTA_T
Definition: SUMOTime.cpp:36
MSVehicleControl::getVehicleMeanSpeed
double getVehicleMeanSpeed() const
Definition: MSVehicleControl.h:225
GUIVehicleControl.h
GUIJunctionWrapper::getBoundary
Boundary getBoundary() const
Returns the boundary of the junction.
Definition: GUIJunctionWrapper.h:118
GUINet::getGUIInstance
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
Definition: GUINet.cpp:515
GUINet::initTLMap
void initTLMap()
Initialises the tl-logic map and wrappers.
Definition: GUINet.cpp:137
GUIMEVehicleControl.h
GUIPolygon.h
GUINet::GUINet
GUINet(MSVehicleControl *vc, MSEventControl *beginOfTimestepEvents, MSEventControl *endOfTimestepEvents, MSEventControl *insertionEvents)
Constructor.
Definition: GUINet.cpp:76
MSNet
The simulated network and simulation perfomer.
Definition: MSNet.h:91
GUIGLObjectPopupMenu.h
GUIGlobalSelection.h
MSNet::getInsertionControl
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:389
MSNet::myEdgeDataEndTime
SUMOTime myEdgeDataEndTime
end of loaded edgeData
Definition: MSNet.h:807
MSTLLogicControl::getAllLogics
std::vector< MSTrafficLightLogic * > getAllLogics() const
Returns a vector which contains all logics.
Definition: MSTLLogicControl.cpp:578
SUMO_TAG_LANE
begin/end of the description of a single lane
Definition: SUMOXMLDefinitions.h:49
Boundary::xmax
double xmax() const
Returns maximum x-coordinate.
Definition: Boundary.cpp:124
MSNet::myVersion
double myVersion
the network version
Definition: MSNet.h:804
Boundary::getHeight
double getHeight() const
Returns the height of the boundary (y-axis)
Definition: Boundary.cpp:160
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:57
MSVehicleControl::getLoadedVehicleNo
int getLoadedVehicleNo() const
Returns the number of build vehicles.
Definition: MSVehicleControl.h:213
MSJunctionControl.h
GUIVehicleControl
The class responsible for building and deletion of vehicles (gui-version)
Definition: GUIVehicleControl.h:46
SUMO_ATTR_ID
Definition: SUMOXMLDefinitions.h:378
MSNet::logSimulationDuration
bool logSimulationDuration() const
Returns whether duration shall be logged.
Definition: MSNet.cpp:804
GUINet::myLastSimDuration
int myLastSimDuration
The step durations (simulation, /*visualisation, *‍/idle)
Definition: GUINet.h:382
MSEdge.h
GUINet::getSimDuration
int getSimDuration() const
Returns the duration of the last step's simulation part (in ms)
Definition: GUINet.cpp:332
GUIJunctionWrapper.h
GUINet::getAvgWalkTimeLoss
double getAvgWalkTimeLoss() const
Definition: GUINet.h:233
MSInsertionControl.h
SUMOSAXAttributes::getSUMOTimeReporting
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
Definition: SUMOSAXAttributes.cpp:63
GUINet.h
MSInsertionControl::getWaitingVehicleNo
int getWaitingVehicleNo() const
Returns the number of waiting vehicles.
Definition: MSInsertionControl.cpp:259
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:47
GUIShapeContainer
Storage for geometrical objects extended by mutexes.
Definition: GUIShapeContainer.h:46
GUIMEVehicleControl
The class responsible for building and deletion of vehicles (gui-version)
Definition: GUIMEVehicleControl.h:40
MSDetectorControl::getAvailableTypes
const std::vector< SumoXMLTag > getAvailableTypes() const
Returns the list of available detector types.
Definition: MSDetectorControl.cpp:93
GUIParameterTableWindow::closeBuilding
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
Definition: GUIParameterTableWindow.cpp:219
MSEdgeWeightsStorage
A storage for edge travel times and efforts.
Definition: MSEdgeWeightsStorage.h:43
RGBColor.h
MSTLLogicControl::getActive
MSTrafficLightLogic * getActive(const std::string &id) const
Returns the active program of a named tls.
Definition: MSTLLogicControl.cpp:663
MSVehicleControl::getDiscardedVehicleNo
int getDiscardedVehicleNo() const
Returns the number of discarded vehicles.
Definition: MSVehicleControl.h:249
GUINet::myDetectorWrapper
std::vector< GUIDetectorWrapper * > myDetectorWrapper
A detector dictionary.
Definition: GUINet.h:366
GUINet::getAvgWalkDuration
double getAvgWalkDuration() const
Definition: GUINet.h:230
GUINet::getGUIMEVehicleControl
GUIMEVehicleControl * getGUIMEVehicleControl()
Returns the vehicle control.
Definition: GUINet.cpp:542
GUINet::loadEdgeData
bool loadEdgeData(const std::string &file)
load edgeData from file
Definition: GUINet.cpp:594
MSNet::myVehiclesMoved
long long int myVehiclesMoved
The overall number of vehicle movements.
Definition: MSNet.h:760
GUINet::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
Definition: GUINet.cpp:410
GUINet::getAvgDepartDelay
double getAvgDepartDelay() const
Definition: GUINet.h:221
MSTransportableControl
Definition: MSTransportableControl.h:51
MSVehicleControl::getRunningVehicleNo
int getRunningVehicleNo() const
Returns the number of build and inserted, but not yet deleted vehicles.
Definition: MSVehicleControl.h:257
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:79
MSTrafficLightLogic.h
GLO_TLLOGIC
a tl-logic
Definition: GUIGlObjectTypes.h:56
GUINet::getAvgWaitingTime
double getAvgWaitingTime() const
Definition: GUINet.h:215
MSVehicleControl::getVehicleMeanSpeedRelative
double getVehicleMeanSpeedRelative() const
Definition: MSVehicleControl.h:228
MSVehicleControl::getArrivedVehicleNo
int getArrivedVehicleNo() const
Returns the number of arrived vehicles.
Definition: MSVehicleControl.h:242
GUINet::GUITrafficLightLogicWrapper
friend class GUITrafficLightLogicWrapper
Definition: GUINet.h:84
SAXWeightsHandler::ToRetrieveDefinition
Complete definition about what shall be retrieved and where to store it.
Definition: SAXWeightsHandler.h:100
MSVehicleControl::getVehicle
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
Definition: MSVehicleControl.cpp:240
NamedObjectCont::size
int size() const
Returns the number of stored items within the container.
Definition: NamedObjectCont.h:116
GUINet::getWholeDuration
int getWholeDuration() const
Returns the duration of the last step (sim+visualisation+idle) (in ms)
Definition: GUINet.cpp:326
GUIGlObjectStorage::setNetObject
void setNetObject(GUIGlObject *object)
Sets the given object as the "network" object.
Definition: GUIGlObjectStorage.h:125
GUINet::myEdgeWrapper
std::vector< GUIEdge * > myEdgeWrapper
Wrapped MS-edges.
Definition: GUINet.h:360
GUINet::myLastIdleDuration
int myLastIdleDuration
Definition: GUINet.h:382
MSEdgeWeightsStorage.h
GUINet::getCenteringBoundary
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUINet.cpp:509
Boundary::xmin
double xmin() const
Returns minimum x-coordinate.
Definition: Boundary.cpp:118
GUIPointOfInterest.h
GUINet::myLock
FXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUINet.h:429
MSJunction.h
MSDetectorControl::getTypedDetectors
const NamedObjectCont< MSDetectorFileOutput * > & getTypedDetectors(SumoXMLTag type) const
Returns the list of detectors of the given type.
Definition: MSDetectorControl.cpp:103
GUINet::myJunctionWrapper
std::vector< GUIJunctionWrapper * > myJunctionWrapper
Wrapped MS-junctions.
Definition: GUINet.h:363
GUINet::getPersonControl
MSTransportableControl & getPersonControl() override
Returns the person control.
Definition: GUINet.cpp:119
GUILane.h
GUIParameterTableWindow::mkItem
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
Definition: GUIParameterTableWindow.h:108
MSNet::getCurrentTimeStep
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:283
GUIShapeContainer.h
MSEdge::dictionary
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn't already in the dictionary....
Definition: MSEdge.cpp:765
GUIGlobals.h
GUINet::getEdgeData
double getEdgeData(const MSEdge *edge, const std::string &attr)
retrieve loaded edged weight for the given attribute and the current simulation time
Definition: GUINet.cpp:548
GUINet::getAvgDuration
double getAvgDuration() const
Definition: GUINet.h:212
STEPS2TIME
#define STEPS2TIME(x)
Definition: SUMOTime.h:56
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GUITrafficLightLogicWrapper.h
GUINet::getBoundary
const Boundary & getBoundary() const
returns the bounder of the network
Definition: GUINet.cpp:113
MSNet::myLogics
MSTLLogicControl * myLogics
Controls tls logics, realizes waiting on tls rules;.
Definition: MSNet.h:725
Boundary::getWidth
double getWidth() const
Returns the width of the boudary (x-axis)
Definition: Boundary.cpp:154
GUINet::myLogics2Wrapper
Logics2WrapperMap myLogics2Wrapper
The traffic light-to-wrapper map.
Definition: GUINet.h:378
SUMO_TAG_EDGE
begin/end of the description of an edge
Definition: SUMOXMLDefinitions.h:47
GUINet::myOverallSimDuration
long myOverallSimDuration
Definition: GUINet.h:385
ProcessError
Definition: UtilExceptions.h:39
GUIGlObject_AbstractAdd::clearDictionary
static void clearDictionary()
Clears the dictionary (the objects will not be deleted)
Definition: GUIGlObject_AbstractAdd.cpp:54
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GUINet::initGUIStructures
void initGUIStructures()
Initialises gui wrappers.
Definition: GUINet.cpp:257
Boundary::add
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:78
GLObjectValuePassConnector::updateAll
static void updateAll()
Updates all instances (passes values)
Definition: GLObjectValuePassConnector.h:90
GLObjectValuePassConnector
Class passing values from a GUIGlObject to another object.
Definition: GLObjectValuePassConnector.h:59
GUINet::DiscoverAttributes::lastIntervalEnd
SUMOTime lastIntervalEnd
Definition: GUINet.h:398
MSNet::myJunctions
MSJunctionControl * myJunctions
Controls junctions, realizes right-of-way rules;.
Definition: MSNet.h:723
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:78
GUIDetectorWrapper.h
GUINet::DiscoverAttributes::getEdgeAttrs
std::vector< std::string > getEdgeAttrs()
Definition: GUINet.cpp:576
MSTrafficLightLogic
The parent class for traffic light logics.
Definition: MSTrafficLightLogic.h:55
GUIGlObject
Definition: GUIGlObject.h:65
LayeredRTree::Insert
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:71
GUIJunctionWrapper
Definition: GUIJunctionWrapper.h:60
GUINet::myOverallVehicleCount
long myOverallVehicleCount
Definition: GUINet.h:384
GUINet::EdgeFloatTimeLineRetriever_GUI
Definition: GUINet.h:403
MSVehicleControl::getCollisionCount
int getCollisionCount() const
return the number of collisions
Definition: MSVehicleControl.h:289
MSJunction::getPosition
const Position & getPosition() const
Definition: MSJunction.cpp:68
GUINet::lock
void lock()
grant exclusive access to the simulation state
Definition: GUINet.cpp:531
GUINet::myLastVehicleMovementCount
long myLastVehicleMovementCount
Definition: GUINet.h:384
MSTransportableControl::getJammedNumber
int getJammedNumber() const
Returns the number of times a transportables was jammed.
Definition: MSTransportableControl.h:195
GUIGlObject::buildPopupHeader
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
Definition: GUIGlObject.cpp:207
GUINet::getAvgTripSpeed
double getAvgTripSpeed() const
Definition: GUINet.h:224
GUINet::drawGL
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
Definition: GUINet.cpp:505
GUILaneSpeedTrigger.h
MSNet::getTLSControl
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
Definition: MSNet.h:409
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
StringUtils.h
MSTrafficLightLogic::getLinks
const LinkVectorVector & getLinks() const
Returns the list of lists of all affected links.
Definition: MSTrafficLightLogic.h:203
GUINet::EdgeFloatTimeLineRetriever_GUI::addEdgeWeight
void addEdgeWeight(const std::string &id, double val, double beg, double end) const
Adds an effort for a given edge and time period.
Definition: GUINet.cpp:582
MSVehicleControl::getHaltingVehicleNo
virtual int getHaltingVehicleNo() const
Returns the number of halting vehicles.
Definition: MSVehicleControl.cpp:402
GLObjectValuePassConnector.h
MSNet::getInstance
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:167
GUIMainWindow
Definition: GUIMainWindow.h:46
GUIEdge
A road/street connecting two junctions (gui-version)
Definition: GUIEdge.h:52
GUINet::getAvgTimeLoss
double getAvgTimeLoss() const
Definition: GUINet.h:218
GUISUMOAbstractView::getFPS
double getFPS() const
retrieve FPS
Definition: GUISUMOAbstractView.cpp:746
MSPModel::SIDEWALK_OFFSET
static const double SIDEWALK_OFFSET
the offset for computing person positions when walking on edges without a sidewalk
Definition: MSPModel.h:113
GUITrafficLightLogicWrapper
Definition: GUITrafficLightLogicWrapper.h:47
GUIEdge.h
NamedObjectCont::get
T get(const std::string &id) const
Retrieves an item.
Definition: NamedObjectCont.h:98
MSEdgeVector
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:74
GUINet::getTLSIDs
std::vector< GUIGlID > getTLSIDs() const
Returns the gl-ids of all traffic light logics within the net.
Definition: GUINet.cpp:242
MSTransportableControl::getRunningNumber
int getRunningNumber() const
Returns the number of build and inserted, but not yet deleted transportables.
Definition: MSTransportableControl.h:188
GUINet::unlock
void unlock()
release exclusive access to the simulation state
Definition: GUINet.cpp:537
GUINet::getRTFactor
double getRTFactor() const
Returns the simulation speed as a factor to real time.
Definition: GUINet.cpp:346
MSNet::myContainerControl
MSTransportableControl * myContainerControl
Controls container building and deletion;.
Definition: MSNet.h:719
GUIGlObject::buildShowParamsPopupEntry
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
Definition: GUIGlObject.cpp:248
GUIGlObjectStorage::gIDStorage
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
Definition: GUIGlObjectStorage.h:140
GUIEdge::getTotalLength
static double getTotalLength(bool includeInternal, bool eachLane)
Definition: GUIEdge.cpp:104
MSPModel.h
gSelected
GUISelectedStorage gSelected
A global holder of selected objects.
Definition: GUIGlobalSelection.cpp:33
GUINet::vehicleExists
bool vehicleExists(const std::string &name) const
returns the information whether the vehicle still exists
Definition: GUINet.cpp:182
GUIGlObject::buildCenterPopupEntry
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
Definition: GUIGlObject.cpp:216
GUIGlObject::buildPositionCopyEntry
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
Definition: GUIGlObject.cpp:266
MSEdge::getLanes
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:167
GUINet::getLinkTLIndex
int getLinkTLIndex(MSLink *link) const
Definition: GUINet.cpp:203
SUMORTree::addAdditionalGLObject
void addAdditionalGLObject(GUIGlObject *o)
Adds an additional object (detector/shape/trigger) for visualisation.
Definition: SUMORTree.h:126
config.h
GUINet::getJunctionIDs
std::vector< GUIGlID > getJunctionIDs(bool includeInternal) const
Definition: GUINet.cpp:230
MSVehicleControl
The class responsible for building and deletion of vehicles.
Definition: MSVehicleControl.h:71
MSNet::myDetectorControl
MSDetectorControl * myDetectorControl
Controls detectors;.
Definition: MSNet.h:729
ShapeContainer.h
GUIEdge::getIDs
static std::vector< GUIGlID > getIDs(bool includeInternal)
Definition: GUIEdge.cpp:89
MSTransportableControl::getLoadedNumber
int getLoadedNumber() const
Returns the number of build transportables.
Definition: MSTransportableControl.h:180
SUMO_ATTR_END
weights: time range end
Definition: SUMOXMLDefinitions.h:680
Boundary::grow
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:300
GUINet::getParameterWindow
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
Definition: GUINet.cpp:422
SUMO_TAG_INTERVAL
an aggreagated-output interval
Definition: SUMOXMLDefinitions.h:159
GUINet::getMeanRTFactor
double getMeanRTFactor(int duration) const
Returns the simulation speed as a factor to real time.
Definition: GUINet.cpp:364
GUINet::getAvgWalkRouteLength
double getAvgWalkRouteLength() const
Definition: GUINet.h:227
MSVehicleControl::getTeleportCount
int getTeleportCount() const
return the number of teleports (including collisions)
Definition: MSVehicleControl.cpp:455
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
FunctionBinding
Definition: FunctionBinding.h:40
GUINet::createTLWrapper
void createTLWrapper(MSTrafficLightLogic *tll) override
creates a wrapper for the given logic
Definition: GUINet.cpp:148
GUINet::getJunctionPosition
Position getJunctionPosition(const std::string &name) const
returns the position of a junction
Definition: GUINet.cpp:175
GUINet
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:82
MSTrafficLightLogic::LinkVectorVector
std::vector< LinkVector > LinkVectorVector
Definition of a list that holds lists of links that do have the same attribute.
Definition: MSTrafficLightLogic.h:67
GUINet::simulationStep
void simulationStep()
Performs a single simulation step (locking the simulation)
Definition: GUINet.cpp:223
GUITransportableControl
GUI-version of the transportable control for building gui persons and containers.
Definition: GUITransportableControl.h:37
GUINet::getEdgeDataAttrs
std::vector< std::string > getEdgeDataAttrs() const
return list of loaded edgeData attributes
Definition: GUINet.cpp:619
SAXWeightsHandler
An XML-handler for network weights.
Definition: SAXWeightsHandler.h:68
MSEdge::getAllEdges
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
Definition: MSEdge.cpp:798
SUMOSAXAttributes
Encapsulated SAX-Attributes.
Definition: SUMOSAXAttributes.h:56
GUINet::setSimDuration
void setSimDuration(int val)
Sets the duration of the last step's simulation part.
Definition: GUINet.cpp:388
GUINet::getGUIVehicleControl
GUIVehicleControl * getGUIVehicleControl()
Returns the vehicle control.
Definition: GUINet.cpp:525
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:76
WRITE_ERROR
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:283
SUMOSAXAttributes::getAttributeNames
virtual std::vector< std::string > getAttributeNames() const =0
Retrieves all attribute names.
GUINet::guiSimulationStep
void guiSimulationStep()
Some further steps needed for gui processing.
Definition: GUINet.cpp:216
WRITE_MESSAGE
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:277
MSNet::getVehicleControl
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:336
MSNet::myPersonControl
MSTransportableControl * myPersonControl
Controls person building and deletion;.
Definition: MSNet.h:717
GLO_NETWORK
The network - empty.
Definition: GUIGlObjectTypes.h:41
GUINet::DiscoverAttributes::edgeAttrs
std::set< std::string > edgeAttrs
Definition: GUINet.h:400
XMLSubSys.h
Boundary::ymax
double ymax() const
Returns maximum y-coordinate.
Definition: Boundary.cpp:136
GUINet::~GUINet
~GUINet()
Destructor.
Definition: GUINet.cpp:87
GUISelectedStorage::isSelected
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
Definition: GUISelectedStorage.cpp:94