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