Eclipse SUMO - Simulation of Urban MObility
GUIEdge.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
21 // A road/street connecting two junctions (gui-version)
22 /****************************************************************************/
23 #include <config.h>
24 
25 #include <vector>
26 #include <cmath>
27 #include <string>
28 #include <algorithm>
29 #include <fx.h>
33 #include <utils/geom/GeomHelper.h>
35 #include <utils/gui/div/GLHelper.h>
38 #include <microsim/MSBaseVehicle.h>
39 #include <microsim/MSEdge.h>
40 #include <microsim/MSJunction.h>
41 #include <microsim/MSLaneChanger.h>
43 #include <microsim/MSGlobals.h>
48 #include <mesogui/GUIMEVehicle.h>
49 #include <mesosim/MESegment.h>
50 #include <mesosim/MELoop.h>
51 #include <mesosim/MEVehicle.h>
52 
53 #include "GUITriggeredRerouter.h"
54 #include "GUIEdge.h"
55 #include "GUIVehicle.h"
56 #include "GUINet.h"
57 #include "GUILane.h"
58 #include "GUIPerson.h"
59 #include "GUIContainer.h"
60 
61 
62 GUIEdge::GUIEdge(const std::string& id, int numericalID,
63  const SumoXMLEdgeFunc function,
64  const std::string& streetName, const std::string& edgeType, int priority,
65  double distance)
66  : MSEdge(id, numericalID, function, streetName, edgeType, priority, distance),
67  GUIGlObject(GLO_EDGE, id) {}
68 
69 
71  // just to quit cleanly on a failure
72  if (myLock.locked()) {
73  myLock.unlock();
74  }
75 }
76 
77 void
80  bool hasNormalSuccessors = false;
81  for (const MSEdge* out : getSuccessors()) {
82  if (!out->isTazConnector()) {
83  hasNormalSuccessors = true;
84  break;
85  }
86  }
87  myShowDeadEnd = (!isTazConnector() && !hasNormalSuccessors && getToJunction()->getOutgoing().size() > 0
88  && (getPermissions() & ~SVC_PEDESTRIAN) != 0
89  && (getToJunction()->getOutgoing().size() > 1 ||
90  getToJunction()->getOutgoing().front()->getToJunction() != getFromJunction()));
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 (includeInternal || edge->isNormal()) {
108  ret.push_back(edge->getGlID());
109  }
110  }
111  return ret;
112 }
113 
114 
115 double
116 GUIEdge::getTotalLength(bool includeInternal, bool eachLane) {
117  double 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 (includeInternal || !edge->isInternal()) {
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;
132  if (!isTazConnector()) {
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 
159  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
160  buildPopupHeader(ret, app);
167  }
169  GUIDesigns::buildFXMenuCommand(ret, "segment: " + toString(segment->getIndex()), nullptr, nullptr, 0);
170  buildPositionCopyEntry(ret, false);
171  return ret;
172 }
173 
174 
177  GUISUMOAbstractView& parent) {
178  GUIParameterTableWindow* ret = nullptr;
179  ret = new GUIParameterTableWindow(app, *this);
180  // add edge items
181  ret->mkItem("length [m]", false, (*myLanes)[0]->getLength());
182  ret->mkItem("allowed speed [m/s]", false, getAllowedSpeed());
183  ret->mkItem("brutto occupancy [%]", true, new FunctionBinding<GUIEdge, double>(this, &GUIEdge::getBruttoOccupancy, 100.));
184  ret->mkItem("mean vehicle speed [m/s]", true, new FunctionBinding<GUIEdge, double>(this, &GUIEdge::getMeanSpeed));
185  ret->mkItem("flow [veh/h/lane]", true, new FunctionBinding<GUIEdge, double>(this, &GUIEdge::getFlow));
186  ret->mkItem("routing speed [m/s]", true, new FunctionBinding<MSEdge, double>(this, &MSEdge::getRoutingSpeed));
188  // add segment items
190  ret->mkItem("segment index", false, segment->getIndex());
191  ret->mkItem("segment queues", false, segment->numQueues());
192  ret->mkItem("segment length [m]", false, segment->getLength());
193  ret->mkItem("segment allowed speed [m/s]", false, segment->getEdge().getSpeedLimit());
194  ret->mkItem("segment jam threshold [%]", false, segment->getRelativeJamThreshold() * 100);
195  ret->mkItem("segment brutto occupancy [%]", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getRelativeOccupancy, 100));
196  ret->mkItem("segment mean vehicle speed [m/s]", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getMeanSpeed));
197  ret->mkItem("segment flow [veh/h/lane]", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getFlow));
198  ret->mkItem("segment #vehicles", true, new CastingFunctionBinding<MESegment, int, int>(segment, &MESegment::getCarNumber));
199  ret->mkItem("segment leader leave time", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getEventTimeSeconds));
200  ret->mkItem("segment headway [s]", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getLastHeadwaySeconds));
201  ret->mkItem("segment entry blocktime [s]", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getEntryBlockTimeSeconds));
202 
203  // close building
204  ret->closeBuilding();
205  return ret;
206 }
207 
211  GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this);
213  // add items
214  ret->mkItem("Type Information:", false, "");
215  ret->mkItem("type [id]", false, getEdgeType());
216  ret->mkItem("tauff", false, STEPS2TIME(edgeType.tauff));
217  ret->mkItem("taufj", false, STEPS2TIME(edgeType.taufj));
218  ret->mkItem("taujf", false, STEPS2TIME(edgeType.taujf));
219  ret->mkItem("taujj", false, STEPS2TIME(edgeType.taujj));
220  ret->mkItem("jam threshold", false, edgeType.jamThreshold);
221  ret->mkItem("junction control", false, edgeType.junctionControl);
222  ret->mkItem("tls penalty", false, edgeType.tlsPenalty);
223  ret->mkItem("tls flow penalty", false, edgeType.tlsFlowPenalty);
224  ret->mkItem("minor penalty", false, STEPS2TIME(edgeType.minorPenalty));
225  ret->mkItem("overtaking", false, edgeType.overtaking);
226  // close building
227  ret->closeBuilding();
228  return ret;
229 }
230 
231 
232 Boundary
234  Boundary b = getBoundary();
235  // ensure that vehicles and persons on the side are drawn even if the edge
236  // is outside the view
237  b.grow(10);
238  return b;
239 }
240 
241 const std::string
243  return myStreetName;
244 }
245 
246 void
249  return;
250  }
251  glPushName(getGlID());
252  // draw the lanes
254  setColor(s);
255  }
256  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
257  static_cast<GUILane*>(*i)->drawGL(s);
258  }
260  if (s.scale * s.vehicleSize.getExaggeration(s, nullptr) > s.vehicleSize.minSize) {
261  drawMesoVehicles(s);
262  }
263  }
264  glPopName();
265  // (optionally) draw the name and/or the street name
266  const bool drawEdgeName = s.edgeName.show && myFunction == SumoXMLEdgeFunc::NORMAL;
267  const bool drawInternalEdgeName = s.internalEdgeName.show && myFunction == SumoXMLEdgeFunc::INTERNAL;
269  const bool drawStreetName = s.streetName.show && myStreetName != "";
270  const bool drawEdgeValue = s.edgeValue.show && (myFunction == SumoXMLEdgeFunc::NORMAL
273  if (drawEdgeName || drawInternalEdgeName || drawCwaEdgeName || drawStreetName || drawEdgeValue) {
274  GUILane* lane1 = dynamic_cast<GUILane*>((*myLanes)[0]);
275  GUILane* lane2 = dynamic_cast<GUILane*>((*myLanes).back());
276  if (lane1 != nullptr && lane2 != nullptr) {
277  const bool spreadSuperposed = s.spreadSuperposed && getBidiEdge() != nullptr && lane2->drawAsRailway(s);
278  Position p = lane1->getShape().positionAtOffset(lane1->getShape().length() / (double) 2.);
279  p.add(lane2->getShape().positionAtOffset(lane2->getShape().length() / (double) 2.));
280  p.mul(.5);
281  if (spreadSuperposed) {
282  // move name to the right of the edge and towards its beginning
283  const double dist = 0.6 * s.edgeName.scaledSize(s.scale);
284  const double shiftA = lane1->getShape().rotationAtOffset(lane1->getShape().length() / (double) 2.) - DEG2RAD(135);
285  Position shift(dist * cos(shiftA), dist * sin(shiftA));
286  p.add(shift);
287  }
288  double angle = s.getTextAngle(lane1->getShape().rotationDegreeAtOffset(lane1->getShape().length() / (double) 2.) + 90);
289  if (drawEdgeName) {
290  drawName(p, s.scale, s.edgeName, angle);
291  } else if (drawInternalEdgeName) {
292  drawName(p, s.scale, s.internalEdgeName, angle);
293  } else if (drawCwaEdgeName) {
294  drawName(p, s.scale, s.cwaEdgeName, angle);
295  }
296  if (drawStreetName) {
298  }
299  if (drawEdgeValue) {
300  const int activeScheme = s.getLaneEdgeMode();
301  std::string value = "";
302  if (activeScheme == 31) {
303  // edge param, could be non-numerical
304  value = getParameter(s.edgeParam, "");
305  } else if (activeScheme == 32) {
306  // lane param, could be non-numerical
307  value = lane2->getParameter(s.laneParam, "");
308  } else {
309  // use numerical value value of leftmost lane to hopefully avoid sidewalks, bikelanes etc
310  const double doubleValue = (MSGlobals::gUseMesoSim
311  ? getColorValue(s, activeScheme)
312  : lane2->getColorValue(s, activeScheme));
313  const RGBColor color = (MSGlobals::gUseMesoSim ? s.edgeColorer : s.laneColorer).getScheme().getColor(doubleValue);
314  if (doubleValue != s.MISSING_DATA
315  && color.alpha() != 0
316  && (!s.edgeValueHideCheck || doubleValue > s.edgeValueHideThreshold)) {
317  value = toString(doubleValue);
318  }
319  }
320  if (value != "") {
321  GLHelper::drawTextSettings(s.edgeValue, value, p, s.scale, angle);
322  }
323  }
324  }
325  }
326  if (s.scale * s.personSize.getExaggeration(s, nullptr) > s.personSize.minSize) {
327  FXMutexLock locker(myLock);
328  for (std::set<MSTransportable*>::const_iterator i = myPersons.begin(); i != myPersons.end(); ++i) {
329  GUIPerson* person = dynamic_cast<GUIPerson*>(*i);
330  assert(person != 0);
331  person->drawGL(s);
332  }
333  }
334  if (s.scale * s.containerSize.getExaggeration(s, nullptr) > s.containerSize.minSize) {
335  FXMutexLock locker(myLock);
336  for (std::set<MSTransportable*>::const_iterator i = myContainers.begin(); i != myContainers.end(); ++i) {
337  GUIContainer* container = dynamic_cast<GUIContainer*>(*i);
338  assert(container != 0);
339  container->drawGL(s);
340  }
341  }
342 }
343 
344 
345 void
348  if (vehicleControl != nullptr) {
349  // draw the meso vehicles
350  vehicleControl->secureVehicles();
351  FXMutexLock locker(myLock);
352  int laneIndex = 0;
353  for (std::vector<MSLane*>::const_iterator msl = myLanes->begin(); msl != myLanes->end(); ++msl, ++laneIndex) {
354  GUILane* l = static_cast<GUILane*>(*msl);
355  // go through the vehicles
356  double segmentOffset = 0; // offset at start of current segment
357  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
358  segment != nullptr; segment = segment->getNextSegment()) {
359  const double length = segment->getLength();
360  if (laneIndex < segment->numQueues()) {
361  // make a copy so we don't have to worry about synchronization
362  std::vector<MEVehicle*> queue = segment->getQueue(laneIndex);
363  const int queueSize = (int)queue.size();
364  double vehiclePosition = segmentOffset + length;
365  // draw vehicles beginning with the leader at the end of the segment
366  double xOff = 0;
367  for (int i = 0; i < queueSize; ++i) {
368  GUIMEVehicle* veh = static_cast<GUIMEVehicle*>(queue[queueSize - i - 1]);
369  const double vehLength = veh->getVehicleType().getLengthWithGap();
370  while (vehiclePosition < segmentOffset) {
371  // if there is only a single queue for a
372  // multi-lane edge shift vehicles and start
373  // drawing again from the end of the segment
374  vehiclePosition += length;
375  xOff += 2;
376  }
377  const Position p = l->geometryPositionAtOffset(vehiclePosition);
378  const double angle = l->getShape().rotationAtOffset(l->interpolateLanePosToGeometryPos(vehiclePosition));
379  veh->drawOnPos(s, p, angle);
380  vehiclePosition -= vehLength;
381  }
382  }
383  segmentOffset += length;
384  }
385  glPopMatrix();
386  }
387  vehicleControl->releaseVehicles();
388  }
389 }
390 
391 
392 
393 double
395  return (*myLanes)[0]->getSpeedLimit();
396 }
397 
398 
399 double
401  return getMeanSpeed() / getAllowedSpeed();
402 }
403 
404 
405 void
407  myMesoColor = RGBColor(0, 0, 0); // default background color when using multiColor
408  const GUIColorer& c = s.edgeColorer;
409  if (!setFunctionalColor(c) && !setMultiColor(c)) {
411  }
412 }
413 
414 
415 bool
417  const int activeScheme = c.getActive();
418  int activeMicroScheme = -1;
419  switch (activeScheme) {
420  case 0:
421  activeMicroScheme = 0; // color uniform
422  break;
423  case 9:
424  activeMicroScheme = 18; // color by angle
425  break;
426  case 17:
427  activeMicroScheme = 30; // color by TAZ
428  break;
429  default:
430  return false;
431  }
432  GUILane* guiLane = static_cast<GUILane*>(getLanes()[0]);
433  return guiLane->setFunctionalColor(c, myMesoColor, activeMicroScheme);
434 }
435 
436 
437 bool
439  const int activeScheme = c.getActive();
440  mySegmentColors.clear();
441  switch (activeScheme) {
442  case 10: // alternating segments
443  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
444  segment != nullptr; segment = segment->getNextSegment()) {
445  mySegmentColors.push_back(c.getScheme().getColor(segment->getIndex() % 2));
446  }
447  //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";
448  return true;
449  case 11: // by segment jammed state
450  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
451  segment != nullptr; segment = segment->getNextSegment()) {
452  mySegmentColors.push_back(c.getScheme().getColor(segment->getRelativeOccupancy() <= segment->getRelativeJamThreshold() ? 0 : 1));
453  }
454  return true;
455  case 12: // by segment occupancy
456  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
457  segment != nullptr; segment = segment->getNextSegment()) {
458  mySegmentColors.push_back(c.getScheme().getColor(segment->getRelativeOccupancy()));
459  }
460  return true;
461  case 13: // by segment speed
462  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
463  segment != nullptr; segment = segment->getNextSegment()) {
464  mySegmentColors.push_back(c.getScheme().getColor(segment->getMeanSpeed()));
465  }
466  return true;
467  case 14: // by segment flow
468  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
469  segment != nullptr; segment = segment->getNextSegment()) {
470  mySegmentColors.push_back(c.getScheme().getColor(3600 * segment->getCarNumber() * segment->getMeanSpeed() / segment->getLength()));
471  }
472  return true;
473  case 15: // by segment relative speed
474  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
475  segment != nullptr; segment = segment->getNextSegment()) {
476  mySegmentColors.push_back(c.getScheme().getColor(segment->getMeanSpeed() / getAllowedSpeed()));
477  }
478  return true;
479  default:
480  return false;
481  }
482 }
483 
484 
485 double
486 GUIEdge::getColorValue(const GUIVisualizationSettings& /*s*/, int activeScheme) const {
487  switch (activeScheme) {
488  case 1:
489  return gSelected.isSelected(getType(), getGlID());
490  case 2:
491  return (double)getFunction();
492  case 3:
493  return getAllowedSpeed();
494  case 4:
495  return getBruttoOccupancy();
496  case 5:
497  return getMeanSpeed();
498  case 6:
499  return getFlow();
500  case 7:
501  return getRelativeSpeed();
502  case 8:
503  return getRoutingSpeed();
504  case 16:
506  }
507  return 0;
508 }
509 
510 
511 double
512 GUIEdge::getScaleValue(int activeScheme) const {
513  switch (activeScheme) {
514  case 1:
515  return gSelected.isSelected(getType(), getGlID());
516  case 2:
517  return getAllowedSpeed();
518  case 3:
519  return getBruttoOccupancy();
520  case 4:
521  return getMeanSpeed();
522  case 5:
523  return getFlow();
524  case 6:
525  return getRelativeSpeed();
526  case 7:
528  }
529  return 0;
530 }
531 
532 
533 MESegment*
535  const PositionVector& shape = getLanes()[0]->getShape();
536  const double lanePos = shape.nearest_offset_to_point2D(pos);
537  return MSGlobals::gMesoNet->getSegmentForEdge(*this, lanePos);
538 }
539 
540 
541 
542 void
544  const std::vector<MSLane*>& lanes = getLanes();
545  const bool isClosed = lane->isClosed();
546  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
547  GUILane* l = dynamic_cast<GUILane*>(*i);
548  if (l->isClosed() == isClosed) {
549  l->closeTraffic(false);
550  }
551  }
553  for (MSEdge* const pred : getPredecessors()) {
554  pred->rebuildAllowedTargets();
555  }
556 }
557 
558 
559 void
561  MSEdgeVector edges;
562  edges.push_back(this);
563  GUITriggeredRerouter* rr = new GUITriggeredRerouter(getID() + "_dynamic_rerouter", edges, 1, "", false, 0, "",
564  GUINet::getGUIInstance()->getVisualisationSpeedUp());
565 
568  ri.end = SUMOTime_MAX;
570  rr->myIntervals.push_back(ri);
571 
572  // trigger rerouting for vehicles already on this edge
573  const std::vector<MSLane*>& lanes = getLanes();
574  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
575  const MSLane::VehCont& vehicles = (*i)->getVehiclesSecure();
576  for (MSLane::VehCont::const_iterator v = vehicles.begin(); v != vehicles.end(); ++v) {
577  if ((*v)->getLane() == (*i)) {
579  } // else: this is the shadow during a continuous lane change
580  }
581  (*i)->releaseVehicles();
582  }
583 }
584 
585 
586 bool
589 }
590 
591 
592 /****************************************************************************/
@ GLO_EDGE
an edge
GUISelectedStorage gSelected
A global holder of selected objects.
#define DEG2RAD(x)
Definition: GeomHelper.h:35
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:73
#define STEPS2TIME(x)
Definition: SUMOTime.h:53
#define SUMOTime_MAX
Definition: SUMOTime.h:32
@ SVC_PEDESTRIAN
pedestrian
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:44
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:77
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:299
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048, const int align=0)
Definition: GLHelper.cpp:529
void drawOnPos(const GUIVisualizationSettings &s, const Position &pos, const double angle) const
Draws the object on the specified position with the specified angle.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:40
A road/street connecting two junctions (gui-version)
Definition: GUIEdge.h:50
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIEdge.cpp:486
double getAllowedSpeed() const
Definition: GUIEdge.cpp:394
virtual GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIEdge.cpp:176
FXMutex myLock
The mutex used to avoid concurrent updates of myPersons/ myContainers.
Definition: GUIEdge.h:239
bool setMultiColor(const GUIColorer &c) const
sets multiple colors according to the current scheme index and edge function
Definition: GUIEdge.cpp:438
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIEdge.cpp:209
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIEdge.cpp:406
void drawMesoVehicles(const GUIVisualizationSettings &s) const
Definition: GUIEdge.cpp:346
virtual void closeBuilding()
Has to be called after all edges were built and all connections were set.
Definition: GUIEdge.cpp:78
double getScaleValue(int activeScheme) const
gets the scaling value according to the current scheme index
Definition: GUIEdge.cpp:512
MSLane & getLane(int laneNo)
returns the enumerated lane (!!! why not private with a friend?)
Definition: GUIEdge.cpp:94
double getRelativeSpeed() const
return meanSpead divided by allowedSpeed
Definition: GUIEdge.cpp:400
RGBColor myMesoColor
Definition: GUIEdge.h:241
void closeTraffic(const GUILane *lane)
close this edge for traffic
Definition: GUIEdge.cpp:543
MESegment * getSegmentAtPosition(const Position &pos)
returns the segment closest to the given position
Definition: GUIEdge.cpp:534
const std::string getOptionalName() const
Returns the street name.
Definition: GUIEdge.cpp:242
bool isSelected() const
whether this lane is selected in the GUI
Definition: GUIEdge.cpp:587
void addRerouter()
add a rerouter
Definition: GUIEdge.cpp:560
static double getTotalLength(bool includeInternal, bool eachLane)
Definition: GUIEdge.cpp:116
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIEdge.cpp:233
Boundary getBoundary() const
Returns the street's geometry.
Definition: GUIEdge.cpp:130
static std::vector< GUIGlID > getIDs(bool includeInternal)
Definition: GUIEdge.cpp:101
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIEdge.cpp:247
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIEdge.cpp:158
std::vector< RGBColor > mySegmentColors
The color of the segments (cached)
Definition: GUIEdge.h:223
bool setFunctionalColor(const GUIColorer &c) const
sets the color according to the current scheme index and some edge function
Definition: GUIEdge.cpp:416
bool myShowDeadEnd
whether to highlight this edge as a dead-end edge
Definition: GUIEdge.h:226
~GUIEdge()
Destructor.
Definition: GUIEdge.cpp:70
GUIEdge(const std::string &id, int numericalID, const SumoXMLEdgeFunc function, const std::string &streetName, const std::string &edgeType, int priority, double distance)
Constructor.
Definition: GUIEdge.cpp:62
The popup menu of a globject.
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
void buildShowTypeParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the type parameter window.
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
GUIGlID getGlID() const
Returns the numerical id of the object.
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:59
const PositionVector & getShape() const
Definition: GUILane.cpp:919
bool isClosed() const
Definition: GUILane.h:256
void closeTraffic(bool rebuildAllowed=true)
close this lane for traffic
Definition: GUILane.cpp:1318
bool drawAsRailway(const GUIVisualizationSettings &s) const
whether to draw this lane as a railway
Definition: GUILane.cpp:1291
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUILane.cpp:491
bool setFunctionalColor(const GUIColorer &c, RGBColor &col, int activeScheme=-1) const
Definition: GUILane.cpp:992
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
Definition: GUILane.cpp:1069
The class responsible for building and deletion of vehicles (gui-version)
void secureVehicles()
lock access to vehicle removal/additions for thread synchronization
void releaseVehicles()
unlock access to vehicle removal/additions for thread synchronization
A MSVehicle extended by some values for usage within the gui.
Definition: GUIMEVehicle.h:52
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
Definition: GUINet.cpp:526
GUIMEVehicleControl * getGUIMEVehicleControl()
Returns the vehicle control.
Definition: GUINet.cpp:553
A window containing a gl-object's parameter.
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPerson.cpp:273
const T getColor(const double value) const
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
Reroutes vehicles passing an edge One rerouter can be active on multiple edges. To reduce drawing loa...
Stores the information about how to visualize structures.
GUIVisualizationSizeSettings vehicleSize
GUIVisualizationSizeSettings containerSize
GUIVisualizationTextSettings internalEdgeName
GUIColorer edgeColorer
The mesoscopic edge colorer.
bool drawJunctionShape
whether the shape of the junction should be drawn
GUIVisualizationTextSettings edgeValue
GUIVisualizationSizeSettings personSize
GUIVisualizationTextSettings cwaEdgeName
bool hideConnectors
flag to show or hidde connectors
int getLaneEdgeMode() const
Returns the number of the active lane (edge) coloring schme.
double scale
information about a lane's width (temporary, used for a single view)
bool edgeValueHideCheck
value below which edge data value should not be rendered
GUIVisualizationTextSettings streetName
GUIColorer laneColorer
The lane colorer.
GUIVisualizationTextSettings edgeName
bool drawCrossingsAndWalkingareas
whether crosings and walkingareas shall be drawn
bool spreadSuperposed
Whether to improve visualisation of superposed (rail) edges.
std::string edgeParam
key for coloring by edge parameter
double getTextAngle(double objectAngle) const
return an angle that is suitable for reading text aligned with the given angle (degrees)
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
Definition: MELoop.cpp:302
A single mesoscopic segment (cell)
Definition: MESegment.h:47
double getEntryBlockTimeSeconds() const
get the earliest entry time in seconds
Definition: MESegment.h:352
double getLastHeadwaySeconds() const
get the last headway time in seconds
Definition: MESegment.h:347
double getRelativeOccupancy() const
Returns the relative occupany of the segment (percentage of road used))
Definition: MESegment.h:235
double getLength() const
Returns the length of the segment in meters.
Definition: MESegment.h:216
int numQueues() const
return the number of queues
Definition: MESegment.h:185
double getRelativeJamThreshold() const
Returns the relative occupany of the segment (percentage of road used)) at which the segment is consi...
Definition: MESegment.h:243
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
Definition: MESegment.h:325
double getEventTimeSeconds() const
Like getEventTime but returns seconds (for visualization)
Definition: MESegment.h:342
int getIndex() const
Returns the running index of the segment in the edge (0 is the most upstream).
Definition: MESegment.h:200
double getMeanSpeed() const
wrapper to satisfy the FunctionBinding signature
Definition: MESegment.h:260
int getCarNumber() const
Returns the total number of cars on the segment.
Definition: MESegment.h:180
double getFlow() const
returns flow based on headway
Definition: MESegment.cpp:764
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
A road/street connecting two junctions.
Definition: MSEdge.h:77
std::string myStreetName
the real-world name of this edge (need not be unique)
Definition: MSEdge.h:901
double getBruttoOccupancy() const
Definition: MSEdge.cpp:1274
double getFlow() const
return flow based on meanSpead
Definition: MSEdge.cpp:1264
SVCPermissions getPermissions() const
Returns the combined permissions of all lanes of this edge.
Definition: MSEdge.h:594
const MSEdgeVector & getPredecessors() const
Definition: MSEdge.h:383
const std::string & getStreetName() const
Returns the street name of the edge.
Definition: MSEdge.h:301
bool isNormal() const
return whether this edge is an internal edge
Definition: MSEdge.h:251
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:166
const SumoXMLEdgeFunc myFunction
the purpose of the edge
Definition: MSEdge.h:848
std::set< MSTransportable * > myContainers
Containers on the edge.
Definition: MSEdge.h:880
double getSpeedLimit() const
Returns the speed limit of the edge @caution The speed limit of the first lane is retured; should pro...
Definition: MSEdge.cpp:919
const MSJunction * getFromJunction() const
Definition: MSEdge.h:388
MSEdgeVector myPredecessors
The preceeding edges.
Definition: MSEdge.h:870
void rebuildAllowedLanes()
Definition: MSEdge.cpp:250
double getLength() const
return the length of the edge
Definition: MSEdge.h:630
virtual void closeBuilding()
Definition: MSEdge.cpp:147
double getMeanSpeed() const
get the mean speed
Definition: MSEdge.cpp:743
static DictType myDict
Static dictionary to associate string-ids with objects.
Definition: MSEdge.h:945
bool isTazConnector() const
Definition: MSEdge.h:279
MSEdgeVector mySuccessors
The succeeding edges.
Definition: MSEdge.h:865
std::set< MSTransportable * > myPersons
Persons on the edge for drawing and pushbutton.
Definition: MSEdge.h:877
bool isInternal() const
return whether this edge is an internal edge
Definition: MSEdge.h:256
int getVehicleNumber() const
return total number of vehicles on this edges lanes or segments
Definition: MSEdge.cpp:1223
const std::string & getEdgeType() const
Returns the type of the edge.
Definition: MSEdge.h:307
const MSJunction * getToJunction() const
Definition: MSEdge.h:392
SumoXMLEdgeFunc getFunction() const
Returns the edge type (SumoXMLEdgeFunc)
Definition: MSEdge.h:246
double getRoutingSpeed() const
Returns the averaged speed used by the routing device.
Definition: MSEdge.cpp:808
const MSEdge * getBidiEdge() const
return opposite superposable/congruent edge, if it exist and 0 else
Definition: MSEdge.h:270
const MSEdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges, restricted by vClass.
Definition: MSEdge.cpp:1013
std::shared_ptr< 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:842
static bool gUseMesoSim
Definition: MSGlobals.h:88
static MELoop * gMesoNet
mesoscopic simulation infrastructure
Definition: MSGlobals.h:94
int getPendingEmits(const MSLane *lane)
return the number of pending emits for the given lane
const ConstMSEdgeVector & getOutgoing() const
Definition: MSJunction.h:111
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
std::vector< MSVehicle * > VehCont
Container for vehicles.
Definition: MSLane.h:92
double getLength() const
Returns the lane's length.
Definition: MSLane.h:539
double interpolateLanePosToGeometryPos(double lanePos) const
Definition: MSLane.h:497
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
Definition: MSLane.h:503
@ NOTIFICATION_JUNCTION
The vehicle arrived at a junction.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:171
const MesoEdgeType & getMesoType(const std::string &typeID)
Returns edge type specific meso parameters if no type specific parameters have been loaded,...
Definition: MSNet.cpp:347
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:313
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:424
bool notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Tries to reroute the vehicle.
static MSEdge mySpecialDest_keepDestination
special destination values
std::vector< RerouteInterval > myIntervals
List of rerouting definition intervals.
double getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
const std::string & getID() const
Returns the id.
Definition: Named.h:73
const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
void add(const Position &pos)
Adds the given position to this one.
Definition: Position.h:124
void mul(double val)
Multiplies both positions with the given value.
Definition: Position.h:104
A list of positions.
double length() const
Returns the length.
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
unsigned char alpha() const
Returns the alpha-amount of the color.
Definition: RGBColor.h:73
bool add(T val, double prob, bool checkDuplicates=true)
Adds a value with an assigned probability to the distribution.
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
double minSize
The minimum size to draw this object.
double scaledSize(double scale, double constFactor=0.1) const
get scale size
edge type specific meso parameters
Definition: MSNet.h:117
bool junctionControl
Definition: MSNet.h:123
double jamThreshold
Definition: MSNet.h:122
SUMOTime taufj
Definition: MSNet.h:119
SUMOTime tauff
Definition: MSNet.h:118
SUMOTime taujj
Definition: MSNet.h:121
double tlsPenalty
Definition: MSNet.h:124
SUMOTime minorPenalty
Definition: MSNet.h:126
double tlsFlowPenalty
Definition: MSNet.h:125
SUMOTime taujf
Definition: MSNet.h:120
SUMOTime begin
The begin time these definitions are valid.
SUMOTime end
The end time these definitions are valid.
RandomDistributor< MSEdge * > edgeProbs
The distributions of new destinations to use.