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-2017 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>
53 #include <microsim/MSGlobals.h>
56 #include "GUITriggeredRerouter.h"
57 #include "GUIEdge.h"
58 #include "GUIVehicle.h"
59 #include "GUINet.h"
60 #include "GUILane.h"
61 #include "GUIPerson.h"
62 #include "GUIContainer.h"
63 
65 #include <mesogui/GUIMEVehicle.h>
66 #include <mesosim/MESegment.h>
67 #include <mesosim/MELoop.h>
68 #include <mesosim/MEVehicle.h>
69 
70 #ifdef CHECK_MEMORY_LEAKS
71 #include <foreign/nvwa/debug_new.h>
72 #endif // CHECK_MEMORY_LEAKS
73 
74 
75 // ===========================================================================
76 // included modules
77 // ===========================================================================
78 GUIEdge::GUIEdge(const std::string& id, int numericalID,
79  const EdgeBasicFunction function,
80  const std::string& streetName, const std::string& edgeType, int priority)
81  : MSEdge(id, numericalID, function, streetName, edgeType, priority),
82  GUIGlObject(GLO_EDGE, id) {}
83 
84 
86  // just to quit cleanly on a failure
87  if (myLock.locked()) {
88  myLock.unlock();
89  }
90 }
91 
92 
93 MSLane&
94 GUIEdge::getLane(int laneNo) {
95  assert(laneNo < (int)myLanes->size());
96  return *((*myLanes)[laneNo]);
97 }
98 
99 
100 std::vector<GUIGlID>
101 GUIEdge::getIDs(bool includeInternal) {
102  std::vector<GUIGlID> ret;
103  ret.reserve(MSEdge::myDict.size());
104  for (MSEdge::DictType::const_iterator i = MSEdge::myDict.begin(); i != MSEdge::myDict.end(); ++i) {
105  const GUIEdge* edge = dynamic_cast<const GUIEdge*>(i->second);
106  assert(edge);
107  if (edge->getPurpose() != EDGEFUNCTION_INTERNAL || includeInternal) {
108  ret.push_back(edge->getGlID());
109  }
110  }
111  return ret;
112 }
113 
114 
115 SUMOReal
116 GUIEdge::getTotalLength(bool includeInternal, bool eachLane) {
117  SUMOReal result = 0;
118  for (MSEdge::DictType::const_iterator i = MSEdge::myDict.begin(); i != MSEdge::myDict.end(); ++i) {
119  const MSEdge* edge = i->second;
120  if (edge->getPurpose() != EDGEFUNCTION_INTERNAL || includeInternal) {
121  // @note needs to be change once lanes may have different length
122  result += edge->getLength() * (eachLane ? edge->getLanes().size() : 1);
123  }
124  }
125  return result;
126 }
127 
128 
129 Boundary
131  Boundary ret;
133  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
134  ret.add((*i)->getShape().getBoxBoundary());
135  }
136  } else {
137  // take the starting coordinates of all follower edges and the endpoints
138  // of all successor edges
139  for (MSEdgeVector::const_iterator it = mySuccessors.begin(); it != mySuccessors.end(); ++it) {
140  const std::vector<MSLane*>& lanes = (*it)->getLanes();
141  for (std::vector<MSLane*>::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); ++it_lane) {
142  ret.add((*it_lane)->getShape().front());
143  }
144  }
145  for (MSEdgeVector::const_iterator it = myPredecessors.begin(); it != myPredecessors.end(); ++it) {
146  const std::vector<MSLane*>& lanes = (*it)->getLanes();
147  for (std::vector<MSLane*>::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); ++it_lane) {
148  ret.add((*it_lane)->getShape().back());
149  }
150  }
151  }
152  ret.grow(10);
153  return ret;
154 }
155 
156 
157 void
158 GUIEdge::fill(std::vector<GUIEdge*>& netsWrappers) {
159  int size = MSEdge::dictSize();
160  netsWrappers.reserve(size);
161  for (DictType::iterator i = myDict.begin(); i != myDict.end(); ++i) {
162  if (i->second->getPurpose() != MSEdge::EDGEFUNCTION_DISTRICT) {
163  netsWrappers.push_back(static_cast<GUIEdge*>((*i).second));
164  }
165  }
166 }
167 
168 
169 
172  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
173  buildPopupHeader(ret, app);
179  }
180  const SUMOReal pos = getLanes()[0]->getShape().nearest_offset_to_point2D(parent.getPositionInformation());
181  new FXMenuCommand(ret, ("pos: " + toString(pos)).c_str(), 0, 0, 0);
182  buildPositionCopyEntry(ret, false);
183  return ret;
184 }
185 
186 
189  GUISUMOAbstractView& parent) {
190  GUIParameterTableWindow* ret = 0;
191  ret = new GUIParameterTableWindow(app, *this, 18);
192  // add edge items
193  ret->mkItem("length [m]", false, (*myLanes)[0]->getLength());
194  ret->mkItem("allowed speed [m/s]", false, getAllowedSpeed());
195  ret->mkItem("brutto occupancy [%]", true, new FunctionBinding<GUIEdge, SUMOReal>(this, &GUIEdge::getBruttoOccupancy, 100.));
196  ret->mkItem("mean vehicle speed [m/s]", true, new FunctionBinding<GUIEdge, SUMOReal>(this, &GUIEdge::getMeanSpeed));
197  ret->mkItem("flow [veh/h/lane]", true, new FunctionBinding<GUIEdge, SUMOReal>(this, &GUIEdge::getFlow));
198  ret->mkItem("routing speed [m/s]", true, new FunctionBinding<MSEdge, SUMOReal>(this, &MSEdge::getRoutingSpeed));
200  ret->mkItem("vehicle ids", false, getVehicleIDs());
201  // add segment items
203  ret->mkItem("segment index", false, segment->getIndex());
204  ret->mkItem("segment queues", false, segment->numQueues());
205  ret->mkItem("segment length [m]", false, segment->getLength());
206  ret->mkItem("segment allowed speed [m/s]", false, segment->getEdge().getSpeedLimit());
207  ret->mkItem("segment jam threshold [%]", false, segment->getRelativeJamThreshold() * 100);
208  ret->mkItem("segment brutto occupancy [%]", true, new FunctionBinding<MESegment, SUMOReal>(segment, &MESegment::getRelativeOccupancy, 100));
209  ret->mkItem("segment mean vehicle speed [m/s]", true, new FunctionBinding<MESegment, SUMOReal>(segment, &MESegment::getMeanSpeed));
210  ret->mkItem("segment flow [veh/h/lane]", true, new FunctionBinding<MESegment, SUMOReal>(segment, &MESegment::getFlow));
211  ret->mkItem("segment #vehicles", true, new CastingFunctionBinding<MESegment, SUMOReal, int>(segment, &MESegment::getCarNumber));
212  ret->mkItem("segment leader leave time", true, new FunctionBinding<MESegment, SUMOReal>(segment, &MESegment::getEventTimeSeconds));
213  ret->mkItem("segment headway [s]", true, new FunctionBinding<MESegment, SUMOReal>(segment, &MESegment::getLastHeadwaySeconds));
214 
215  // close building
216  ret->closeBuilding();
217  return ret;
218 }
219 
220 
221 Boundary
223  Boundary b = getBoundary();
224  // ensure that vehicles and persons on the side are drawn even if the edge
225  // is outside the view
226  b.grow(10);
227  return b;
228 }
229 
230 
231 void
234  return;
235  }
236  glPushName(getGlID());
237  // draw the lanes
238  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
240  setColor(s);
241  }
242  GUILane* l = dynamic_cast<GUILane*>(*i);
243  if (l != 0) {
244  l->drawGL(s);
245  }
246  }
249  drawMesoVehicles(s);
250  }
251  }
252  glPopName();
253  // (optionally) draw the name and/or the street name
254  const bool drawEdgeName = s.edgeName.show && myFunction == EDGEFUNCTION_NORMAL;
255  const bool drawInternalEdgeName = s.internalEdgeName.show && myFunction == EDGEFUNCTION_INTERNAL;
256  const bool drawCwaEdgeName = s.cwaEdgeName.show && (myFunction == EDGEFUNCTION_CROSSING || myFunction == EDGEFUNCTION_WALKINGAREA);
257  const bool drawStreetName = s.streetName.show && myStreetName != "";
258  if (drawEdgeName || drawInternalEdgeName || drawCwaEdgeName || drawStreetName) {
259  GUILane* lane1 = dynamic_cast<GUILane*>((*myLanes)[0]);
260  GUILane* lane2 = dynamic_cast<GUILane*>((*myLanes).back());
261  if (lane1 != 0 && lane2 != 0) {
262  Position p = lane1->getShape().positionAtOffset(lane1->getShape().length() / (SUMOReal) 2.);
263  p.add(lane2->getShape().positionAtOffset(lane2->getShape().length() / (SUMOReal) 2.));
264  p.mul(.5);
265  SUMOReal angle = lane1->getShape().rotationDegreeAtOffset(lane1->getShape().length() / (SUMOReal) 2.);
266  angle += 90;
267  if (angle > 90 && angle < 270) {
268  angle -= 180;
269  }
270  if (drawEdgeName) {
271  drawName(p, s.scale, s.edgeName, angle);
272  } else if (drawInternalEdgeName) {
273  drawName(p, s.scale, s.internalEdgeName, angle);
274  } else if (drawCwaEdgeName) {
275  drawName(p, s.scale, s.cwaEdgeName, angle);
276  }
277  if (drawStreetName) {
279  s.streetName.size / s.scale, s.streetName.color, angle);
280  }
281  }
282  }
284  myLock.lock();
285  for (std::set<MSTransportable*>::const_iterator i = myPersons.begin(); i != myPersons.end(); ++i) {
286  GUIPerson* person = dynamic_cast<GUIPerson*>(*i);
287  assert(person != 0);
288  person->drawGL(s);
289  }
290  myLock.unlock();
291  }
293  myLock.lock();
294  for (std::set<MSTransportable*>::const_iterator i = myContainers.begin(); i != myContainers.end(); ++i) {
295  GUIContainer* container = dynamic_cast<GUIContainer*>(*i);
296  assert(container != 0);
297  container->drawGL(s);
298  }
299  myLock.unlock();
300  }
301 }
302 
303 
304 void
307  if (vehicleControl != 0) {
308  // draw the meso vehicles
309  vehicleControl->secureVehicles();
311  int laneIndex = 0;
312  MESegment::Queue queue;
313  for (std::vector<MSLane*>::const_iterator msl = myLanes->begin(); msl != myLanes->end(); ++msl, ++laneIndex) {
314  GUILane* l = static_cast<GUILane*>(*msl);
315  // go through the vehicles
316  SUMOReal segmentOffset = 0; // offset at start of current segment
317  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
318  segment != 0; segment = segment->getNextSegment()) {
319  const SUMOReal length = segment->getLength();
320  if (laneIndex < segment->numQueues()) {
321  // make a copy so we don't have to worry about synchronization
322  queue = segment->getQueue(laneIndex);
323  const int queueSize = (int)queue.size();
324  SUMOReal vehiclePosition = segmentOffset + length;
325  // draw vehicles beginning with the leader at the end of the segment
326  SUMOReal xOff = 0;
327  for (int i = 0; i < queueSize; ++i) {
328  GUIMEVehicle* veh = static_cast<GUIMEVehicle*>(queue[queueSize - i - 1]);
329  const SUMOReal vehLength = veh->getVehicleType().getLengthWithGap();
330  while (vehiclePosition < segmentOffset) {
331  // if there is only a single queue for a
332  // multi-lane edge shift vehicles and start
333  // drawing again from the end of the segment
334  vehiclePosition += length;
335  xOff += 2;
336  }
337  const Position p = l->geometryPositionAtOffset(vehiclePosition);
338  const SUMOReal angle = l->getShape().rotationAtOffset(l->interpolateLanePosToGeometryPos(vehiclePosition));
339  veh->drawOnPos(s, p, angle);
340  vehiclePosition -= vehLength;
341  }
342  }
343  segmentOffset += length;
344  }
345  glPopMatrix();
346  }
347  vehicleControl->releaseVehicles();
348  }
349 }
350 
351 
352 
353 int
355  int vehNo = 0;
356  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
357  vehNo += segment->getCarNumber();
358  }
359  return (int)vehNo;
360 }
361 
362 
363 std::string
365  std::string result = " ";
366  std::vector<const MEVehicle*> vehs;
367  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
368  std::vector<const MEVehicle*> segmentVehs = segment->getVehicles();
369  vehs.insert(vehs.end(), segmentVehs.begin(), segmentVehs.end());
370  }
371  for (std::vector<const MEVehicle*>::const_iterator it = vehs.begin(); it != vehs.end(); it++) {
372  result += (*it)->getID() + " ";
373  }
374  return result;
375 }
376 
377 
378 SUMOReal
380  SUMOReal flow = 0;
381  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
382  flow += (SUMOReal) segment->getCarNumber() * segment->getMeanSpeed();
383  }
384  return 3600 * flow / (*myLanes)[0]->getLength();
385 }
386 
387 
388 SUMOReal
390  SUMOReal occ = 0;
391  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
392  occ += segment->getBruttoOccupancy();
393  }
394  return occ / (*myLanes)[0]->getLength() / (SUMOReal)(myLanes->size());
395 }
396 
397 
398 SUMOReal
400  return (*myLanes)[0]->getSpeedLimit();
401 }
402 
403 
404 SUMOReal
406  return getMeanSpeed() / getAllowedSpeed();
407 }
408 
409 
410 void
412  myMesoColor = RGBColor(0, 0, 0); // default background color when using multiColor
413  const GUIColorer& c = s.edgeColorer;
414  if (!setFunctionalColor(c.getActive()) && !setMultiColor(c)) {
416  }
417 }
418 
419 
420 bool
421 GUIEdge::setFunctionalColor(int activeScheme) const {
422  switch (activeScheme) {
423  case 9: {
424  const PositionVector& shape = getLanes()[0]->getShape();
425  SUMOReal hue = GeomHelper::naviDegree(shape.beginEndAngle()); // [0-360]
426  myMesoColor = RGBColor::fromHSV(hue, 1., 1.);
427  return true;
428  }
429  default:
430  return false;
431  }
432 }
433 
434 
435 bool
437  const int activeScheme = c.getActive();
438  mySegmentColors.clear();
439  switch (activeScheme) {
440  case 10: // alternating segments
441  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
442  segment != 0; segment = segment->getNextSegment()) {
443  mySegmentColors.push_back(c.getScheme().getColor(segment->getIndex() % 2));
444  }
445  //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";
446  return true;
447  case 11: // by segment jammed state
448  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
449  segment != 0; segment = segment->getNextSegment()) {
450  mySegmentColors.push_back(c.getScheme().getColor(segment->free() ? 0 : 1));
451  }
452  return true;
453  case 12: // by segment occupancy
454  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
455  segment != 0; segment = segment->getNextSegment()) {
456  mySegmentColors.push_back(c.getScheme().getColor(segment->getRelativeOccupancy()));
457  }
458  return true;
459  case 13: // by segment speed
460  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
461  segment != 0; segment = segment->getNextSegment()) {
462  mySegmentColors.push_back(c.getScheme().getColor(segment->getMeanSpeed()));
463  }
464  return true;
465  case 14: // by segment flow
466  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
467  segment != 0; segment = segment->getNextSegment()) {
468  mySegmentColors.push_back(c.getScheme().getColor(3600 * segment->getCarNumber() * segment->getMeanSpeed() / segment->getLength()));
469  }
470  return true;
471  case 15: // by segment relative speed
472  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
473  segment != 0; segment = segment->getNextSegment()) {
474  mySegmentColors.push_back(c.getScheme().getColor(segment->getMeanSpeed() / getAllowedSpeed()));
475  }
476  return true;
477  default:
478  return false;
479  }
480 }
481 
482 
483 SUMOReal
484 GUIEdge::getColorValue(int activeScheme) const {
485  switch (activeScheme) {
486  case 1:
487  return gSelected.isSelected(getType(), getGlID());
488  case 2:
489  return getPurpose();
490  case 3:
491  return getAllowedSpeed();
492  case 4:
493  return getBruttoOccupancy();
494  case 5:
495  return getMeanSpeed();
496  case 6:
497  return getFlow();
498  case 7:
499  return getRelativeSpeed();
500  case 8:
501  return getRoutingSpeed();
502  case 16:
504  }
505  return 0;
506 }
507 
508 
509 SUMOReal
510 GUIEdge::getScaleValue(int activeScheme) const {
511  switch (activeScheme) {
512  case 1:
513  return gSelected.isSelected(getType(), getGlID());
514  case 2:
515  return getAllowedSpeed();
516  case 3:
517  return getBruttoOccupancy();
518  case 4:
519  return getMeanSpeed();
520  case 5:
521  return getFlow();
522  case 6:
523  return getRelativeSpeed();
524  case 7:
526  }
527  return 0;
528 }
529 
530 
531 MESegment*
533  const PositionVector& shape = getLanes()[0]->getShape();
534  const SUMOReal lanePos = shape.nearest_offset_to_point2D(pos);
535  return MSGlobals::gMesoNet->getSegmentForEdge(*this, lanePos);
536 }
537 
538 
539 
540 void
542  const std::vector<MSLane*>& lanes = getLanes();
543  const bool isClosed = lane->isClosed();
544  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
545  GUILane* l = dynamic_cast<GUILane*>(*i);
546  if (l->isClosed() == isClosed) {
547  l->closeTraffic(false);
548  }
549  }
551 }
552 
553 
554 void
556  MSEdgeVector edges;
557  edges.push_back(this);
558  GUITriggeredRerouter* rr = new GUITriggeredRerouter(getID() + "_dynamic_rerouter", edges, 1, "", false,
559  GUINet::getGUIInstance()->getVisualisationSpeedUp());
560 
563  ri.end = SUMOTime_MAX;
565  rr->myIntervals.push_back(ri);
566 
567  // trigger rerouting for vehicles already on this edge
568  const std::vector<MSLane*>& lanes = getLanes();
569  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
570  const MSLane::VehCont& vehicles = (*i)->getVehiclesSecure();
571  for (MSLane::VehCont::const_iterator v = vehicles.begin(); v != vehicles.end(); ++v) {
572  if ((*v)->getLane() == (*i)) {
574  } // else: this is the shadow during a continuous lane change
575  }
576  (*i)->releaseVehicles();
577  }
578 }
579 
580 /****************************************************************************/
581 
SUMOReal getExaggeration(const GUIVisualizationSettings &s, SUMOReal factor=20) const
return the drawing size including exaggeration and constantSize values
RGBColor myMesoColor
Definition: GUIEdge.h:238
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIEdge.cpp:222
std::set< MSTransportable * > myContainers
Containers on the edge.
Definition: MSEdge.h:794
SUMOReal getFlow() const
returns flow based on headway
Definition: MESegment.cpp:697
std::vector< MEVehicle * > Queue
Definition: MESegment.h:86
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:133
static int dictSize()
Returns the number of edges.
Definition: MSEdge.cpp:720
bool isClosed() const
Definition: GUILane.h:252
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIEdge.cpp:171
const std::vector< MSLane * > & getLanes() const
Returns this edge&#39;s lanes.
Definition: MSEdge.h:192
SUMOReal getColorValue(int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIEdge.cpp:484
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:1107
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:222
Stores the information about how to visualize structures.
SUMOReal minSize
The minimum size to draw this object.
const EdgeBasicFunction myFunction
the purpose of the edge
Definition: MSEdge.h:764
GUIColorer edgeColorer
The mesoscopic edge colorer.
SUMOReal getFlow() const
return flow based on meanSpead
Definition: GUIEdge.cpp:379
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUILane.cpp:441
const std::string & getStreetName() const
Returns the street name of the edge.
Definition: MSEdge.h:282
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:521
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:206
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:255
EdgeBasicFunction
Defines possible edge types.
Definition: MSEdge.h:89
const Position geometryPositionAtOffset(SUMOReal offset, SUMOReal lateralOffset=0) const
Definition: MSLane.h:444
static SUMOReal getTotalLength(bool includeInternal, bool eachLane)
Definition: GUIEdge.cpp:116
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:271
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
MSLane & getLane(int laneNo)
returns the enumerated lane (!!! why not private with a friend?)
Definition: GUIEdge.cpp:94
SUMOReal getRelativeSpeed() const
return meanSpead divided by allowedSpeed
Definition: GUIEdge.cpp:405
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:250
SUMOReal getLength() const
return the length of the edge
Definition: MSEdge.h:580
SUMOReal getLastHeadwaySeconds() const
get the last headway time in seconds
Definition: MESegment.h:293
~GUIEdge()
Destructor.
Definition: GUIEdge.cpp:85
bool setMultiColor(const GUIColorer &c) const
sets multiple colors according to the current scheme index and edge function
Definition: GUIEdge.cpp:436
The edge is a district edge.
Definition: MSEdge.h:99
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:55
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
Definition: GUINet.cpp:494
void closeTraffic(const GUILane *lane)
close this edge for traffic
Definition: GUIEdge.cpp:541
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:165
MSEdgeVector mySuccessors
The succeeding edges.
Definition: MSEdge.h:781
virtual GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIEdge.cpp:188
Position positionAtOffset(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
const T getColor(const SUMOReal value) const
SUMOReal getAllowedSpeed() const
Definition: GUIEdge.cpp:399
static MSEdge mySpecialDest_keepDestination
special destination values
int getVehicleNo() const
Definition: GUIEdge.cpp:354
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason)
Tries to reroute the vehicle.
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:758
void drawName(const Position &pos, const SUMOReal scale, const GUIVisualizationTextSettings &settings, const SUMOReal angle=0) const
draw name of item
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:789
void addRerouter()
add a rerouter
Definition: GUIEdge.cpp:555
std::vector< MSVehicle * > VehCont
Container for vehicles.
Definition: MSLane.h:91
static SUMOReal naviDegree(const SUMOReal angle)
Definition: GeomHelper.cpp:191
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some edge function
Definition: GUIEdge.cpp:421
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPerson.cpp:245
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIEdge.cpp:411
void drawMesoVehicles(const GUIVisualizationSettings &s) const
Definition: GUIEdge.cpp:305
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:78
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:101
MESegment * getSegmentAtPosition(const Position &pos)
returns the segment closest to the given position
Definition: GUIEdge.cpp:532
SUMOReal length() const
Returns the length.
SUMOReal rotationDegreeAtOffset(SUMOReal pos) const
Returns the rotation at the given length.
int numQueues() const
return the number of queues
Definition: MESegment.h:134
Boundary & grow(SUMOReal by)
extends the boundary by the given amount
Definition: Boundary.cpp:238
EdgeBasicFunction getPurpose() const
Returns the edge type (EdgeBasicFunction)
Definition: MSEdge.h:249
SUMOReal getBruttoOccupancy() const
Definition: GUIEdge.cpp:389
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:181
void add(SUMOReal x, SUMOReal y, SUMOReal z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:90
A MSVehicle extended by some values for usage within the gui.
Definition: GUIMEVehicle.h:61
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:361
GUIVisualizationSizeSettings containerSize
MFXMutex myLock
The mutex used to avoid concurrent updates of myPersons/ myContainers.
Definition: GUIEdge.h:236
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:438
SUMOReal getMeanSpeed() const
get the mean speed
Definition: MSEdge.cpp:649
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
const MSVehicleType & getVehicleType() const
Returns the vehicle&#39;s type definition.
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:293
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIEdge.cpp:232
std::string myStreetName
the real-world name of this edge (need not be unique)
Definition: MSEdge.h:813
void mul(SUMOReal val)
Multiplies both positions with the given value.
Definition: Position.h:113
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:110
GUIVisualizationSizeSettings personSize
void lock()
lock mutex
Definition: MFXMutex.cpp:86
int getCarNumber() const
Returns the total number of cars on the segment.
Definition: MESegment.cpp:307
int getIndex() const
Returns the running index of the segment in the edge (0 is the most upstream).
Definition: MESegment.h:149
std::string getVehicleIDs() const
Definition: GUIEdge.cpp:364
static DictType myDict
Static dictionary to associate string-ids with objects.
Definition: MSEdge.h:848
SUMOReal getRoutingSpeed() const
Returns the averaged speed used by the routing device.
Definition: MSEdge.cpp:686
#define SUMOReal
Definition: config.h:208
GUIVisualizationSizeSettings vehicleSize
Boundary getBoundary() const
Returns the street&#39;s geometry.
Definition: GUIEdge.cpp:130
FXbool locked()
Definition: MFXMutex.h:70
SUMOReal getScaleValue(int activeScheme) const
gets the scaling value according to the current scheme index
Definition: GUIEdge.cpp:510
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:784
GUISelectedStorage gSelected
A global holder of selected objects.
void closeBuilding()
Closes the building of the table.
static bool gUseMesoSim
Definition: MSGlobals.h:95
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:189
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
static void fill(std::vector< GUIEdge * > &netsWrappers)
Definition: GUIEdge.cpp:158
int getPendingEmits(const MSLane *lane)
return the number of pending emits for the given lane
SUMOReal getEventTimeSeconds() const
Like getEventTime but returns seconds (for visualization)
Definition: MESegment.h:288
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
const PositionVector & getShape() const
Definition: GUILane.cpp:805
std::set< MSTransportable * > myPersons
Persons on the edge for drawing and pushbutton.
Definition: MSEdge.h:791