SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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>
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, 16);
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 length [m]", false, segment->getLength());
205  ret->mkItem("segment allowed speed [m/s]", false, segment->getEdge().getSpeedLimit());
206  ret->mkItem("segment jam threshold [%]", false, segment->getRelativeJamThreshold() * 100);
207  ret->mkItem("segment brutto occupancy [%]", true, new FunctionBinding<MESegment, SUMOReal>(segment, &MESegment::getRelativeOccupancy, 100));
208  ret->mkItem("segment mean vehicle speed [m/s]", true, new FunctionBinding<MESegment, SUMOReal>(segment, &MESegment::getMeanSpeed));
209  ret->mkItem("segment flow [veh/h/lane]", true, new FunctionBinding<MESegment, SUMOReal>(segment, &MESegment::getFlow));
210  ret->mkItem("segment #vehicles", true, new CastingFunctionBinding<MESegment, SUMOReal, int>(segment, &MESegment::getCarNumber));
211  ret->mkItem("segment leader leave time", true, new FunctionBinding<MESegment, SUMOReal>(segment, &MESegment::getEventTimeSeconds));
212 
213  // close building
214  ret->closeBuilding();
215  return ret;
216 }
217 
218 
219 Boundary
221  Boundary b = getBoundary();
222  // ensure that vehicles and persons on the side are drawn even if the edge
223  // is outside the view
224  b.grow(10);
225  return b;
226 }
227 
228 
229 void
232  return;
233  }
234  glPushName(getGlID());
235  // draw the lanes
236  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
238  setColor(s);
239  }
240  GUILane* l = dynamic_cast<GUILane*>(*i);
241  if (l != 0) {
242  l->drawGL(s);
243  }
244  }
247  drawMesoVehicles(s);
248  }
249  }
250  glPopName();
251  // (optionally) draw the name and/or the street name
252  const bool drawEdgeName = s.edgeName.show && myFunction == EDGEFUNCTION_NORMAL;
253  const bool drawInternalEdgeName = s.internalEdgeName.show && myFunction == EDGEFUNCTION_INTERNAL;
254  const bool drawCwaEdgeName = s.cwaEdgeName.show && (myFunction == EDGEFUNCTION_CROSSING || myFunction == EDGEFUNCTION_WALKINGAREA);
255  const bool drawStreetName = s.streetName.show && myStreetName != "";
256  if (drawEdgeName || drawInternalEdgeName || drawCwaEdgeName || drawStreetName) {
257  GUILane* lane1 = dynamic_cast<GUILane*>((*myLanes)[0]);
258  GUILane* lane2 = dynamic_cast<GUILane*>((*myLanes).back());
259  if (lane1 != 0 && lane2 != 0) {
260  Position p = lane1->getShape().positionAtOffset(lane1->getShape().length() / (SUMOReal) 2.);
261  p.add(lane2->getShape().positionAtOffset(lane2->getShape().length() / (SUMOReal) 2.));
262  p.mul(.5);
263  SUMOReal angle = lane1->getShape().rotationDegreeAtOffset(lane1->getShape().length() / (SUMOReal) 2.);
264  angle += 90;
265  if (angle > 90 && angle < 270) {
266  angle -= 180;
267  }
268  if (drawEdgeName) {
269  drawName(p, s.scale, s.edgeName, angle);
270  } else if (drawInternalEdgeName) {
271  drawName(p, s.scale, s.internalEdgeName, angle);
272  } else if (drawCwaEdgeName) {
273  drawName(p, s.scale, s.cwaEdgeName, angle);
274  }
275  if (drawStreetName) {
277  s.streetName.size / s.scale, s.streetName.color, angle);
278  }
279  }
280  }
282  myLock.lock();
283  for (std::set<MSTransportable*>::const_iterator i = myPersons.begin(); i != myPersons.end(); ++i) {
284  GUIPerson* person = dynamic_cast<GUIPerson*>(*i);
285  assert(person != 0);
286  person->drawGL(s);
287  }
288  myLock.unlock();
289  }
291  myLock.lock();
292  for (std::set<MSTransportable*>::const_iterator i = myContainers.begin(); i != myContainers.end(); ++i) {
293  GUIContainer* container = dynamic_cast<GUIContainer*>(*i);
294  assert(container != 0);
295  container->drawGL(s);
296  }
297  myLock.unlock();
298  }
299 }
300 
301 
302 void
305  if (vehicleControl != 0) {
306  // draw the meso vehicles
307  vehicleControl->secureVehicles();
309  int laneIndex = 0;
310  MESegment::Queue queue;
311  for (std::vector<MSLane*>::const_iterator msl = myLanes->begin(); msl != myLanes->end(); ++msl, ++laneIndex) {
312  GUILane* l = static_cast<GUILane*>(*msl);
313  // go through the vehicles
314  SUMOReal segmentOffset = 0; // offset at start of current segment
315  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
316  segment != 0; segment = segment->getNextSegment()) {
317  const SUMOReal length = segment->getLength();
318  if (laneIndex < segment->numQueues()) {
319  // make a copy so we don't have to worry about synchronization
320  queue = segment->getQueue(laneIndex);
321  const int queueSize = (int)queue.size();
322  SUMOReal vehiclePosition = segmentOffset + length;
323  // draw vehicles beginning with the leader at the end of the segment
324  SUMOReal xOff = 0;
325  for (int i = 0; i < queueSize; ++i) {
326  GUIMEVehicle* veh = static_cast<GUIMEVehicle*>(queue[queueSize - i - 1]);
327  const SUMOReal vehLength = veh->getVehicleType().getLengthWithGap();
328  while (vehiclePosition < segmentOffset) {
329  // if there is only a single queue for a
330  // multi-lane edge shift vehicles and start
331  // drawing again from the end of the segment
332  vehiclePosition += length;
333  xOff += 2;
334  }
335  const Position p = l->geometryPositionAtOffset(vehiclePosition);
336  const SUMOReal angle = l->getShape().rotationAtOffset(l->interpolateLanePosToGeometryPos(vehiclePosition));
337  veh->drawOnPos(s, p, angle);
338  vehiclePosition -= vehLength;
339  }
340  }
341  segmentOffset += length;
342  }
343  glPopMatrix();
344  }
345  vehicleControl->releaseVehicles();
346  }
347 }
348 
349 
350 
351 int
353  int vehNo = 0;
354  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
355  vehNo += segment->getCarNumber();
356  }
357  return (int)vehNo;
358 }
359 
360 
361 std::string
363  std::string result = " ";
364  std::vector<const MEVehicle*> vehs;
365  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
366  std::vector<const MEVehicle*> segmentVehs = segment->getVehicles();
367  vehs.insert(vehs.end(), segmentVehs.begin(), segmentVehs.end());
368  }
369  for (std::vector<const MEVehicle*>::const_iterator it = vehs.begin(); it != vehs.end(); it++) {
370  result += (*it)->getID() + " ";
371  }
372  return result;
373 }
374 
375 
376 SUMOReal
378  SUMOReal flow = 0;
379  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
380  flow += (SUMOReal) segment->getCarNumber() * segment->getMeanSpeed();
381  }
382  return 3600 * flow / (*myLanes)[0]->getLength();
383 }
384 
385 
386 SUMOReal
388  SUMOReal occ = 0;
389  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
390  occ += segment->getBruttoOccupancy();
391  }
392  return occ / (*myLanes)[0]->getLength() / (SUMOReal)(myLanes->size());
393 }
394 
395 
396 SUMOReal
398  return (*myLanes)[0]->getSpeedLimit();
399 }
400 
401 
402 SUMOReal
404  return getMeanSpeed() / getAllowedSpeed();
405 }
406 
407 
408 void
410  const GUIColorer& c = s.edgeColorer;
411  if (!setFunctionalColor(c.getActive()) && !setMultiColor(c)) {
413  }
414 }
415 
416 
417 bool
418 GUIEdge::setFunctionalColor(int activeScheme) const {
419  switch (activeScheme) {
420  case 9: {
421  const PositionVector& shape = getLanes()[0]->getShape();
422  SUMOReal hue = GeomHelper::naviDegree(shape.beginEndAngle()); // [0-360]
424  return true;
425  }
426  default:
427  return false;
428  }
429 }
430 
431 
432 bool
434  const int activeScheme = c.getActive();
435  mySegmentColors.clear();
436  switch (activeScheme) {
437  case 10: // alternating segments
438  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
439  segment != 0; segment = segment->getNextSegment()) {
440  mySegmentColors.push_back(c.getScheme().getColor(segment->getIndex() % 2));
441  }
442  //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";
443  return true;
444  case 11: // by segment jammed state
445  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
446  segment != 0; segment = segment->getNextSegment()) {
447  mySegmentColors.push_back(c.getScheme().getColor(segment->free() ? 0 : 1));
448  }
449  return true;
450  case 12: // by segment occupancy
451  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
452  segment != 0; segment = segment->getNextSegment()) {
453  mySegmentColors.push_back(c.getScheme().getColor(segment->getRelativeOccupancy()));
454  }
455  return true;
456  case 13: // by segment speed
457  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
458  segment != 0; segment = segment->getNextSegment()) {
459  mySegmentColors.push_back(c.getScheme().getColor(segment->getMeanSpeed()));
460  }
461  return true;
462  case 14: // by segment flow
463  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
464  segment != 0; segment = segment->getNextSegment()) {
465  mySegmentColors.push_back(c.getScheme().getColor(3600 * segment->getCarNumber() * segment->getMeanSpeed() / segment->getLength()));
466  }
467  return true;
468  case 15: // by segment relative speed
469  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
470  segment != 0; segment = segment->getNextSegment()) {
471  mySegmentColors.push_back(c.getScheme().getColor(segment->getMeanSpeed() / getAllowedSpeed()));
472  }
473  return true;
474  default:
475  return false;
476  }
477 }
478 
479 
480 SUMOReal
481 GUIEdge::getColorValue(int activeScheme) const {
482  switch (activeScheme) {
483  case 1:
484  return gSelected.isSelected(getType(), getGlID());
485  case 2:
486  return getPurpose();
487  case 3:
488  return getAllowedSpeed();
489  case 4:
490  return getBruttoOccupancy();
491  case 5:
492  return getMeanSpeed();
493  case 6:
494  return getFlow();
495  case 7:
496  return getRelativeSpeed();
497  case 8:
498  return getRoutingSpeed();
499  case 16:
501  }
502  return 0;
503 }
504 
505 
506 SUMOReal
507 GUIEdge::getScaleValue(int activeScheme) const {
508  switch (activeScheme) {
509  case 1:
510  return gSelected.isSelected(getType(), getGlID());
511  case 2:
512  return getAllowedSpeed();
513  case 3:
514  return getBruttoOccupancy();
515  case 4:
516  return getMeanSpeed();
517  case 5:
518  return getFlow();
519  case 6:
520  return getRelativeSpeed();
521  case 7:
523  }
524  return 0;
525 }
526 
527 
528 MESegment*
530  const PositionVector& shape = getLanes()[0]->getShape();
531  const SUMOReal lanePos = shape.nearest_offset_to_point2D(pos);
532  return MSGlobals::gMesoNet->getSegmentForEdge(*this, lanePos);
533 }
534 
535 
536 
537 void
539  const std::vector<MSLane*>& lanes = getLanes();
540  const bool isClosed = lane->isClosed();
541  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
542  GUILane* l = dynamic_cast<GUILane*>(*i);
543  if (l->isClosed() == isClosed) {
544  l->closeTraffic(false);
545  }
546  }
548 }
549 
550 
551 void
553  MSEdgeVector edges;
554  edges.push_back(this);
555  GUITriggeredRerouter* rr = new GUITriggeredRerouter(getID() + "_dynamic_rerouter", edges, 1, "", false,
556  GUINet::getGUIInstance()->getVisualisationSpeedUp());
557 
560  ri.end = SUMOTime_MAX;
562  rr->myIntervals.push_back(ri);
563 
564  // trigger rerouting for vehicles already on this edge
565  const std::vector<MSLane*>& lanes = getLanes();
566  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
567  const MSLane::VehCont& vehicles = (*i)->getVehiclesSecure();
568  for (MSLane::VehCont::const_iterator v = vehicles.begin(); v != vehicles.end(); ++v) {
569  if ((*v)->getLane() == (*i)) {
571  } // else: this is the shadow during a continuous lane change
572  }
573  (*i)->releaseVehicles();
574  }
575 }
576 
577 /****************************************************************************/
578 
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:220
std::set< MSTransportable * > myContainers
Containers on the edge.
Definition: MSEdge.h:797
SUMOReal getFlow() const
returns flow based on headway
Definition: MESegment.cpp:672
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
static int dictSize()
Returns the number of edges.
Definition: MSEdge.cpp:700
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's lanes.
Definition: MSEdge.h:192
SUMOReal getColorValue(int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIEdge.cpp:481
SUMOReal getLengthWithGap() const
Get vehicle'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:1105
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.
SUMOReal minSize
The minimum size to draw this object.
const EdgeBasicFunction myFunction
the purpose of the edge
Definition: MSEdge.h:772
GUIColorer edgeColorer
The mesoscopic edge colorer.
SUMOReal getFlow() const
return flow based on meanSpead
Definition: GUIEdge.cpp:377
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:207
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:254
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: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'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:403
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:251
SUMOReal getLength() const
return the length of the edge
Definition: MSEdge.h:591
~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:433
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:494
void closeTraffic(const GUILane *lane)
close this edge for traffic
Definition: GUIEdge.cpp:538
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
MSEdgeVector mySuccessors
The succeeding edges.
Definition: MSEdge.h:784
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:397
static MSEdge mySpecialDest_keepDestination
special destination values
int getVehicleNo() const
Definition: GUIEdge.cpp:352
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason)
Tries to reroute the vehicle.
const std::vector< MSLane * > * myLanes
Container for the edge's lane; should be sorted: (right-hand-traffic) the more left the lane...
Definition: MSEdge.h:766
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:769
void addRerouter()
add a rerouter
Definition: GUIEdge.cpp:552
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:418
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:409
void drawMesoVehicles(const GUIVisualizationSettings &s) const
Definition: GUIEdge.cpp:303
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:529
SUMOReal length() const
Returns the length.
SUMOReal rotationDegreeAtOffset(SUMOReal pos) const
Returns the rotation at the given length.
Boundary & grow(SUMOReal by)
extends the boundary by the given amount
Definition: Boundary.cpp:232
EdgeBasicFunction getPurpose() const
Returns the edge type (EdgeBasicFunction)
Definition: MSEdge.h:249
SUMOReal getBruttoOccupancy() const
Definition: GUIEdge.cpp:387
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
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:360
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:438
SUMOReal getMeanSpeed() const
get the mean speed
Definition: MSEdge.cpp:629
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'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:295
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIEdge.cpp:230
std::string myStreetName
the real-world name of this edge (need not be unique)
Definition: MSEdge.h:816
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:107
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:287
int getIndex() const
Returns the running index of the segment in the edge (0 is the most upstream).
Definition: MESegment.h:150
std::string getVehicleIDs() const
Definition: GUIEdge.cpp:362
static DictType myDict
Static dictionary to associate string-ids with objects.
Definition: MSEdge.h:851
SUMOReal getRoutingSpeed() const
Returns the averaged speed used by the routing device.
Definition: MSEdge.cpp:666
#define SUMOReal
Definition: config.h:214
GUIVisualizationSizeSettings vehicleSize
Boundary getBoundary() const
Returns the street'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:507
empty max
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:77
Position getPositionInformation() const
Returns the cursor'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:787
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'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: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:289
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
const PositionVector & getShape() const
Definition: GUILane.cpp:807
std::set< MSTransportable * > myPersons
Persons on the edge for drawing and pushbutton.
Definition: MSEdge.h:794