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