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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
20 // A road/street connecting two junctions (gui-version)
21 /****************************************************************************/
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <vector>
34 #include <cmath>
35 #include <string>
36 #include <algorithm>
40 #include <utils/geom/GeomHelper.h>
43 #include <utils/gui/div/GLHelper.h>
46 #include <microsim/MSBaseVehicle.h>
47 #include <microsim/MSEdge.h>
48 #include <microsim/MSJunction.h>
49 #include <microsim/MSLaneChanger.h>
51 #include <microsim/MSGlobals.h>
54 #include "GUITriggeredRerouter.h"
55 #include "GUIEdge.h"
56 #include "GUIVehicle.h"
57 #include "GUINet.h"
58 #include "GUILane.h"
59 #include "GUIPerson.h"
60 #include "GUIContainer.h"
61 
63 #include <mesogui/GUIMEVehicle.h>
64 #include <mesosim/MESegment.h>
65 #include <mesosim/MELoop.h>
66 #include <mesosim/MEVehicle.h>
67 
68 
69 // ===========================================================================
70 // included modules
71 // ===========================================================================
72 GUIEdge::GUIEdge(const std::string& id, int numericalID,
73  const SumoXMLEdgeFunc function,
74  const std::string& streetName, const std::string& edgeType, int priority)
75  : MSEdge(id, numericalID, function, streetName, edgeType, priority),
76  GUIGlObject(GLO_EDGE, id) {}
77 
78 
80  // just to quit cleanly on a failure
81  if (myLock.locked()) {
82  myLock.unlock();
83  }
84 }
85 
86 
87 MSLane&
88 GUIEdge::getLane(int laneNo) {
89  assert(laneNo < (int)myLanes->size());
90  return *((*myLanes)[laneNo]);
91 }
92 
93 
94 std::vector<GUIGlID>
95 GUIEdge::getIDs(bool includeInternal) {
96  std::vector<GUIGlID> ret;
97  ret.reserve(MSEdge::myDict.size());
98  for (MSEdge::DictType::const_iterator i = MSEdge::myDict.begin(); i != MSEdge::myDict.end(); ++i) {
99  const GUIEdge* edge = dynamic_cast<const GUIEdge*>(i->second);
100  assert(edge);
101  if (includeInternal || !edge->isInternal()) {
102  ret.push_back(edge->getGlID());
103  }
104  }
105  return ret;
106 }
107 
108 
109 double
110 GUIEdge::getTotalLength(bool includeInternal, bool eachLane) {
111  double result = 0;
112  for (MSEdge::DictType::const_iterator i = MSEdge::myDict.begin(); i != MSEdge::myDict.end(); ++i) {
113  const MSEdge* edge = i->second;
114  if (includeInternal || !edge->isInternal()) {
115  // @note needs to be change once lanes may have different length
116  result += edge->getLength() * (eachLane ? edge->getLanes().size() : 1);
117  }
118  }
119  return result;
120 }
121 
122 
123 Boundary
125  Boundary ret;
126  if (!isTazConnector()) {
127  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
128  ret.add((*i)->getShape().getBoxBoundary());
129  }
130  } else {
131  // take the starting coordinates of all follower edges and the endpoints
132  // of all successor edges
133  for (MSEdgeVector::const_iterator it = mySuccessors.begin(); it != mySuccessors.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().front());
137  }
138  }
139  for (MSEdgeVector::const_iterator it = myPredecessors.begin(); it != myPredecessors.end(); ++it) {
140  const std::vector<MSLane*>& lanes = (*it)->getLanes();
141  for (std::vector<MSLane*>::const_iterator it_lane = lanes.begin(); it_lane != lanes.end(); ++it_lane) {
142  ret.add((*it_lane)->getShape().back());
143  }
144  }
145  }
146  ret.grow(10);
147  return ret;
148 }
149 
150 
153  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
154  buildPopupHeader(ret, app);
160  }
161  const double pos = getLanes()[0]->getShape().nearest_offset_to_point2D(parent.getPositionInformation());
162  new FXMenuCommand(ret, ("pos: " + toString(pos)).c_str(), 0, 0, 0);
163  buildPositionCopyEntry(ret, false);
164  return ret;
165 }
166 
167 
170  GUISUMOAbstractView& parent) {
171  GUIParameterTableWindow* ret = 0;
172  ret = new GUIParameterTableWindow(app, *this, 18);
173  // add edge items
174  ret->mkItem("length [m]", false, (*myLanes)[0]->getLength());
175  ret->mkItem("allowed speed [m/s]", false, getAllowedSpeed());
176  ret->mkItem("brutto occupancy [%]", true, new FunctionBinding<GUIEdge, double>(this, &GUIEdge::getBruttoOccupancy, 100.));
177  ret->mkItem("mean vehicle speed [m/s]", true, new FunctionBinding<GUIEdge, double>(this, &GUIEdge::getMeanSpeed));
178  ret->mkItem("flow [veh/h/lane]", true, new FunctionBinding<GUIEdge, double>(this, &GUIEdge::getFlow));
179  ret->mkItem("routing speed [m/s]", true, new FunctionBinding<MSEdge, double>(this, &MSEdge::getRoutingSpeed));
181  ret->mkItem("vehicle ids", false, getVehicleIDs());
182  // add segment items
184  ret->mkItem("segment index", false, segment->getIndex());
185  ret->mkItem("segment queues", false, segment->numQueues());
186  ret->mkItem("segment length [m]", false, segment->getLength());
187  ret->mkItem("segment allowed speed [m/s]", false, segment->getEdge().getSpeedLimit());
188  ret->mkItem("segment jam threshold [%]", false, segment->getRelativeJamThreshold() * 100);
189  ret->mkItem("segment brutto occupancy [%]", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getRelativeOccupancy, 100));
190  ret->mkItem("segment mean vehicle speed [m/s]", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getMeanSpeed));
191  ret->mkItem("segment flow [veh/h/lane]", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getFlow));
192  ret->mkItem("segment #vehicles", true, new CastingFunctionBinding<MESegment, double, int>(segment, &MESegment::getCarNumber));
193  ret->mkItem("segment leader leave time", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getEventTimeSeconds));
194  ret->mkItem("segment headway [s]", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getLastHeadwaySeconds));
195 
196  // close building
197  ret->closeBuilding();
198  return ret;
199 }
200 
201 
202 Boundary
204  Boundary b = getBoundary();
205  // ensure that vehicles and persons on the side are drawn even if the edge
206  // is outside the view
207  b.grow(10);
208  return b;
209 }
210 
211 
212 void
215  return;
216  }
217  glPushName(getGlID());
218  // draw the lanes
219  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
221  setColor(s);
222  }
223  GUILane* l = dynamic_cast<GUILane*>(*i);
224  if (l != 0) {
225  l->drawGL(s);
226  }
227  }
230  drawMesoVehicles(s);
231  }
232  }
233  glPopName();
234  // (optionally) draw the name and/or the street name
235  const bool drawEdgeName = s.edgeName.show && myFunction == EDGEFUNC_NORMAL;
236  const bool drawInternalEdgeName = s.internalEdgeName.show && myFunction == EDGEFUNC_INTERNAL;
237  const bool drawCwaEdgeName = s.cwaEdgeName.show && (myFunction == EDGEFUNC_CROSSING || myFunction == EDGEFUNC_WALKINGAREA);
238  const bool drawStreetName = s.streetName.show && myStreetName != "";
239  if (drawEdgeName || drawInternalEdgeName || drawCwaEdgeName || drawStreetName) {
240  GUILane* lane1 = dynamic_cast<GUILane*>((*myLanes)[0]);
241  GUILane* lane2 = dynamic_cast<GUILane*>((*myLanes).back());
242  if (lane1 != 0 && lane2 != 0) {
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  double angle = lane1->getShape().rotationDegreeAtOffset(lane1->getShape().length() / (double) 2.);
247  angle += 90;
248  if (angle > 90 && angle < 270) {
249  angle -= 180;
250  }
251  if (drawEdgeName) {
252  drawName(p, s.scale, s.edgeName, angle);
253  } else if (drawInternalEdgeName) {
254  drawName(p, s.scale, s.internalEdgeName, angle);
255  } else if (drawCwaEdgeName) {
256  drawName(p, s.scale, s.cwaEdgeName, angle);
257  }
258  if (drawStreetName) {
260  s.streetName.size / s.scale, s.streetName.color, angle);
261  }
262  }
263  }
265  myLock.lock();
266  for (std::set<MSTransportable*>::const_iterator i = myPersons.begin(); i != myPersons.end(); ++i) {
267  GUIPerson* person = dynamic_cast<GUIPerson*>(*i);
268  assert(person != 0);
269  person->drawGL(s);
270  }
271  myLock.unlock();
272  }
274  myLock.lock();
275  for (std::set<MSTransportable*>::const_iterator i = myContainers.begin(); i != myContainers.end(); ++i) {
276  GUIContainer* container = dynamic_cast<GUIContainer*>(*i);
277  assert(container != 0);
278  container->drawGL(s);
279  }
280  myLock.unlock();
281  }
282 }
283 
284 
285 void
288  if (vehicleControl != 0) {
289  // draw the meso vehicles
290  vehicleControl->secureVehicles();
292  int laneIndex = 0;
293  MESegment::Queue queue;
294  for (std::vector<MSLane*>::const_iterator msl = myLanes->begin(); msl != myLanes->end(); ++msl, ++laneIndex) {
295  GUILane* l = static_cast<GUILane*>(*msl);
296  // go through the vehicles
297  double segmentOffset = 0; // offset at start of current segment
298  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
299  segment != 0; segment = segment->getNextSegment()) {
300  const double length = segment->getLength();
301  if (laneIndex < segment->numQueues()) {
302  // make a copy so we don't have to worry about synchronization
303  queue = segment->getQueue(laneIndex);
304  const int queueSize = (int)queue.size();
305  double vehiclePosition = segmentOffset + length;
306  // draw vehicles beginning with the leader at the end of the segment
307  double xOff = 0;
308  for (int i = 0; i < queueSize; ++i) {
309  GUIMEVehicle* veh = static_cast<GUIMEVehicle*>(queue[queueSize - i - 1]);
310  const double vehLength = veh->getVehicleType().getLengthWithGap();
311  while (vehiclePosition < segmentOffset) {
312  // if there is only a single queue for a
313  // multi-lane edge shift vehicles and start
314  // drawing again from the end of the segment
315  vehiclePosition += length;
316  xOff += 2;
317  }
318  const Position p = l->geometryPositionAtOffset(vehiclePosition);
319  const double angle = l->getShape().rotationAtOffset(l->interpolateLanePosToGeometryPos(vehiclePosition));
320  veh->drawOnPos(s, p, angle);
321  vehiclePosition -= vehLength;
322  }
323  }
324  segmentOffset += length;
325  }
326  glPopMatrix();
327  }
328  vehicleControl->releaseVehicles();
329  }
330 }
331 
332 
333 
334 int
336  int vehNo = 0;
337  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
338  vehNo += segment->getCarNumber();
339  }
340  return (int)vehNo;
341 }
342 
343 
344 std::string
346  std::string result = " ";
347  std::vector<const MEVehicle*> vehs;
348  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
349  std::vector<const MEVehicle*> segmentVehs = segment->getVehicles();
350  vehs.insert(vehs.end(), segmentVehs.begin(), segmentVehs.end());
351  }
352  for (std::vector<const MEVehicle*>::const_iterator it = vehs.begin(); it != vehs.end(); it++) {
353  result += (*it)->getID() + " ";
354  }
355  return result;
356 }
357 
358 
359 double
361  double flow = 0;
362  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
363  flow += (double) segment->getCarNumber() * segment->getMeanSpeed();
364  }
365  return 3600 * flow / (*myLanes)[0]->getLength();
366 }
367 
368 
369 double
371  double occ = 0;
372  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
373  occ += segment->getBruttoOccupancy();
374  }
375  return occ / (*myLanes)[0]->getLength() / (double)(myLanes->size());
376 }
377 
378 
379 double
381  return (*myLanes)[0]->getSpeedLimit();
382 }
383 
384 
385 double
387  return getMeanSpeed() / getAllowedSpeed();
388 }
389 
390 
391 void
393  myMesoColor = RGBColor(0, 0, 0); // default background color when using multiColor
394  const GUIColorer& c = s.edgeColorer;
395  if (!setFunctionalColor(c.getActive()) && !setMultiColor(c)) {
397  }
398 }
399 
400 
401 bool
402 GUIEdge::setFunctionalColor(int activeScheme) const {
403  switch (activeScheme) {
404  case 9: {
405  const PositionVector& shape = getLanes()[0]->getShape();
406  double hue = GeomHelper::naviDegree(shape.beginEndAngle()); // [0-360]
407  myMesoColor = RGBColor::fromHSV(hue, 1., 1.);
408  return true;
409  }
410  default:
411  return false;
412  }
413 }
414 
415 
416 bool
418  const int activeScheme = c.getActive();
419  mySegmentColors.clear();
420  switch (activeScheme) {
421  case 10: // alternating segments
422  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
423  segment != 0; segment = segment->getNextSegment()) {
424  mySegmentColors.push_back(c.getScheme().getColor(segment->getIndex() % 2));
425  }
426  //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";
427  return true;
428  case 11: // by segment jammed state
429  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
430  segment != 0; segment = segment->getNextSegment()) {
431  mySegmentColors.push_back(c.getScheme().getColor(segment->free() ? 0 : 1));
432  }
433  return true;
434  case 12: // by segment occupancy
435  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
436  segment != 0; segment = segment->getNextSegment()) {
437  mySegmentColors.push_back(c.getScheme().getColor(segment->getRelativeOccupancy()));
438  }
439  return true;
440  case 13: // by segment speed
441  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
442  segment != 0; segment = segment->getNextSegment()) {
443  mySegmentColors.push_back(c.getScheme().getColor(segment->getMeanSpeed()));
444  }
445  return true;
446  case 14: // by segment flow
447  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
448  segment != 0; segment = segment->getNextSegment()) {
449  mySegmentColors.push_back(c.getScheme().getColor(3600 * segment->getCarNumber() * segment->getMeanSpeed() / segment->getLength()));
450  }
451  return true;
452  case 15: // by segment relative speed
453  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
454  segment != 0; segment = segment->getNextSegment()) {
455  mySegmentColors.push_back(c.getScheme().getColor(segment->getMeanSpeed() / getAllowedSpeed()));
456  }
457  return true;
458  default:
459  return false;
460  }
461 }
462 
463 
464 double
465 GUIEdge::getColorValue(int activeScheme) const {
466  switch (activeScheme) {
467  case 1:
468  return gSelected.isSelected(getType(), getGlID());
469  case 2:
470  return getFunction();
471  case 3:
472  return getAllowedSpeed();
473  case 4:
474  return getBruttoOccupancy();
475  case 5:
476  return getMeanSpeed();
477  case 6:
478  return getFlow();
479  case 7:
480  return getRelativeSpeed();
481  case 8:
482  return getRoutingSpeed();
483  case 16:
485  }
486  return 0;
487 }
488 
489 
490 double
491 GUIEdge::getScaleValue(int activeScheme) const {
492  switch (activeScheme) {
493  case 1:
494  return gSelected.isSelected(getType(), getGlID());
495  case 2:
496  return getAllowedSpeed();
497  case 3:
498  return getBruttoOccupancy();
499  case 4:
500  return getMeanSpeed();
501  case 5:
502  return getFlow();
503  case 6:
504  return getRelativeSpeed();
505  case 7:
507  }
508  return 0;
509 }
510 
511 
512 MESegment*
514  const PositionVector& shape = getLanes()[0]->getShape();
515  const double lanePos = shape.nearest_offset_to_point2D(pos);
516  return MSGlobals::gMesoNet->getSegmentForEdge(*this, lanePos);
517 }
518 
519 
520 
521 void
523  const std::vector<MSLane*>& lanes = getLanes();
524  const bool isClosed = lane->isClosed();
525  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
526  GUILane* l = dynamic_cast<GUILane*>(*i);
527  if (l->isClosed() == isClosed) {
528  l->closeTraffic(false);
529  }
530  }
532 }
533 
534 
535 void
537  MSEdgeVector edges;
538  edges.push_back(this);
539  GUITriggeredRerouter* rr = new GUITriggeredRerouter(getID() + "_dynamic_rerouter", edges, 1, "", false, 0,
540  GUINet::getGUIInstance()->getVisualisationSpeedUp());
541 
544  ri.end = SUMOTime_MAX;
546  rr->myIntervals.push_back(ri);
547 
548  // trigger rerouting for vehicles already on this edge
549  const std::vector<MSLane*>& lanes = getLanes();
550  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
551  const MSLane::VehCont& vehicles = (*i)->getVehiclesSecure();
552  for (MSLane::VehCont::const_iterator v = vehicles.begin(); v != vehicles.end(); ++v) {
553  if ((*v)->getLane() == (*i)) {
555  } // else: this is the shadow during a continuous lane change
556  }
557  (*i)->releaseVehicles();
558  }
559 }
560 
561 /****************************************************************************/
562 
int getVehicleNo() const
Definition: GUIEdge.cpp:335
const SumoXMLEdgeFunc myFunction
the purpose of the edge
Definition: MSEdge.h:764
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:794
double getBruttoOccupancy() const
Definition: GUIEdge.cpp:370
double getRelativeOccupancy() const
Returns the relative occupany of the segment (percentage of road used))
Definition: MESegment.h:180
double scale
information about a lane&#39;s width (temporary, used for a single view)
std::vector< MEVehicle * > Queue
Definition: MESegment.h:85
double getMeanSpeed() const
wrapper to satisfy the FunctionBinding signature
Definition: MESegment.h:205
GUIVisualizationTextSettings streetName
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
Reroutes vehicles passing an edge One rerouter can be active on multiple edges. To reduce drawing loa...
double getLength() const
Returns the length of the segment in meters.
Definition: MESegment.h:164
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:302
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:132
double getScaleValue(int activeScheme) const
gets the scaling value according to the current scheme index
Definition: GUIEdge.cpp:491
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIEdge.cpp:152
static RGBColor fromHSV(double h, double s, double v)
Converts the given hsv-triplet to rgb.
Definition: RGBColor.cpp:301
void releaseVehicles()
unlock access to vehicle removal/additions for thread synchronization
void closeTraffic(bool rebuildAllowed=true)
close this lane for traffic
Definition: GUILane.cpp:1140
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:218
Stores the information about how to visualize structures.
double getEventTimeSeconds() const
Like getEventTime but returns seconds (for visualization)
Definition: MESegment.h:287
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:148
bool isClosed() const
Definition: GUILane.h:256
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:533
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, int align=0, double width=-1)
Definition: GLHelper.cpp:487
Boundary getBoundary() const
Returns the street&#39;s geometry.
Definition: GUIEdge.cpp:124
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:167
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:167
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:700
double getLength() const
Returns the lane&#39;s length.
Definition: MSLane.h:497
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:65
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:569
void drawMesoVehicles(const GUIVisualizationSettings &s) const
Definition: GUIEdge.cpp:286
std::string getVehicleIDs() const
Definition: GUIEdge.cpp:345
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:846
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIEdge.cpp:203
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:47
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:69
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some edge function
Definition: GUIEdge.cpp:402
MSLane & getLane(int laneNo)
returns the enumerated lane (!!! why not private with a friend?)
Definition: GUIEdge.cpp:88
GUIVisualizationTextSettings edgeName
A road/street connecting two junctions (gui-version)
Definition: GUIEdge.h:59
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:392
double getColorValue(int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIEdge.cpp:465
static double naviDegree(const double angle)
Definition: GeomHelper.cpp:186
void rebuildAllowedLanes()
Definition: MSEdge.cpp:246
~GUIEdge()
Destructor.
Definition: GUIEdge.cpp:79
double getAllowedSpeed() const
Definition: GUIEdge.cpp:380
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:55
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:506
void closeTraffic(const GUILane *lane)
close this edge for traffic
Definition: GUIEdge.cpp:522
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:45
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:52
A list of positions.
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:781
virtual GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIEdge.cpp:169
double getRoutingSpeed() const
Returns the averaged speed used by the routing device.
Definition: MSEdge.cpp:737
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:253
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:824
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:758
const T getColor(const double value) const
bool isInternal() const
return whether this edge is an internal edge
Definition: MSEdge.h:229
void addRerouter()
add a rerouter
Definition: GUIEdge.cpp:536
std::vector< MSVehicle * > VehCont
Container for vehicles.
Definition: MSLane.h:89
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPerson.cpp:257
const std::string & getStreetName() const
Returns the street name of the edge.
Definition: MSEdge.h:266
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:386
void unlock()
release mutex lock
Definition: MFXMutex.cpp:93
static std::vector< GUIGlID > getIDs(bool includeInternal)
Definition: GUIEdge.cpp:95
MESegment * getSegmentAtPosition(const Position &pos)
returns the segment closest to the given position
Definition: GUIEdge.cpp:513
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:417
const MSVehicleType & getVehicleType() const
Returns the vehicle&#39;s type definition.
bool isTazConnector() const
Definition: MSEdge.h:252
A MSVehicle extended by some values for usage within the gui.
Definition: GUIMEVehicle.h:61
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:359
GUIVisualizationSizeSettings containerSize
MFXMutex myLock
The mutex used to avoid concurrent updates of myPersons/ myContainers.
Definition: GUIEdge.h:232
A mutex encapsulator which locks/unlocks the given mutex on construction/destruction, respectively.
Definition: AbstractMutex.h:70
double getRelativeJamThreshold() const
Returns the relative occupany of the segment (percentage of road used)) at which the segment is consi...
Definition: MESegment.h:188
double getLastHeadwaySeconds() const
get the last headway time in seconds
Definition: MESegment.h:292
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
A single mesoscopic segment (cell)
Definition: MESegment.h:56
double getFlow() const
returns flow based on headway
Definition: MESegment.cpp:692
double interpolateLanePosToGeometryPos(double lanePos) const
Definition: MSLane.h:455
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:133
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:461
std::string myStreetName
the real-world name of this edge (need not be unique)
Definition: MSEdge.h:813
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:112
GUIVisualizationSizeSettings personSize
void lock()
lock mutex
Definition: MFXMutex.cpp:83
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:851
GUIEdge(const std::string &id, int numericalID, const SumoXMLEdgeFunc function, const std::string &streetName, const std::string &edgeType, int priority)
Constructor.
Definition: GUIEdge.cpp:72
Position getPositionInformation() const
Returns the cursor&#39;s x/y position within the network.
GUIVisualizationSizeSettings vehicleSize
FXbool locked()
Definition: MFXMutex.h:69
empty max
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUILane.cpp:431
void mul(double val)
Multiplies both positions with the given value.
Definition: Position.h:112
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:77
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:85
static double getTotalLength(bool includeInternal, bool eachLane)
Definition: GUIEdge.cpp:110
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:360
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:784
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:97
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
Definition: MESegment.h:270
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
A window containing a gl-object&#39;s parameter.
SumoXMLEdgeFunc getFunction() const
Returns the edge type (SumoXMLEdgeFunc)
Definition: MSEdge.h:224
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:791