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