SUMO - Simulation of Urban MObility
GUIEdge.cpp
Go to the documentation of this file.
1 /****************************************************************************/
10 // A road/street connecting two junctions (gui-version)
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <vector>
35 #include <cmath>
36 #include <string>
37 #include <algorithm>
42 #include <utils/geom/GeomHelper.h>
45 #include <utils/gui/div/GLHelper.h>
48 #include <microsim/MSBaseVehicle.h>
49 #include <microsim/MSEdge.h>
50 #include <microsim/MSJunction.h>
51 #include <microsim/MSLaneChanger.h>
52 #include <microsim/MSGlobals.h>
55 #include "GUITriggeredRerouter.h"
56 #include "GUIEdge.h"
57 #include "GUIVehicle.h"
58 #include "GUINet.h"
59 #include "GUILane.h"
60 #include "GUIPerson.h"
61 #include "GUIContainer.h"
62 
64 #include <mesogui/GUIMEVehicle.h>
65 #include <mesosim/MESegment.h>
66 #include <mesosim/MELoop.h>
67 #include <mesosim/MEVehicle.h>
68 
69 #ifdef CHECK_MEMORY_LEAKS
70 #include <foreign/nvwa/debug_new.h>
71 #endif // CHECK_MEMORY_LEAKS
72 
73 
74 // ===========================================================================
75 // included modules
76 // ===========================================================================
77 GUIEdge::GUIEdge(const std::string& id, int numericalID,
78  const EdgeBasicFunction function,
79  const std::string& streetName, const std::string& edgeType, int priority)
80  : MSEdge(id, numericalID, function, streetName, edgeType, priority),
81  GUIGlObject(GLO_EDGE, id) {}
82 
83 
85  // just to quit cleanly on a failure
86  if (myLock.locked()) {
87  myLock.unlock();
88  }
89 }
90 
91 
92 MSLane&
93 GUIEdge::getLane(size_t laneNo) {
94  assert(laneNo < myLanes->size());
95  return *((*myLanes)[laneNo]);
96 }
97 
98 
99 std::vector<GUIGlID>
100 GUIEdge::getIDs(bool includeInternal) {
101  std::vector<GUIGlID> ret;
102  ret.reserve(MSEdge::myDict.size());
103  for (MSEdge::DictType::const_iterator i = MSEdge::myDict.begin(); i != MSEdge::myDict.end(); ++i) {
104  const GUIEdge* edge = dynamic_cast<const GUIEdge*>(i->second);
105  assert(edge);
106  if (edge->getPurpose() != EDGEFUNCTION_INTERNAL || includeInternal) {
107  ret.push_back(edge->getGlID());
108  }
109  }
110  return ret;
111 }
112 
113 
114 SUMOReal
115 GUIEdge::getTotalLength(bool includeInternal, bool eachLane) {
116  SUMOReal result = 0;
117  for (MSEdge::DictType::const_iterator i = MSEdge::myDict.begin(); i != MSEdge::myDict.end(); ++i) {
118  const MSEdge* edge = i->second;
119  if (edge->getPurpose() != EDGEFUNCTION_INTERNAL || includeInternal) {
120  // @note needs to be change once lanes may have different length
121  result += edge->getLength() * (eachLane ? edge->getLanes().size() : 1);
122  }
123  }
124  return result;
125 }
126 
127 
128 Boundary
130  Boundary ret;
132  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
133  ret.add((*i)->getShape().getBoxBoundary());
134  }
135  } else {
136  // take the starting coordinates of all follower edges and the endpoints
137  // of all successor edges
138  for (MSEdgeVector::const_iterator it = mySuccessors.begin(); it != mySuccessors.end(); ++it) {
139  const std::vector<MSLane*>& lanes = (*it)->getLanes();
140  for (std::vector<MSLane*>::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); ++it_lane) {
141  ret.add((*it_lane)->getShape().front());
142  }
143  }
144  for (MSEdgeVector::const_iterator it = myPredecessors.begin(); it != myPredecessors.end(); ++it) {
145  const std::vector<MSLane*>& lanes = (*it)->getLanes();
146  for (std::vector<MSLane*>::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); ++it_lane) {
147  ret.add((*it_lane)->getShape().back());
148  }
149  }
150  }
151  ret.grow(10);
152  return ret;
153 }
154 
155 
156 void
157 GUIEdge::fill(std::vector<GUIEdge*>& netsWrappers) {
158  size_t size = MSEdge::dictSize();
159  netsWrappers.reserve(size);
160  for (DictType::iterator i = myDict.begin(); i != myDict.end(); ++i) {
161  if (i->second->getPurpose() != MSEdge::EDGEFUNCTION_DISTRICT) {
162  netsWrappers.push_back(static_cast<GUIEdge*>((*i).second));
163  }
164  }
165 }
166 
167 
168 
171  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
172  buildPopupHeader(ret, app);
178  }
179  const SUMOReal pos = getLanes()[0]->getShape().nearest_offset_to_point2D(parent.getPositionInformation());
180  new FXMenuCommand(ret, ("pos: " + toString(pos)).c_str(), 0, 0, 0);
181  buildPositionCopyEntry(ret, false);
182  return ret;
183 }
184 
185 
188  GUISUMOAbstractView& parent) {
189  GUIParameterTableWindow* ret = 0;
190  ret = new GUIParameterTableWindow(app, *this, 16);
191  // add edge items
192  ret->mkItem("length [m]", false, (*myLanes)[0]->getLength());
193  ret->mkItem("allowed speed [m/s]", false, getAllowedSpeed());
194  ret->mkItem("brutto occupancy [%]", true, new FunctionBinding<GUIEdge, SUMOReal>(this, &GUIEdge::getBruttoOccupancy, 100.));
195  ret->mkItem("mean vehicle speed [m/s]", true, new FunctionBinding<GUIEdge, SUMOReal>(this, &GUIEdge::getMeanSpeed));
196  ret->mkItem("flow [veh/h/lane]", true, new FunctionBinding<GUIEdge, SUMOReal>(this, &GUIEdge::getFlow));
197  ret->mkItem("routing speed [m/s]", true, new FunctionBinding<MSEdge, SUMOReal>(this, &MSEdge::getRoutingSpeed));
199  ret->mkItem("vehicle ids", false, getVehicleIDs());
200  // add segment items
202  ret->mkItem("segment index", false, segment->getIndex());
203  ret->mkItem("segment length [m]", false, segment->getLength());
204  ret->mkItem("segment allowed speed [m/s]", false, segment->getEdge().getSpeedLimit());
205  ret->mkItem("segment jam threshold [%]", false, segment->getRelativeJamThreshold() * 100);
206  ret->mkItem("segment brutto occupancy [%]", true, new FunctionBinding<MESegment, SUMOReal>(segment, &MESegment::getRelativeOccupancy, 100));
207  ret->mkItem("segment mean vehicle speed [m/s]", true, new FunctionBinding<MESegment, SUMOReal>(segment, &MESegment::getMeanSpeed));
208  ret->mkItem("segment flow [veh/h/lane]", true, new FunctionBinding<MESegment, SUMOReal>(segment, &MESegment::getFlow));
209  ret->mkItem("segment #vehicles", true, new CastingFunctionBinding<MESegment, SUMOReal, size_t>(segment, &MESegment::getCarNumber));
210  ret->mkItem("segment leader leave time", true, new FunctionBinding<MESegment, SUMOReal>(segment, &MESegment::getEventTimeSeconds));
211 
212  // close building
213  ret->closeBuilding();
214  return ret;
215 }
216 
217 
218 Boundary
220  Boundary b = getBoundary();
221  // ensure that vehicles and persons on the side are drawn even if the edge
222  // is outside the view
223  b.grow(10);
224  return b;
225 }
226 
227 
228 void
231  return;
232  }
233  glPushName(getGlID());
234  // draw the lanes
235  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
237  setColor(s);
238  }
239  GUILane* l = dynamic_cast<GUILane*>(*i);
240  if (l != 0) {
241  l->drawGL(s);
242  }
243  }
246  drawMesoVehicles(s);
247  }
248  }
249  glPopName();
250  // (optionally) draw the name and/or the street name
251  const bool drawEdgeName = s.edgeName.show && myFunction == EDGEFUNCTION_NORMAL;
252  const bool drawInternalEdgeName = s.internalEdgeName.show && myFunction == EDGEFUNCTION_INTERNAL;
253  const bool drawCwaEdgeName = s.cwaEdgeName.show && (myFunction == EDGEFUNCTION_CROSSING || myFunction == EDGEFUNCTION_WALKINGAREA);
254  const bool drawStreetName = s.streetName.show && myStreetName != "";
255  if (drawEdgeName || drawInternalEdgeName || drawCwaEdgeName || drawStreetName) {
256  GUILane* lane1 = dynamic_cast<GUILane*>((*myLanes)[0]);
257  GUILane* lane2 = dynamic_cast<GUILane*>((*myLanes).back());
258  if (lane1 != 0 && lane2 != 0) {
259  Position p = lane1->getShape().positionAtOffset(lane1->getShape().length() / (SUMOReal) 2.);
260  p.add(lane2->getShape().positionAtOffset(lane2->getShape().length() / (SUMOReal) 2.));
261  p.mul(.5);
262  SUMOReal angle = lane1->getShape().rotationDegreeAtOffset(lane1->getShape().length() / (SUMOReal) 2.);
263  angle += 90;
264  if (angle > 90 && angle < 270) {
265  angle -= 180;
266  }
267  if (drawEdgeName) {
268  drawName(p, s.scale, s.edgeName, angle);
269  } else if (drawInternalEdgeName) {
270  drawName(p, s.scale, s.internalEdgeName, angle);
271  } else if (drawCwaEdgeName) {
272  drawName(p, s.scale, s.cwaEdgeName, angle);
273  }
274  if (drawStreetName) {
276  s.streetName.size / s.scale, s.streetName.color, angle);
277  }
278  }
279  }
281  myLock.lock();
282  for (std::set<MSTransportable*>::const_iterator i = myPersons.begin(); i != myPersons.end(); ++i) {
283  GUIPerson* person = dynamic_cast<GUIPerson*>(*i);
284  assert(person != 0);
285  person->drawGL(s);
286  }
287  myLock.unlock();
288  }
290  myLock.lock();
291  for (std::set<MSTransportable*>::const_iterator i = myContainers.begin(); i != myContainers.end(); ++i) {
292  GUIContainer* container = dynamic_cast<GUIContainer*>(*i);
293  assert(container != 0);
294  container->drawGL(s);
295  }
296  myLock.unlock();
297  }
298 }
299 
300 
301 void
304  if (vehicleControl != 0) {
305  // draw the meso vehicles
306  vehicleControl->secureVehicles();
308  size_t laneIndex = 0;
309  MESegment::Queue queue;
310  for (std::vector<MSLane*>::const_iterator msl = myLanes->begin(); msl != myLanes->end(); ++msl, ++laneIndex) {
311  GUILane* l = static_cast<GUILane*>(*msl);
312  // go through the vehicles
313  SUMOReal segmentOffset = 0; // offset at start of current segment
314  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
315  segment != 0; segment = segment->getNextSegment()) {
316  const SUMOReal length = segment->getLength();
317  if (laneIndex < segment->numQueues()) {
318  // make a copy so we don't have to worry about synchronization
319  queue = segment->getQueue(laneIndex);
320  const size_t queueSize = queue.size();
321  SUMOReal vehiclePosition = segmentOffset + length;
322  // draw vehicles beginning with the leader at the end of the segment
323  SUMOReal xOff = 0;
324  for (size_t i = 0; i < queueSize; ++i) {
325  GUIMEVehicle* veh = static_cast<GUIMEVehicle*>(queue[queueSize - i - 1]);
326  const SUMOReal vehLength = veh->getVehicleType().getLengthWithGap();
327  while (vehiclePosition < segmentOffset) {
328  // if there is only a single queue for a
329  // multi-lane edge shift vehicles and start
330  // drawing again from the end of the segment
331  vehiclePosition += length;
332  xOff += 2;
333  }
334  const Position p = l->geometryPositionAtOffset(vehiclePosition);
335  const SUMOReal angle = l->getShape().rotationAtOffset(l->interpolateLanePosToGeometryPos(vehiclePosition));
336  veh->drawOnPos(s, p, angle);
337  vehiclePosition -= vehLength;
338  }
339  }
340  segmentOffset += length;
341  }
342  glPopMatrix();
343  }
344  vehicleControl->releaseVehicles();
345  }
346 }
347 
348 
349 
350 unsigned int
352  size_t vehNo = 0;
353  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
354  vehNo += segment->getCarNumber();
355  }
356  return (unsigned int)vehNo;
357 }
358 
359 
360 std::string
362  std::string result = " ";
363  std::vector<const MEVehicle*> vehs;
364  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
365  std::vector<const MEVehicle*> segmentVehs = segment->getVehicles();
366  vehs.insert(vehs.end(), segmentVehs.begin(), segmentVehs.end());
367  }
368  for (std::vector<const MEVehicle*>::const_iterator it = vehs.begin(); it != vehs.end(); it++) {
369  result += (*it)->getID() + " ";
370  }
371  return result;
372 }
373 
374 
375 SUMOReal
377  SUMOReal flow = 0;
378  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
379  flow += (SUMOReal) segment->getCarNumber() * segment->getMeanSpeed();
380  }
381  return 3600 * flow / (*myLanes)[0]->getLength();
382 }
383 
384 
385 SUMOReal
387  SUMOReal occ = 0;
388  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
389  occ += segment->getBruttoOccupancy();
390  }
391  return occ / (*myLanes)[0]->getLength() / (SUMOReal)(myLanes->size());
392 }
393 
394 
395 SUMOReal
397  return (*myLanes)[0]->getSpeedLimit();
398 }
399 
400 
401 SUMOReal
403  return getMeanSpeed() / getAllowedSpeed();
404 }
405 
406 
407 void
409  const GUIColorer& c = s.edgeColorer;
410  if (!setFunctionalColor(c.getActive()) && !setMultiColor(c)) {
412  }
413 }
414 
415 
416 bool
417 GUIEdge::setFunctionalColor(size_t activeScheme) const {
418  switch (activeScheme) {
419  case 9: {
420  const PositionVector& shape = getLanes()[0]->getShape();
421  SUMOReal hue = GeomHelper::naviDegree(shape.beginEndAngle()); // [0-360]
423  return true;
424  }
425  default:
426  return false;
427  }
428 }
429 
430 
431 bool
433  const size_t activeScheme = c.getActive();
434  mySegmentColors.clear();
435  switch (activeScheme) {
436  case 10: // alternating segments
437  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
438  segment != 0; segment = segment->getNextSegment()) {
439  mySegmentColors.push_back(c.getScheme().getColor(segment->getIndex() % 2));
440  }
441  //std::cout << getID() << " scheme=" << c.getScheme().getName() << " schemeCols=" << c.getScheme().getColors().size() << " thresh=" << toString(c.getScheme().getThresholds()) << " segmentColors=" << mySegmentColors.size() << " [0]=" << mySegmentColors[0] << " [1]=" << mySegmentColors[1] << "\n";
442  return true;
443  case 11: // by segment jammed state
444  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
445  segment != 0; segment = segment->getNextSegment()) {
446  mySegmentColors.push_back(c.getScheme().getColor(segment->free() ? 0 : 1));
447  }
448  return true;
449  case 12: // by segment occupancy
450  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
451  segment != 0; segment = segment->getNextSegment()) {
452  mySegmentColors.push_back(c.getScheme().getColor(segment->getRelativeOccupancy()));
453  }
454  return true;
455  case 13: // by segment speed
456  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
457  segment != 0; segment = segment->getNextSegment()) {
458  mySegmentColors.push_back(c.getScheme().getColor(segment->getMeanSpeed()));
459  }
460  return true;
461  case 14: // by segment flow
462  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
463  segment != 0; segment = segment->getNextSegment()) {
464  mySegmentColors.push_back(c.getScheme().getColor(3600 * segment->getCarNumber() * segment->getMeanSpeed() / segment->getLength()));
465  }
466  return true;
467  case 15: // by segment relative speed
468  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
469  segment != 0; segment = segment->getNextSegment()) {
470  mySegmentColors.push_back(c.getScheme().getColor(segment->getMeanSpeed() / getAllowedSpeed()));
471  }
472  return true;
473  default:
474  return false;
475  }
476 }
477 
478 
479 SUMOReal
480 GUIEdge::getColorValue(size_t activeScheme) const {
481  switch (activeScheme) {
482  case 1:
483  return gSelected.isSelected(getType(), getGlID());
484  case 2:
485  return getPurpose();
486  case 3:
487  return getAllowedSpeed();
488  case 4:
489  return getBruttoOccupancy();
490  case 5:
491  return getMeanSpeed();
492  case 6:
493  return getFlow();
494  case 7:
495  return getRelativeSpeed();
496  case 8:
497  return getRoutingSpeed();
498  }
499  return 0;
500 }
501 
502 
503 SUMOReal
504 GUIEdge::getScaleValue(size_t activeScheme) const {
505  switch (activeScheme) {
506  case 1:
507  return gSelected.isSelected(getType(), getGlID());
508  case 2:
509  return getAllowedSpeed();
510  case 3:
511  return getBruttoOccupancy();
512  case 4:
513  return getMeanSpeed();
514  case 5:
515  return getFlow();
516  case 6:
517  return getRelativeSpeed();
518  }
519  return 0;
520 }
521 
522 
523 MESegment*
525  const PositionVector& shape = getLanes()[0]->getShape();
526  const SUMOReal lanePos = shape.nearest_offset_to_point2D(pos);
527  return MSGlobals::gMesoNet->getSegmentForEdge(*this, lanePos);
528 }
529 
530 
531 
532 void
534  const std::vector<MSLane*>& lanes = getLanes();
535  const bool isClosed = lane->isClosed();
536  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
537  GUILane* l = dynamic_cast<GUILane*>(*i);
538  if (l->isClosed() == isClosed) {
539  l->closeTraffic(false);
540  }
541  }
543 }
544 
545 
546 void
548  MSEdgeVector edges;
549  edges.push_back(this);
550  GUITriggeredRerouter* rr = new GUITriggeredRerouter(getID() + "_dynamic_rerouter", edges, 1, "", false,
551  GUINet::getGUIInstance()->getVisualisationSpeedUp());
552 
555  ri.end = SUMOTime_MAX;
557  rr->myIntervals.push_back(ri);
558 
559  // trigger rerouting for vehicles already on this edge
560  const std::vector<MSLane*>& lanes = getLanes();
561  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
562  const MSLane::VehCont& vehicles = (*i)->getVehiclesSecure();
563  for (MSLane::VehCont::const_iterator v = vehicles.begin(); v != vehicles.end(); ++v) {
564  if ((*v)->getLane() == (*i)) {
566  } // else: this is the shadow during a continuous lane change
567  }
568  (*i)->releaseVehicles();
569  }
570 }
571 
572 /****************************************************************************/
573 
SUMOReal getScaleValue(size_t activeScheme) const
gets the scaling value according to the current scheme index
Definition: GUIEdge.cpp:504
SUMOReal getExaggeration(const GUIVisualizationSettings &s, SUMOReal factor=20) const
return the drawing size including exaggeration and constantSize values
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIEdge.cpp:219
std::set< MSTransportable * > myContainers
Containers on the edge.
Definition: MSEdge.h:791
SUMOReal getFlow() const
returns flow based on headway
Definition: MESegment.cpp:673
std::vector< MEVehicle * > Queue
Definition: MESegment.h:87
GUIVisualizationTextSettings streetName
Reroutes vehicles passing an edge One rerouter can be active on multiple edges. To reduce drawing loa...
SUMOReal rotationAtOffset(SUMOReal pos) const
Returns the rotation at the given length.
SUMOReal nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
static RGBColor fromHSV(SUMOReal h, SUMOReal s, SUMOReal v)
Converts the given hsv-triplet to rgb.
Definition: RGBColor.cpp:294
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
void add(const Position &pos)
Adds the given position to this one.
Definition: Position.h:119
bool isClosed() const
Definition: GUILane.h:249
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIEdge.cpp:170
const std::vector< MSLane * > & getLanes() const
Returns this edge&#39;s lanes.
Definition: MSEdge.h:192
SUMOReal getLengthWithGap() const
Get vehicle&#39;s length including the minimum gap [m].
void releaseVehicles()
unlock access to vehicle removal/additions for thread synchronization
void closeTraffic(bool rebuildAllowed=true)
close this lane for traffic
Definition: GUILane.cpp:1061
RandomDistributor< MSEdge * > edgeProbs
The distributions of new destinations to use.
The vehicle arrived at a junction.
bool add(SUMOReal prob, T val, bool checkDuplicates=true)
Adds a value with an assigned probability to the distribution.
void secureVehicles()
lock access to vehicle removal/additions for thread synchronization
std::vector< RGBColor > mySegmentColors
The color of the segments (cached)
Definition: GUIEdge.h:218
Stores the information about how to visualize structures.
const EdgeBasicFunction myFunction
the purpose of the edge
Definition: MSEdge.h:766
GUIColorer edgeColorer
The mesoscopic edge colorer.
SUMOReal getFlow() const
return flow based on meanSpead
Definition: GUIEdge.cpp:376
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUILane.cpp:439
const std::string & getStreetName() const
Returns the street name of the edge.
Definition: MSEdge.h:278
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
GUIMEVehicleControl * getGUIMEVehicleControl()
Returns the vehicle control.
Definition: GUINet.cpp:529
The edge is a macroscopic connector (source/sink)
Definition: MSEdge.h:95
The class responsible for building and deletion of vehicles (gui-version)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:159
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
SUMOReal getMeanSpeed() const
wrapper to satisfy the FunctionBinding signature
Definition: MESegment.h:207
unsigned int getIndex() const
Returns the running index of the segment in the edge (0 is the most upstream).
Definition: MESegment.h:150
GUIVisualizationTextSettings cwaEdgeName
static void drawText(const std::string &text, const Position &pos, const SUMOReal layer, const SUMOReal size, const RGBColor &col=RGBColor::BLACK, const SUMOReal angle=0)
draw Text with given parameters
Definition: GLHelper.cpp:460
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
SUMOReal beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position ...
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:253
EdgeBasicFunction
Defines possible edge types.
Definition: MSEdge.h:89
const Position geometryPositionAtOffset(SUMOReal offset, SUMOReal lateralOffset=0) const
Definition: MSLane.h:439
static SUMOReal getTotalLength(bool includeInternal, bool eachLane)
Definition: GUIEdge.cpp:115
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 MSEdge & getEdge() const
Returns the edge this segment belongs to.
Definition: MESegment.h:272
GUIGlID getGlID() const
Returns the numerical id of the object.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
SUMOReal scale
information about a lane&#39;s width (temporary, used for a single view)
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:70
SUMOReal getRelativeSpeed() const
return meanSpead divided by allowedSpeed
Definition: GUIEdge.cpp:402
GUIVisualizationTextSettings edgeName
A road/street connecting two junctions (gui-version)
Definition: GUIEdge.h:60
const std::string & getID() const
Returns the id.
Definition: Named.h:66
A road/street connecting two junctions.
Definition: MSEdge.h:80
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void rebuildAllowedLanes()
Definition: MSEdge.cpp:252
SUMOReal getLength() const
return the length of the edge
Definition: MSEdge.h:585
~GUIEdge()
Destructor.
Definition: GUIEdge.cpp:84
bool setMultiColor(const GUIColorer &c) const
sets multiple colors according to the current scheme index and edge function
Definition: GUIEdge.cpp:432
The edge is a district edge.
Definition: MSEdge.h:99
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:443
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
Definition: GUINet.cpp:502
void closeTraffic(const GUILane *lane)
close this edge for traffic
Definition: GUIEdge.cpp:533
GUIVisualizationTextSettings internalEdgeName
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
A list of positions.
SUMOTime begin
The begin time these definitions are valid.
SUMOReal getLength() const
Returns the length of the segment in meters.
Definition: MESegment.h:166
size_t getCarNumber() const
Returns the total number of cars on the segment.
Definition: MESegment.cpp:288
MSEdgeVector mySuccessors
The succeeding edges.
Definition: MSEdge.h:778
virtual GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIEdge.cpp:187
bool setFunctionalColor(size_t activeScheme) const
sets the color according to the current scheme index and some edge function
Definition: GUIEdge.cpp:417
Position positionAtOffset(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
const T getColor(const SUMOReal value) const
SUMOReal getColorValue(size_t activeScheme) const
gets the color value according to the current scheme index
Definition: GUIEdge.cpp:480
SUMOReal getAllowedSpeed() const
Definition: GUIEdge.cpp:396
static MSEdge mySpecialDest_keepDestination
special destination values
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason)
Tries to reroute the vehicle.
float minSize
The minimum size to draw this object.
const std::vector< MSLane * > * myLanes
Container for the edge&#39;s lane; should be sorted: (right-hand-traffic) the more left the lane...
Definition: MSEdge.h:760
MSLane & getLane(size_t laneNo)
returns the enumerated lane (!!! why not private with a friend?)
Definition: GUIEdge.cpp:93
void drawName(const Position &pos, const SUMOReal scale, const GUIVisualizationTextSettings &settings, const SUMOReal angle=0) const
draw name of item
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:55
SUMOReal getSpeedLimit() const
Returns the speed limit of the edge The speed limit of the first lane is retured; should probably be...
Definition: MSEdge.cpp:762
void addRerouter()
add a rerouter
Definition: GUIEdge.cpp:547
std::vector< MSVehicle * > VehCont
Container for vehicles.
Definition: MSLane.h:91
static SUMOReal naviDegree(const SUMOReal angle)
Definition: GeomHelper.cpp:191
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPerson.cpp:246
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIEdge.cpp:408
void drawMesoVehicles(const GUIVisualizationSettings &s) const
Definition: GUIEdge.cpp:302
void drawOnPos(const GUIVisualizationSettings &s, const Position &pos, const SUMOReal angle) const
Draws the object on the specified position with the specified angle.
void unlock()
release mutex lock
Definition: MFXMutex.cpp:96
GUIEdge(const std::string &id, int numericalID, const EdgeBasicFunction function, const std::string &streetName, const std::string &edgeType, int priority)
Constructor.
Definition: GUIEdge.cpp:77
The edge is a pedestrian walking area (a special type of internal edge)
Definition: MSEdge.h:103
static std::vector< GUIGlID > getIDs(bool includeInternal)
Definition: GUIEdge.cpp:100
MESegment * getSegmentAtPosition(const Position &pos)
returns the segment closest to the given position
Definition: GUIEdge.cpp:524
SUMOReal length() const
Returns the length.
SUMOReal rotationDegreeAtOffset(SUMOReal pos) const
Returns the rotation at the given length.
void add(SUMOReal x, SUMOReal y)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:76
Boundary & grow(SUMOReal by)
extends the boundary by the given amount
Definition: Boundary.cpp:201
EdgeBasicFunction getPurpose() const
Returns the edge type (EdgeBasicFunction)
Definition: MSEdge.h:249
unsigned int getVehicleNo() const
Definition: GUIEdge.cpp:351
SUMOReal getBruttoOccupancy() const
Definition: GUIEdge.cpp:386
SUMOTime end
The end time these definitions are valid.
#define SUMOTime_MAX
Definition: SUMOTime.h:44
SUMOReal getRelativeOccupancy() const
Returns the relative occupany of the segment (percentage of road used))
Definition: MESegment.h:182
A MSVehicle extended by some values for usage within the gui.
Definition: GUIMEVehicle.h:61
GUIVisualizationSizeSettings containerSize
MFXMutex myLock
The mutex used to avoid concurrent updates of myPersons/ myContainers.
Definition: GUIEdge.h:230
The edge is a normal street.
Definition: MSEdge.h:93
A mutex encapsulator which locks/unlocks the given mutex on construction/destruction, respectively.
Definition: AbstractMutex.h:71
SUMOReal interpolateLanePosToGeometryPos(SUMOReal lanePos) const
Definition: MSLane.h:433
SUMOReal getMeanSpeed() const
get the mean speed
Definition: MSEdge.cpp:622
A single mesoscopic segment (cell)
Definition: MESegment.h:57
The edge is a pedestrian crossing (a special type of internal edge)
Definition: MSEdge.h:101
static size_t dictSize()
Returns the number of edges.
Definition: MSEdge.cpp:693
const MSVehicleType & getVehicleType() const
Returns the vehicle&#39;s type definition.
Definition: MSBaseVehicle.h:97
std::vector< RerouteInterval > myIntervals
List of rerouting definition intervals.
The popup menu of a globject.
an edge
MESegment * getSegmentForEdge(const MSEdge &e, SUMOReal pos=0)
Get the segment for a given edge at a given position.
Definition: MELoop.cpp:295
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIEdge.cpp:229
std::string myStreetName
the real-world name of this edge (need not be unique)
Definition: MSEdge.h:810
void mul(SUMOReal val)
Multiplies both positions with the given value.
Definition: Position.h:99
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
static MELoop * gMesoNet
mesoscopic simulation infrastructure
Definition: MSGlobals.h:102
GUIVisualizationSizeSettings personSize
void lock()
lock mutex
Definition: MFXMutex.cpp:86
std::string getVehicleIDs() const
Definition: GUIEdge.cpp:361
static DictType myDict
Static dictionary to associate string-ids with objects.
Definition: MSEdge.h:845
SUMOReal getRoutingSpeed() const
Returns the averaged speed used by the routing device.
Definition: MSEdge.cpp:659
#define SUMOReal
Definition: config.h:214
GUIVisualizationSizeSettings vehicleSize
Boundary getBoundary() const
Returns the street&#39;s geometry.
Definition: GUIEdge.cpp:129
FXbool locked()
Definition: MFXMutex.h:70
empty max
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:77
Position getPositionInformation() const
Returns the cursor&#39;s x/y position within the network.
The edge is an internal edge.
Definition: MSEdge.h:97
void mkItem(const char *name, bool dynamic, ValueSource< unsigned > *src)
Adds a row which obtains its value from an unsigned-ValueSource.
MSEdgeVector myPredecessors
The preceeding edges.
Definition: MSEdge.h:781
GUISelectedStorage gSelected
A global holder of selected objects.
void closeBuilding()
Closes the building of the table.
static bool gUseMesoSim
Definition: MSGlobals.h:90
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
A window containing a gl-object&#39;s parameter.
SUMOReal getRelativeJamThreshold() const
Returns the relative occupany of the segment (percentage of road used)) at which the segment is consi...
Definition: MESegment.h:190
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
static void fill(std::vector< GUIEdge * > &netsWrappers)
Definition: GUIEdge.cpp:157
SUMOReal getEventTimeSeconds() const
Like getEventTime but returns seconds (for visualization)
Definition: MESegment.h:289
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
const PositionVector & getShape() const
Definition: GUILane.cpp:767
std::set< MSTransportable * > myPersons
Persons on the edge for drawing and pushbutton.
Definition: MSEdge.h:788