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