SUMO - Simulation of Urban MObility
GUIEdge.cpp
Go to the documentation of this file.
1 /****************************************************************************/
10 // A road/street connecting two junctions (gui-version)
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <vector>
35 #include <cmath>
36 #include <string>
37 #include <algorithm>
42 #include <utils/geom/GeomHelper.h>
45 #include <utils/gui/div/GLHelper.h>
48 #include <microsim/MSBaseVehicle.h>
49 #include <microsim/MSEdge.h>
50 #include <microsim/MSJunction.h>
51 #include <microsim/MSLaneChanger.h>
53 #include <microsim/MSGlobals.h>
56 #include "GUITriggeredRerouter.h"
57 #include "GUIEdge.h"
58 #include "GUIVehicle.h"
59 #include "GUINet.h"
60 #include "GUILane.h"
61 #include "GUIPerson.h"
62 #include "GUIContainer.h"
63 
65 #include <mesogui/GUIMEVehicle.h>
66 #include <mesosim/MESegment.h>
67 #include <mesosim/MELoop.h>
68 #include <mesosim/MEVehicle.h>
69 
70 
71 // ===========================================================================
72 // included modules
73 // ===========================================================================
74 GUIEdge::GUIEdge(const std::string& id, int numericalID,
75  const EdgeBasicFunction function,
76  const std::string& streetName, const std::string& edgeType, int priority)
77  : MSEdge(id, numericalID, function, streetName, edgeType, priority),
78  GUIGlObject(GLO_EDGE, id) {}
79 
80 
82  // just to quit cleanly on a failure
83  if (myLock.locked()) {
84  myLock.unlock();
85  }
86 }
87 
88 
89 MSLane&
90 GUIEdge::getLane(int laneNo) {
91  assert(laneNo < (int)myLanes->size());
92  return *((*myLanes)[laneNo]);
93 }
94 
95 
96 std::vector<GUIGlID>
97 GUIEdge::getIDs(bool includeInternal) {
98  std::vector<GUIGlID> ret;
99  ret.reserve(MSEdge::myDict.size());
100  for (MSEdge::DictType::const_iterator i = MSEdge::myDict.begin(); i != MSEdge::myDict.end(); ++i) {
101  const GUIEdge* edge = dynamic_cast<const GUIEdge*>(i->second);
102  assert(edge);
103  if (edge->getPurpose() != EDGEFUNCTION_INTERNAL || includeInternal) {
104  ret.push_back(edge->getGlID());
105  }
106  }
107  return ret;
108 }
109 
110 
111 double
112 GUIEdge::getTotalLength(bool includeInternal, bool eachLane) {
113  double result = 0;
114  for (MSEdge::DictType::const_iterator i = MSEdge::myDict.begin(); i != MSEdge::myDict.end(); ++i) {
115  const MSEdge* edge = i->second;
116  if (edge->getPurpose() != EDGEFUNCTION_INTERNAL || includeInternal) {
117  // @note needs to be change once lanes may have different length
118  result += edge->getLength() * (eachLane ? edge->getLanes().size() : 1);
119  }
120  }
121  return result;
122 }
123 
124 
125 Boundary
127  Boundary ret;
129  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
130  ret.add((*i)->getShape().getBoxBoundary());
131  }
132  } else {
133  // take the starting coordinates of all follower edges and the endpoints
134  // of all successor edges
135  for (MSEdgeVector::const_iterator it = mySuccessors.begin(); it != mySuccessors.end(); ++it) {
136  const std::vector<MSLane*>& lanes = (*it)->getLanes();
137  for (std::vector<MSLane*>::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); ++it_lane) {
138  ret.add((*it_lane)->getShape().front());
139  }
140  }
141  for (MSEdgeVector::const_iterator it = myPredecessors.begin(); it != myPredecessors.end(); ++it) {
142  const std::vector<MSLane*>& lanes = (*it)->getLanes();
143  for (std::vector<MSLane*>::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); ++it_lane) {
144  ret.add((*it_lane)->getShape().back());
145  }
146  }
147  }
148  ret.grow(10);
149  return ret;
150 }
151 
152 
153 void
154 GUIEdge::fill(std::vector<GUIEdge*>& netsWrappers) {
155  int size = MSEdge::dictSize();
156  netsWrappers.reserve(size);
157  for (DictType::iterator i = myDict.begin(); i != myDict.end(); ++i) {
158  if (i->second->getPurpose() != MSEdge::EDGEFUNCTION_DISTRICT) {
159  netsWrappers.push_back(static_cast<GUIEdge*>((*i).second));
160  }
161  }
162 }
163 
164 
165 
168  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
169  buildPopupHeader(ret, app);
175  }
176  const double pos = getLanes()[0]->getShape().nearest_offset_to_point2D(parent.getPositionInformation());
177  new FXMenuCommand(ret, ("pos: " + toString(pos)).c_str(), 0, 0, 0);
178  buildPositionCopyEntry(ret, false);
179  return ret;
180 }
181 
182 
185  GUISUMOAbstractView& parent) {
186  GUIParameterTableWindow* ret = 0;
187  ret = new GUIParameterTableWindow(app, *this, 18);
188  // add edge items
189  ret->mkItem("length [m]", false, (*myLanes)[0]->getLength());
190  ret->mkItem("allowed speed [m/s]", false, getAllowedSpeed());
191  ret->mkItem("brutto occupancy [%]", true, new FunctionBinding<GUIEdge, double>(this, &GUIEdge::getBruttoOccupancy, 100.));
192  ret->mkItem("mean vehicle speed [m/s]", true, new FunctionBinding<GUIEdge, double>(this, &GUIEdge::getMeanSpeed));
193  ret->mkItem("flow [veh/h/lane]", true, new FunctionBinding<GUIEdge, double>(this, &GUIEdge::getFlow));
194  ret->mkItem("routing speed [m/s]", true, new FunctionBinding<MSEdge, double>(this, &MSEdge::getRoutingSpeed));
196  ret->mkItem("vehicle ids", false, getVehicleIDs());
197  // add segment items
199  ret->mkItem("segment index", false, segment->getIndex());
200  ret->mkItem("segment queues", false, segment->numQueues());
201  ret->mkItem("segment length [m]", false, segment->getLength());
202  ret->mkItem("segment allowed speed [m/s]", false, segment->getEdge().getSpeedLimit());
203  ret->mkItem("segment jam threshold [%]", false, segment->getRelativeJamThreshold() * 100);
204  ret->mkItem("segment brutto occupancy [%]", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getRelativeOccupancy, 100));
205  ret->mkItem("segment mean vehicle speed [m/s]", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getMeanSpeed));
206  ret->mkItem("segment flow [veh/h/lane]", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getFlow));
207  ret->mkItem("segment #vehicles", true, new CastingFunctionBinding<MESegment, double, int>(segment, &MESegment::getCarNumber));
208  ret->mkItem("segment leader leave time", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getEventTimeSeconds));
209  ret->mkItem("segment headway [s]", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getLastHeadwaySeconds));
210 
211  // close building
212  ret->closeBuilding();
213  return ret;
214 }
215 
216 
217 Boundary
219  Boundary b = getBoundary();
220  // ensure that vehicles and persons on the side are drawn even if the edge
221  // is outside the view
222  b.grow(10);
223  return b;
224 }
225 
226 
227 void
230  return;
231  }
232  glPushName(getGlID());
233  // draw the lanes
234  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
236  setColor(s);
237  }
238  GUILane* l = dynamic_cast<GUILane*>(*i);
239  if (l != 0) {
240  l->drawGL(s);
241  }
242  }
245  drawMesoVehicles(s);
246  }
247  }
248  glPopName();
249  // (optionally) draw the name and/or the street name
250  const bool drawEdgeName = s.edgeName.show && myFunction == EDGEFUNCTION_NORMAL;
251  const bool drawInternalEdgeName = s.internalEdgeName.show && myFunction == EDGEFUNCTION_INTERNAL;
252  const bool drawCwaEdgeName = s.cwaEdgeName.show && (myFunction == EDGEFUNCTION_CROSSING || myFunction == EDGEFUNCTION_WALKINGAREA);
253  const bool drawStreetName = s.streetName.show && myStreetName != "";
254  if (drawEdgeName || drawInternalEdgeName || drawCwaEdgeName || drawStreetName) {
255  GUILane* lane1 = dynamic_cast<GUILane*>((*myLanes)[0]);
256  GUILane* lane2 = dynamic_cast<GUILane*>((*myLanes).back());
257  if (lane1 != 0 && lane2 != 0) {
258  Position p = lane1->getShape().positionAtOffset(lane1->getShape().length() / (double) 2.);
259  p.add(lane2->getShape().positionAtOffset(lane2->getShape().length() / (double) 2.));
260  p.mul(.5);
261  double angle = lane1->getShape().rotationDegreeAtOffset(lane1->getShape().length() / (double) 2.);
262  angle += 90;
263  if (angle > 90 && angle < 270) {
264  angle -= 180;
265  }
266  if (drawEdgeName) {
267  drawName(p, s.scale, s.edgeName, angle);
268  } else if (drawInternalEdgeName) {
269  drawName(p, s.scale, s.internalEdgeName, angle);
270  } else if (drawCwaEdgeName) {
271  drawName(p, s.scale, s.cwaEdgeName, angle);
272  }
273  if (drawStreetName) {
275  s.streetName.size / s.scale, s.streetName.color, angle);
276  }
277  }
278  }
280  myLock.lock();
281  for (std::set<MSTransportable*>::const_iterator i = myPersons.begin(); i != myPersons.end(); ++i) {
282  GUIPerson* person = dynamic_cast<GUIPerson*>(*i);
283  assert(person != 0);
284  person->drawGL(s);
285  }
286  myLock.unlock();
287  }
289  myLock.lock();
290  for (std::set<MSTransportable*>::const_iterator i = myContainers.begin(); i != myContainers.end(); ++i) {
291  GUIContainer* container = dynamic_cast<GUIContainer*>(*i);
292  assert(container != 0);
293  container->drawGL(s);
294  }
295  myLock.unlock();
296  }
297 }
298 
299 
300 void
303  if (vehicleControl != 0) {
304  // draw the meso vehicles
305  vehicleControl->secureVehicles();
307  int laneIndex = 0;
308  MESegment::Queue queue;
309  for (std::vector<MSLane*>::const_iterator msl = myLanes->begin(); msl != myLanes->end(); ++msl, ++laneIndex) {
310  GUILane* l = static_cast<GUILane*>(*msl);
311  // go through the vehicles
312  double segmentOffset = 0; // offset at start of current segment
313  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
314  segment != 0; segment = segment->getNextSegment()) {
315  const double length = segment->getLength();
316  if (laneIndex < segment->numQueues()) {
317  // make a copy so we don't have to worry about synchronization
318  queue = segment->getQueue(laneIndex);
319  const int queueSize = (int)queue.size();
320  double vehiclePosition = segmentOffset + length;
321  // draw vehicles beginning with the leader at the end of the segment
322  double xOff = 0;
323  for (int i = 0; i < queueSize; ++i) {
324  GUIMEVehicle* veh = static_cast<GUIMEVehicle*>(queue[queueSize - i - 1]);
325  const double vehLength = veh->getVehicleType().getLengthWithGap();
326  while (vehiclePosition < segmentOffset) {
327  // if there is only a single queue for a
328  // multi-lane edge shift vehicles and start
329  // drawing again from the end of the segment
330  vehiclePosition += length;
331  xOff += 2;
332  }
333  const Position p = l->geometryPositionAtOffset(vehiclePosition);
334  const double angle = l->getShape().rotationAtOffset(l->interpolateLanePosToGeometryPos(vehiclePosition));
335  veh->drawOnPos(s, p, angle);
336  vehiclePosition -= vehLength;
337  }
338  }
339  segmentOffset += length;
340  }
341  glPopMatrix();
342  }
343  vehicleControl->releaseVehicles();
344  }
345 }
346 
347 
348 
349 int
351  int vehNo = 0;
352  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
353  vehNo += segment->getCarNumber();
354  }
355  return (int)vehNo;
356 }
357 
358 
359 std::string
361  std::string result = " ";
362  std::vector<const MEVehicle*> vehs;
363  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
364  std::vector<const MEVehicle*> segmentVehs = segment->getVehicles();
365  vehs.insert(vehs.end(), segmentVehs.begin(), segmentVehs.end());
366  }
367  for (std::vector<const MEVehicle*>::const_iterator it = vehs.begin(); it != vehs.end(); it++) {
368  result += (*it)->getID() + " ";
369  }
370  return result;
371 }
372 
373 
374 double
376  double flow = 0;
377  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
378  flow += (double) segment->getCarNumber() * segment->getMeanSpeed();
379  }
380  return 3600 * flow / (*myLanes)[0]->getLength();
381 }
382 
383 
384 double
386  double occ = 0;
387  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
388  occ += segment->getBruttoOccupancy();
389  }
390  return occ / (*myLanes)[0]->getLength() / (double)(myLanes->size());
391 }
392 
393 
394 double
396  return (*myLanes)[0]->getSpeedLimit();
397 }
398 
399 
400 double
402  return getMeanSpeed() / getAllowedSpeed();
403 }
404 
405 
406 void
408  myMesoColor = RGBColor(0, 0, 0); // default background color when using multiColor
409  const GUIColorer& c = s.edgeColorer;
410  if (!setFunctionalColor(c.getActive()) && !setMultiColor(c)) {
412  }
413 }
414 
415 
416 bool
417 GUIEdge::setFunctionalColor(int activeScheme) const {
418  switch (activeScheme) {
419  case 9: {
420  const PositionVector& shape = getLanes()[0]->getShape();
421  double hue = GeomHelper::naviDegree(shape.beginEndAngle()); // [0-360]
422  myMesoColor = RGBColor::fromHSV(hue, 1., 1.);
423  return true;
424  }
425  default:
426  return false;
427  }
428 }
429 
430 
431 bool
433  const int activeScheme = c.getActive();
434  mySegmentColors.clear();
435  switch (activeScheme) {
436  case 10: // alternating segments
437  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
438  segment != 0; segment = segment->getNextSegment()) {
439  mySegmentColors.push_back(c.getScheme().getColor(segment->getIndex() % 2));
440  }
441  //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";
442  return true;
443  case 11: // by segment jammed state
444  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
445  segment != 0; segment = segment->getNextSegment()) {
446  mySegmentColors.push_back(c.getScheme().getColor(segment->free() ? 0 : 1));
447  }
448  return true;
449  case 12: // by segment occupancy
450  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
451  segment != 0; segment = segment->getNextSegment()) {
452  mySegmentColors.push_back(c.getScheme().getColor(segment->getRelativeOccupancy()));
453  }
454  return true;
455  case 13: // by segment speed
456  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
457  segment != 0; segment = segment->getNextSegment()) {
458  mySegmentColors.push_back(c.getScheme().getColor(segment->getMeanSpeed()));
459  }
460  return true;
461  case 14: // by segment flow
462  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
463  segment != 0; segment = segment->getNextSegment()) {
464  mySegmentColors.push_back(c.getScheme().getColor(3600 * segment->getCarNumber() * segment->getMeanSpeed() / segment->getLength()));
465  }
466  return true;
467  case 15: // by segment relative speed
468  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
469  segment != 0; segment = segment->getNextSegment()) {
470  mySegmentColors.push_back(c.getScheme().getColor(segment->getMeanSpeed() / getAllowedSpeed()));
471  }
472  return true;
473  default:
474  return false;
475  }
476 }
477 
478 
479 double
480 GUIEdge::getColorValue(int activeScheme) const {
481  switch (activeScheme) {
482  case 1:
483  return gSelected.isSelected(getType(), getGlID());
484  case 2:
485  return getPurpose();
486  case 3:
487  return getAllowedSpeed();
488  case 4:
489  return getBruttoOccupancy();
490  case 5:
491  return getMeanSpeed();
492  case 6:
493  return getFlow();
494  case 7:
495  return getRelativeSpeed();
496  case 8:
497  return getRoutingSpeed();
498  case 16:
500  }
501  return 0;
502 }
503 
504 
505 double
506 GUIEdge::getScaleValue(int activeScheme) const {
507  switch (activeScheme) {
508  case 1:
509  return gSelected.isSelected(getType(), getGlID());
510  case 2:
511  return getAllowedSpeed();
512  case 3:
513  return getBruttoOccupancy();
514  case 4:
515  return getMeanSpeed();
516  case 5:
517  return getFlow();
518  case 6:
519  return getRelativeSpeed();
520  case 7:
522  }
523  return 0;
524 }
525 
526 
527 MESegment*
529  const PositionVector& shape = getLanes()[0]->getShape();
530  const double lanePos = shape.nearest_offset_to_point2D(pos);
531  return MSGlobals::gMesoNet->getSegmentForEdge(*this, lanePos);
532 }
533 
534 
535 
536 void
538  const std::vector<MSLane*>& lanes = getLanes();
539  const bool isClosed = lane->isClosed();
540  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
541  GUILane* l = dynamic_cast<GUILane*>(*i);
542  if (l->isClosed() == isClosed) {
543  l->closeTraffic(false);
544  }
545  }
547 }
548 
549 
550 void
552  MSEdgeVector edges;
553  edges.push_back(this);
554  GUITriggeredRerouter* rr = new GUITriggeredRerouter(getID() + "_dynamic_rerouter", edges, 1, "", false,
555  GUINet::getGUIInstance()->getVisualisationSpeedUp());
556 
559  ri.end = SUMOTime_MAX;
561  rr->myIntervals.push_back(ri);
562 
563  // trigger rerouting for vehicles already on this edge
564  const std::vector<MSLane*>& lanes = getLanes();
565  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
566  const MSLane::VehCont& vehicles = (*i)->getVehiclesSecure();
567  for (MSLane::VehCont::const_iterator v = vehicles.begin(); v != vehicles.end(); ++v) {
568  if ((*v)->getLane() == (*i)) {
570  } // else: this is the shadow during a continuous lane change
571  }
572  (*i)->releaseVehicles();
573  }
574 }
575 
576 /****************************************************************************/
577 
int getVehicleNo() const
Definition: GUIEdge.cpp:350
RGBColor myMesoColor
Definition: GUIEdge.h:238
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:806
double getBruttoOccupancy() const
Definition: GUIEdge.cpp:385
double getRelativeOccupancy() const
Returns the relative occupany of the segment (percentage of road used))
Definition: MESegment.h:181
double scale
information about a lane&#39;s width (temporary, used for a single view)
std::vector< MEVehicle * > Queue
Definition: MESegment.h:86
double getMeanSpeed() const
wrapper to satisfy the FunctionBinding signature
Definition: MESegment.h:206
GUIVisualizationTextSettings streetName
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:165
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
Definition: MELoop.cpp:289
int getCarNumber() const
Returns the total number of cars on the segment.
Definition: MESegment.cpp:303
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
void add(const Position &pos)
Adds the given position to this one.
Definition: Position.h:133
double getScaleValue(int activeScheme) const
gets the scaling value according to the current scheme index
Definition: GUIEdge.cpp:506
static int dictSize()
Returns the number of edges.
Definition: MSEdge.cpp:755
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIEdge.cpp:167
static RGBColor fromHSV(double h, double s, double v)
Converts the given hsv-triplet to rgb.
Definition: RGBColor.cpp:290
void releaseVehicles()
unlock access to vehicle removal/additions for thread synchronization
void closeTraffic(bool rebuildAllowed=true)
close this lane for traffic
Definition: GUILane.cpp:1090
RandomDistributor< MSEdge * > edgeProbs
The distributions of new destinations to use.
The vehicle arrived at a junction.
void secureVehicles()
lock access to vehicle removal/additions for thread synchronization
std::vector< RGBColor > mySegmentColors
The color of the segments (cached)
Definition: GUIEdge.h:222
Stores the information about how to visualize structures.
double getEventTimeSeconds() const
Like getEventTime but returns seconds (for visualization)
Definition: MESegment.h:288
const EdgeBasicFunction myFunction
the purpose of the edge
Definition: MSEdge.h:776
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:149
bool isClosed() const
Definition: GUILane.h:252
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:518
Boundary getBoundary() const
Returns the street&#39;s geometry.
Definition: GUIEdge.cpp:126
The edge is a macroscopic connector (source/sink)
Definition: MSEdge.h:95
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:192
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:158
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:684
double getLength() const
Returns the lane&#39;s length.
Definition: MSLane.h:484
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:66
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
EdgeBasicFunction
Defines possible edge types.
Definition: MSEdge.h:89
double getLength() const
return the length of the edge
Definition: MSEdge.h:586
void drawMesoVehicles(const GUIVisualizationSettings &s) const
Definition: GUIEdge.cpp:301
std::string getVehicleIDs() const
Definition: GUIEdge.cpp:360
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:824
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIEdge.cpp:218
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:70
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some edge function
Definition: GUIEdge.cpp:417
MSLane & getLane(int laneNo)
returns the enumerated lane (!!! why not private with a friend?)
Definition: GUIEdge.cpp:90
GUIVisualizationTextSettings edgeName
A road/street connecting two junctions (gui-version)
Definition: GUIEdge.h:60
A road/street connecting two junctions.
Definition: MSEdge.h:80
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIEdge.cpp:407
double getColorValue(int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIEdge.cpp:480
static double naviDegree(const double angle)
Definition: GeomHelper.cpp:187
void rebuildAllowedLanes()
Definition: MSEdge.cpp:243
~GUIEdge()
Destructor.
Definition: GUIEdge.cpp:81
double getAllowedSpeed() const
Definition: GUIEdge.cpp:395
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
The edge is a district edge.
Definition: MSEdge.h:99
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:56
double minSize
The minimum size to draw this object.
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
Definition: GUINet.cpp:491
void closeTraffic(const GUILane *lane)
close this edge for traffic
Definition: GUIEdge.cpp:537
double beginEndAngle() const
returns the angle in radians of the line connecting the first and the last position ...
GUIVisualizationTextSettings internalEdgeName
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
void drawOnPos(const GUIVisualizationSettings &s, const Position &pos, const double angle) const
Draws the object on the specified position with the specified angle.
#define SUMOTime_MAX
Definition: TraCIDefs.h:53
A list of positions.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIEdge.cpp:228
SUMOTime begin
The begin time these definitions are valid.
MSEdgeVector mySuccessors
The succeeding edges.
Definition: MSEdge.h:793
virtual GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIEdge.cpp:184
double getRoutingSpeed() const
Returns the averaged speed used by the routing device.
Definition: MSEdge.cpp:721
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:257
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
const PositionVector & getShape() const
Definition: GUILane.cpp:788
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:234
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:770
const T getColor(const double value) const
EdgeBasicFunction getPurpose() const
Returns the edge type (EdgeBasicFunction)
Definition: MSEdge.h:249
void addRerouter()
add a rerouter
Definition: GUIEdge.cpp:551
std::vector< MSVehicle * > VehCont
Container for vehicles.
Definition: MSLane.h:91
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPerson.cpp:261
const std::string & getStreetName() const
Returns the street name of the edge.
Definition: MSEdge.h:282
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Tries to reroute the vehicle.
double getRelativeSpeed() const
return meanSpead divided by allowedSpeed
Definition: GUIEdge.cpp:401
void unlock()
release mutex lock
Definition: MFXMutex.cpp:92
GUIEdge(const std::string &id, int numericalID, const EdgeBasicFunction function, const std::string &streetName, const std::string &edgeType, int priority)
Constructor.
Definition: GUIEdge.cpp:74
The edge is a pedestrian walking area (a special type of internal edge)
Definition: MSEdge.h:103
static std::vector< GUIGlID > getIDs(bool includeInternal)
Definition: GUIEdge.cpp:97
MESegment * getSegmentAtPosition(const Position &pos)
returns the segment closest to the given position
Definition: GUIEdge.cpp:528
double length() const
Returns the length.
SUMOTime end
The end time these definitions are valid.
bool setMultiColor(const GUIColorer &c) const
sets multiple colors according to the current scheme index and edge function
Definition: GUIEdge.cpp:432
const MSVehicleType & getVehicleType() const
Returns the vehicle&#39;s type definition.
A MSVehicle extended by some values for usage within the gui.
Definition: GUIMEVehicle.h:61
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:363
GUIVisualizationSizeSettings containerSize
MFXMutex myLock
The mutex used to avoid concurrent updates of myPersons/ myContainers.
Definition: GUIEdge.h:236
The edge is a normal street.
Definition: MSEdge.h:93
A mutex encapsulator which locks/unlocks the given mutex on construction/destruction, respectively.
Definition: AbstractMutex.h:71
double getRelativeJamThreshold() const
Returns the relative occupany of the segment (percentage of road used)) at which the segment is consi...
Definition: MESegment.h:189
double getLastHeadwaySeconds() const
get the last headway time in seconds
Definition: MESegment.h:293
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
A single mesoscopic segment (cell)
Definition: MESegment.h:57
double getFlow() const
returns flow based on headway
Definition: MESegment.cpp:693
The edge is a pedestrian crossing (a special type of internal edge)
Definition: MSEdge.h:101
double interpolateLanePosToGeometryPos(double lanePos) const
Definition: MSLane.h:442
std::vector< RerouteInterval > myIntervals
List of rerouting definition intervals.
The popup menu of a globject.
an edge
int numQueues() const
return the number of queues
Definition: MESegment.h:134
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
Definition: MSLane.h:448
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.
static MELoop * gMesoNet
mesoscopic simulation infrastructure
Definition: MSGlobals.h:113
GUIVisualizationSizeSettings personSize
void lock()
lock mutex
Definition: MFXMutex.cpp:82
GUIGlID getGlID() const
Returns the numerical id of the object.
double getExaggeration(const GUIVisualizationSettings &s, double factor=20) const
return the drawing size including exaggeration and constantSize values
static DictType myDict
Static dictionary to associate string-ids with objects.
Definition: MSEdge.h:860
Position getPositionInformation() const
Returns the cursor&#39;s x/y position within the network.
GUIVisualizationSizeSettings vehicleSize
FXbool locked()
Definition: MFXMutex.h:70
static void fill(std::vector< GUIEdge *> &netsWrappers)
Definition: GUIEdge.cpp:154
empty max
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUILane.cpp:424
void mul(double val)
Multiplies both positions with the given value.
Definition: Position.h:113
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:77
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0)
draw Text with given parameters
Definition: GLHelper.cpp:456
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:86
The edge is an internal edge.
Definition: MSEdge.h:97
static double getTotalLength(bool includeInternal, bool eachLane)
Definition: GUIEdge.cpp:112
bool add(T val, double prob, bool checkDuplicates=true)
Adds a value with an assigned probability to the distribution.
double getFlow() const
return flow based on meanSpead
Definition: GUIEdge.cpp:375
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
void mkItem(const char *name, bool dynamic, ValueSource< unsigned > *src)
Adds a row which obtains its value from an unsigned-ValueSource.
MSEdgeVector myPredecessors
The preceeding edges.
Definition: MSEdge.h:796
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
GUISelectedStorage gSelected
A global holder of selected objects.
void closeBuilding()
Closes the building of the table.
static bool gUseMesoSim
Definition: MSGlobals.h:98
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
Definition: MESegment.h:271
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
A window containing a gl-object&#39;s parameter.
int getPendingEmits(const MSLane *lane)
return the number of pending emits for the given lane
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:803