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 
71 // ===========================================================================
72 // included modules
73 // ===========================================================================
74 GUIEdge::GUIEdge(const std::string& id, int numericalID,
75  const SumoXMLEdgeFunc function,
76  const std::string& streetName, const std::string& edgeType, int priority)
77  : MSEdge(id, numericalID, function, streetName, edgeType, priority),
78  GUIGlObject(GLO_EDGE, id) {}
79 
80 
82  // just to quit cleanly on a failure
83  if (myLock.locked()) {
84  myLock.unlock();
85  }
86 }
87 
88 
89 MSLane&
90 GUIEdge::getLane(int laneNo) {
91  assert(laneNo < (int)myLanes->size());
92  return *((*myLanes)[laneNo]);
93 }
94 
95 
96 std::vector<GUIGlID>
97 GUIEdge::getIDs(bool includeInternal) {
98  std::vector<GUIGlID> ret;
99  ret.reserve(MSEdge::myDict.size());
100  for (MSEdge::DictType::const_iterator i = MSEdge::myDict.begin(); i != MSEdge::myDict.end(); ++i) {
101  const GUIEdge* edge = dynamic_cast<const GUIEdge*>(i->second);
102  assert(edge);
103  if (includeInternal || !edge->isInternal()) {
104  ret.push_back(edge->getGlID());
105  }
106  }
107  return ret;
108 }
109 
110 
111 double
112 GUIEdge::getTotalLength(bool includeInternal, bool eachLane) {
113  double result = 0;
114  for (MSEdge::DictType::const_iterator i = MSEdge::myDict.begin(); i != MSEdge::myDict.end(); ++i) {
115  const MSEdge* edge = i->second;
116  if (includeInternal || !edge->isInternal()) {
117  // @note needs to be change once lanes may have different length
118  result += edge->getLength() * (eachLane ? edge->getLanes().size() : 1);
119  }
120  }
121  return result;
122 }
123 
124 
125 Boundary
127  Boundary ret;
128  if (!isTazConnector()) {
129  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
130  ret.add((*i)->getShape().getBoxBoundary());
131  }
132  } else {
133  // take the starting coordinates of all follower edges and the endpoints
134  // of all successor edges
135  for (MSEdgeVector::const_iterator it = mySuccessors.begin(); it != mySuccessors.end(); ++it) {
136  const std::vector<MSLane*>& lanes = (*it)->getLanes();
137  for (std::vector<MSLane*>::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); ++it_lane) {
138  ret.add((*it_lane)->getShape().front());
139  }
140  }
141  for (MSEdgeVector::const_iterator it = myPredecessors.begin(); it != myPredecessors.end(); ++it) {
142  const std::vector<MSLane*>& lanes = (*it)->getLanes();
143  for (std::vector<MSLane*>::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); ++it_lane) {
144  ret.add((*it_lane)->getShape().back());
145  }
146  }
147  }
148  ret.grow(10);
149  return ret;
150 }
151 
152 
155  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
156  buildPopupHeader(ret, app);
162  }
163  const double pos = getLanes()[0]->getShape().nearest_offset_to_point2D(parent.getPositionInformation());
164  new FXMenuCommand(ret, ("pos: " + toString(pos)).c_str(), 0, 0, 0);
165  buildPositionCopyEntry(ret, false);
166  return ret;
167 }
168 
169 
172  GUISUMOAbstractView& parent) {
173  GUIParameterTableWindow* ret = 0;
174  ret = new GUIParameterTableWindow(app, *this, 18);
175  // add edge items
176  ret->mkItem("length [m]", false, (*myLanes)[0]->getLength());
177  ret->mkItem("allowed speed [m/s]", false, getAllowedSpeed());
178  ret->mkItem("brutto occupancy [%]", true, new FunctionBinding<GUIEdge, double>(this, &GUIEdge::getBruttoOccupancy, 100.));
179  ret->mkItem("mean vehicle speed [m/s]", true, new FunctionBinding<GUIEdge, double>(this, &GUIEdge::getMeanSpeed));
180  ret->mkItem("flow [veh/h/lane]", true, new FunctionBinding<GUIEdge, double>(this, &GUIEdge::getFlow));
181  ret->mkItem("routing speed [m/s]", true, new FunctionBinding<MSEdge, double>(this, &MSEdge::getRoutingSpeed));
183  ret->mkItem("vehicle ids", false, getVehicleIDs());
184  // add segment items
186  ret->mkItem("segment index", false, segment->getIndex());
187  ret->mkItem("segment queues", false, segment->numQueues());
188  ret->mkItem("segment length [m]", false, segment->getLength());
189  ret->mkItem("segment allowed speed [m/s]", false, segment->getEdge().getSpeedLimit());
190  ret->mkItem("segment jam threshold [%]", false, segment->getRelativeJamThreshold() * 100);
191  ret->mkItem("segment brutto occupancy [%]", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getRelativeOccupancy, 100));
192  ret->mkItem("segment mean vehicle speed [m/s]", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getMeanSpeed));
193  ret->mkItem("segment flow [veh/h/lane]", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getFlow));
194  ret->mkItem("segment #vehicles", true, new CastingFunctionBinding<MESegment, double, int>(segment, &MESegment::getCarNumber));
195  ret->mkItem("segment leader leave time", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getEventTimeSeconds));
196  ret->mkItem("segment headway [s]", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getLastHeadwaySeconds));
197 
198  // close building
199  ret->closeBuilding();
200  return ret;
201 }
202 
203 
204 Boundary
206  Boundary b = getBoundary();
207  // ensure that vehicles and persons on the side are drawn even if the edge
208  // is outside the view
209  b.grow(10);
210  return b;
211 }
212 
213 
214 void
217  return;
218  }
219  glPushName(getGlID());
220  // draw the lanes
221  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
223  setColor(s);
224  }
225  GUILane* l = dynamic_cast<GUILane*>(*i);
226  if (l != 0) {
227  l->drawGL(s);
228  }
229  }
232  drawMesoVehicles(s);
233  }
234  }
235  glPopName();
236  // (optionally) draw the name and/or the street name
237  const bool drawEdgeName = s.edgeName.show && myFunction == EDGEFUNC_NORMAL;
238  const bool drawInternalEdgeName = s.internalEdgeName.show && myFunction == EDGEFUNC_INTERNAL;
239  const bool drawCwaEdgeName = s.cwaEdgeName.show && (myFunction == EDGEFUNC_CROSSING || myFunction == EDGEFUNC_WALKINGAREA);
240  const bool drawStreetName = s.streetName.show && myStreetName != "";
241  if (drawEdgeName || drawInternalEdgeName || drawCwaEdgeName || drawStreetName) {
242  GUILane* lane1 = dynamic_cast<GUILane*>((*myLanes)[0]);
243  GUILane* lane2 = dynamic_cast<GUILane*>((*myLanes).back());
244  if (lane1 != 0 && lane2 != 0) {
245  Position p = lane1->getShape().positionAtOffset(lane1->getShape().length() / (double) 2.);
246  p.add(lane2->getShape().positionAtOffset(lane2->getShape().length() / (double) 2.));
247  p.mul(.5);
248  double angle = lane1->getShape().rotationDegreeAtOffset(lane1->getShape().length() / (double) 2.);
249  angle += 90;
250  if (angle > 90 && angle < 270) {
251  angle -= 180;
252  }
253  if (drawEdgeName) {
254  drawName(p, s.scale, s.edgeName, angle);
255  } else if (drawInternalEdgeName) {
256  drawName(p, s.scale, s.internalEdgeName, angle);
257  } else if (drawCwaEdgeName) {
258  drawName(p, s.scale, s.cwaEdgeName, angle);
259  }
260  if (drawStreetName) {
262  s.streetName.size / s.scale, s.streetName.color, angle);
263  }
264  }
265  }
267  myLock.lock();
268  for (std::set<MSTransportable*>::const_iterator i = myPersons.begin(); i != myPersons.end(); ++i) {
269  GUIPerson* person = dynamic_cast<GUIPerson*>(*i);
270  assert(person != 0);
271  person->drawGL(s);
272  }
273  myLock.unlock();
274  }
276  myLock.lock();
277  for (std::set<MSTransportable*>::const_iterator i = myContainers.begin(); i != myContainers.end(); ++i) {
278  GUIContainer* container = dynamic_cast<GUIContainer*>(*i);
279  assert(container != 0);
280  container->drawGL(s);
281  }
282  myLock.unlock();
283  }
284 }
285 
286 
287 void
290  if (vehicleControl != 0) {
291  // draw the meso vehicles
292  vehicleControl->secureVehicles();
294  int laneIndex = 0;
295  MESegment::Queue queue;
296  for (std::vector<MSLane*>::const_iterator msl = myLanes->begin(); msl != myLanes->end(); ++msl, ++laneIndex) {
297  GUILane* l = static_cast<GUILane*>(*msl);
298  // go through the vehicles
299  double segmentOffset = 0; // offset at start of current segment
300  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
301  segment != 0; segment = segment->getNextSegment()) {
302  const double length = segment->getLength();
303  if (laneIndex < segment->numQueues()) {
304  // make a copy so we don't have to worry about synchronization
305  queue = segment->getQueue(laneIndex);
306  const int queueSize = (int)queue.size();
307  double vehiclePosition = segmentOffset + length;
308  // draw vehicles beginning with the leader at the end of the segment
309  double xOff = 0;
310  for (int i = 0; i < queueSize; ++i) {
311  GUIMEVehicle* veh = static_cast<GUIMEVehicle*>(queue[queueSize - i - 1]);
312  const double vehLength = veh->getVehicleType().getLengthWithGap();
313  while (vehiclePosition < segmentOffset) {
314  // if there is only a single queue for a
315  // multi-lane edge shift vehicles and start
316  // drawing again from the end of the segment
317  vehiclePosition += length;
318  xOff += 2;
319  }
320  const Position p = l->geometryPositionAtOffset(vehiclePosition);
321  const double angle = l->getShape().rotationAtOffset(l->interpolateLanePosToGeometryPos(vehiclePosition));
322  veh->drawOnPos(s, p, angle);
323  vehiclePosition -= vehLength;
324  }
325  }
326  segmentOffset += length;
327  }
328  glPopMatrix();
329  }
330  vehicleControl->releaseVehicles();
331  }
332 }
333 
334 
335 
336 int
338  int vehNo = 0;
339  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
340  vehNo += segment->getCarNumber();
341  }
342  return (int)vehNo;
343 }
344 
345 
346 std::string
348  std::string result = " ";
349  std::vector<const MEVehicle*> vehs;
350  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
351  std::vector<const MEVehicle*> segmentVehs = segment->getVehicles();
352  vehs.insert(vehs.end(), segmentVehs.begin(), segmentVehs.end());
353  }
354  for (std::vector<const MEVehicle*>::const_iterator it = vehs.begin(); it != vehs.end(); it++) {
355  result += (*it)->getID() + " ";
356  }
357  return result;
358 }
359 
360 
361 double
363  double flow = 0;
364  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
365  flow += (double) segment->getCarNumber() * segment->getMeanSpeed();
366  }
367  return 3600 * flow / (*myLanes)[0]->getLength();
368 }
369 
370 
371 double
373  double occ = 0;
374  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
375  occ += segment->getBruttoOccupancy();
376  }
377  return occ / (*myLanes)[0]->getLength() / (double)(myLanes->size());
378 }
379 
380 
381 double
383  return (*myLanes)[0]->getSpeedLimit();
384 }
385 
386 
387 double
389  return getMeanSpeed() / getAllowedSpeed();
390 }
391 
392 
393 void
395  myMesoColor = RGBColor(0, 0, 0); // default background color when using multiColor
396  const GUIColorer& c = s.edgeColorer;
397  if (!setFunctionalColor(c.getActive()) && !setMultiColor(c)) {
399  }
400 }
401 
402 
403 bool
404 GUIEdge::setFunctionalColor(int activeScheme) const {
405  switch (activeScheme) {
406  case 9: {
407  const PositionVector& shape = getLanes()[0]->getShape();
408  double hue = GeomHelper::naviDegree(shape.beginEndAngle()); // [0-360]
409  myMesoColor = RGBColor::fromHSV(hue, 1., 1.);
410  return true;
411  }
412  default:
413  return false;
414  }
415 }
416 
417 
418 bool
420  const int activeScheme = c.getActive();
421  mySegmentColors.clear();
422  switch (activeScheme) {
423  case 10: // alternating segments
424  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
425  segment != 0; segment = segment->getNextSegment()) {
426  mySegmentColors.push_back(c.getScheme().getColor(segment->getIndex() % 2));
427  }
428  //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";
429  return true;
430  case 11: // by segment jammed state
431  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
432  segment != 0; segment = segment->getNextSegment()) {
433  mySegmentColors.push_back(c.getScheme().getColor(segment->free() ? 0 : 1));
434  }
435  return true;
436  case 12: // by segment occupancy
437  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
438  segment != 0; segment = segment->getNextSegment()) {
439  mySegmentColors.push_back(c.getScheme().getColor(segment->getRelativeOccupancy()));
440  }
441  return true;
442  case 13: // by segment speed
443  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
444  segment != 0; segment = segment->getNextSegment()) {
445  mySegmentColors.push_back(c.getScheme().getColor(segment->getMeanSpeed()));
446  }
447  return true;
448  case 14: // by segment flow
449  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
450  segment != 0; segment = segment->getNextSegment()) {
451  mySegmentColors.push_back(c.getScheme().getColor(3600 * segment->getCarNumber() * segment->getMeanSpeed() / segment->getLength()));
452  }
453  return true;
454  case 15: // by segment relative speed
455  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
456  segment != 0; segment = segment->getNextSegment()) {
457  mySegmentColors.push_back(c.getScheme().getColor(segment->getMeanSpeed() / getAllowedSpeed()));
458  }
459  return true;
460  default:
461  return false;
462  }
463 }
464 
465 
466 double
467 GUIEdge::getColorValue(int activeScheme) const {
468  switch (activeScheme) {
469  case 1:
470  return gSelected.isSelected(getType(), getGlID());
471  case 2:
472  return getFunction();
473  case 3:
474  return getAllowedSpeed();
475  case 4:
476  return getBruttoOccupancy();
477  case 5:
478  return getMeanSpeed();
479  case 6:
480  return getFlow();
481  case 7:
482  return getRelativeSpeed();
483  case 8:
484  return getRoutingSpeed();
485  case 16:
487  }
488  return 0;
489 }
490 
491 
492 double
493 GUIEdge::getScaleValue(int activeScheme) const {
494  switch (activeScheme) {
495  case 1:
496  return gSelected.isSelected(getType(), getGlID());
497  case 2:
498  return getAllowedSpeed();
499  case 3:
500  return getBruttoOccupancy();
501  case 4:
502  return getMeanSpeed();
503  case 5:
504  return getFlow();
505  case 6:
506  return getRelativeSpeed();
507  case 7:
509  }
510  return 0;
511 }
512 
513 
514 MESegment*
516  const PositionVector& shape = getLanes()[0]->getShape();
517  const double lanePos = shape.nearest_offset_to_point2D(pos);
518  return MSGlobals::gMesoNet->getSegmentForEdge(*this, lanePos);
519 }
520 
521 
522 
523 void
525  const std::vector<MSLane*>& lanes = getLanes();
526  const bool isClosed = lane->isClosed();
527  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
528  GUILane* l = dynamic_cast<GUILane*>(*i);
529  if (l->isClosed() == isClosed) {
530  l->closeTraffic(false);
531  }
532  }
534 }
535 
536 
537 void
539  MSEdgeVector edges;
540  edges.push_back(this);
541  GUITriggeredRerouter* rr = new GUITriggeredRerouter(getID() + "_dynamic_rerouter", edges, 1, "", false,
542  GUINet::getGUIInstance()->getVisualisationSpeedUp());
543 
546  ri.end = SUMOTime_MAX;
548  rr->myIntervals.push_back(ri);
549 
550  // trigger rerouting for vehicles already on this edge
551  const std::vector<MSLane*>& lanes = getLanes();
552  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
553  const MSLane::VehCont& vehicles = (*i)->getVehiclesSecure();
554  for (MSLane::VehCont::const_iterator v = vehicles.begin(); v != vehicles.end(); ++v) {
555  if ((*v)->getLane() == (*i)) {
557  } // else: this is the shadow during a continuous lane change
558  }
559  (*i)->releaseVehicles();
560  }
561 }
562 
563 /****************************************************************************/
564 
const SumoXMLEdgeFunc myFunction
the purpose of the edge
Definition: MSEdge.h:765
RGBColor myMesoColor
Definition: GUIEdge.h:235
double getLength() const
return the length of the edge
Definition: MSEdge.h:570
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIEdge.cpp:205
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
std::set< MSTransportable * > myContainers
Containers on the edge.
Definition: MSEdge.h:795
double getRelativeSpeed() const
return meanSpead divided by allowedSpeed
Definition: GUIEdge.cpp:388
double scale
information about a lane&#39;s width (temporary, used for a single view)
std::vector< MEVehicle * > Queue
Definition: MESegment.h:86
GUIVisualizationTextSettings streetName
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
Reroutes vehicles passing an edge One rerouter can be active on multiple edges. To reduce drawing loa...
void drawOnPos(const GUIVisualizationSettings &s, const Position &pos, const double angle) const
Draws the object on the specified position with the specified angle.
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
Definition: MELoop.cpp:290
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
bool isClosed() const
Definition: GUILane.h:257
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIEdge.cpp:154
const std::vector< MSLane * > & getLanes() const
Returns this edge&#39;s lanes.
Definition: MSEdge.h:168
bool isTazConnector() const
Definition: MSEdge.h:253
static RGBColor fromHSV(double h, double s, double v)
Converts the given hsv-triplet to rgb.
Definition: RGBColor.cpp:302
double getEventTimeSeconds() const
Like getEventTime but returns seconds (for visualization)
Definition: MESegment.h:288
void releaseVehicles()
unlock access to vehicle removal/additions for thread synchronization
double getAllowedSpeed() const
Definition: GUIEdge.cpp:382
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
void closeTraffic(bool rebuildAllowed=true)
close this lane for traffic
Definition: GUILane.cpp:1128
RandomDistributor< MSEdge * > edgeProbs
The distributions of new destinations to use.
The vehicle arrived at a junction.
void secureVehicles()
lock access to vehicle removal/additions for thread synchronization
std::vector< RGBColor > mySegmentColors
The color of the segments (cached)
Definition: GUIEdge.h:219
Stores the information about how to visualize structures.
GUIColorer edgeColorer
The mesoscopic edge colorer.
double getSpeedLimit() const
Returns the speed limit of the edge The speed limit of the first lane is retured; should probably be...
Definition: MSEdge.cpp:847
double getBruttoOccupancy() const
Definition: GUIEdge.cpp:372
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUILane.cpp:432
double interpolateLanePosToGeometryPos(double lanePos) const
Definition: MSLane.h:442
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
Definition: MSLane.h:448
const std::string & getStreetName() const
Returns the street name of the edge.
Definition: MSEdge.h:267
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:531
The class responsible for building and deletion of vehicles (gui-version)
double getLength() const
Returns the lane&#39;s length.
Definition: MSLane.h:484
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:169
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
GUIVisualizationTextSettings cwaEdgeName
double getRoutingSpeed() const
Returns the averaged speed used by the routing device.
Definition: MSEdge.cpp:738
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
double getScaleValue(int activeScheme) const
gets the scaling value according to the current scheme index
Definition: GUIEdge.cpp:493
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:252
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
SumoXMLEdgeFunc getFunction() const
Returns the edge type (SumoXMLEdgeFunc)
Definition: MSEdge.h:225
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:90
double getLengthWithGap() const
Get vehicle&#39;s length including the minimum gap [m].
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:81
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
static double naviDegree(const double angle)
Definition: GeomHelper.cpp:187
void rebuildAllowedLanes()
Definition: MSEdge.cpp:247
~GUIEdge()
Destructor.
Definition: GUIEdge.cpp:81
bool setMultiColor(const GUIColorer &c) const
sets multiple colors according to the current scheme index and edge function
Definition: GUIEdge.cpp:419
double getExaggeration(const GUIVisualizationSettings &s, double factor=20) const
return the drawing size including exaggeration and constantSize values
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:56
double minSize
The minimum size to draw this object.
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
Definition: GUINet.cpp:504
void closeTraffic(const GUILane *lane)
close this edge for traffic
Definition: GUIEdge.cpp:524
GUIVisualizationTextSettings internalEdgeName
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
#define SUMOTime_MAX
Definition: TraCIDefs.h:53
A list of positions.
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
SUMOTime begin
The begin time these definitions are valid.
MSEdgeVector mySuccessors
The succeeding edges.
Definition: MSEdge.h:782
double getFlow() const
returns flow based on headway
Definition: MESegment.cpp:693
virtual GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIEdge.cpp:171
double getLength() const
Returns the length of the segment in meters.
Definition: MESegment.h:165
const T getColor(const double value) const
double length() const
Returns the length.
double getRelativeJamThreshold() const
Returns the relative occupany of the segment (percentage of road used)) at which the segment is consi...
Definition: MESegment.h:189
static MSEdge mySpecialDest_keepDestination
special destination values
double getMeanSpeed() const
wrapper to satisfy the FunctionBinding signature
Definition: MESegment.h:206
int getVehicleNo() const
Definition: GUIEdge.cpp:337
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:302
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:759
bool isInternal() const
return whether this edge is an internal edge
Definition: MSEdge.h:230
void addRerouter()
add a rerouter
Definition: GUIEdge.cpp:538
std::vector< MSVehicle * > VehCont
Container for vehicles.
Definition: MSLane.h:91
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Tries to reroute the vehicle.
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some edge function
Definition: GUIEdge.cpp:404
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPerson.cpp:259
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIEdge.cpp:394
void drawMesoVehicles(const GUIVisualizationSettings &s) const
Definition: GUIEdge.cpp:288
double getLastHeadwaySeconds() const
get the last headway time in seconds
Definition: MESegment.h:293
void unlock()
release mutex lock
Definition: MFXMutex.cpp:94
static std::vector< GUIGlID > getIDs(bool includeInternal)
Definition: GUIEdge.cpp:97
MESegment * getSegmentAtPosition(const Position &pos)
returns the segment closest to the given position
Definition: GUIEdge.cpp:515
int numQueues() const
return the number of queues
Definition: MESegment.h:134
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
SUMOTime end
The end time these definitions are valid.
double getColorValue(int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIEdge.cpp:467
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
A MSVehicle extended by some values for usage within the gui.
Definition: GUIMEVehicle.h:61
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:358
GUIVisualizationSizeSettings containerSize
MFXMutex myLock
The mutex used to avoid concurrent updates of myPersons/ myContainers.
Definition: GUIEdge.h:233
A mutex encapsulator which locks/unlocks the given mutex on construction/destruction, respectively.
Definition: AbstractMutex.h:71
A single mesoscopic segment (cell)
Definition: MESegment.h:57
double getFlow() const
return flow based on meanSpead
Definition: GUIEdge.cpp:362
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.
double getRelativeOccupancy() const
Returns the relative occupany of the segment (percentage of road used))
Definition: MESegment.h:181
an edge
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIEdge.cpp:215
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
std::string myStreetName
the real-world name of this edge (need not be unique)
Definition: MSEdge.h:814
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:113
GUIVisualizationSizeSettings personSize
void lock()
lock mutex
Definition: MFXMutex.cpp:84
int getCarNumber() const
Returns the total number of cars on the segment.
Definition: MESegment.cpp:303
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:347
static DictType myDict
Static dictionary to associate string-ids with objects.
Definition: MSEdge.h:852
GUIEdge(const std::string &id, int numericalID, const SumoXMLEdgeFunc function, const std::string &streetName, const std::string &edgeType, int priority)
Constructor.
Definition: GUIEdge.cpp:74
GUIVisualizationSizeSettings vehicleSize
Boundary getBoundary() const
Returns the street&#39;s geometry.
Definition: GUIEdge.cpp:126
FXbool locked()
Definition: MFXMutex.h:70
empty max
void mul(double val)
Multiplies both positions with the given value.
Definition: Position.h:113
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:78
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0)
draw Text with given parameters
Definition: GLHelper.cpp:455
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:86
Position getPositionInformation() const
Returns the cursor&#39;s x/y position within the network.
double getMeanSpeed() const
get the mean speed
Definition: MSEdge.cpp:701
static double getTotalLength(bool includeInternal, bool eachLane)
Definition: GUIEdge.cpp:112
bool add(T val, double prob, bool checkDuplicates=true)
Adds a value with an assigned probability to the distribution.
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:785
GUISelectedStorage gSelected
A global holder of selected objects.
static bool gUseMesoSim
Definition: MSGlobals.h:98
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
A window containing a gl-object&#39;s parameter.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
int getPendingEmits(const MSLane *lane)
return the number of pending emits for the given lane
double beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position ...
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
const PositionVector & getShape() const
Definition: GUILane.cpp:823
std::set< MSTransportable * > myPersons
Persons on the edge for drawing and pushbutton.
Definition: MSEdge.h:792