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(), nullptr, nullptr, 0);
157  buildPositionCopyEntry(ret, false);
158  return ret;
159 }
160 
161 
164  GUISUMOAbstractView& parent) {
165  GUIParameterTableWindow* ret = nullptr;
166  ret = new GUIParameterTableWindow(app, *this, 19);
167  // add edge items
168  ret->mkItem("length [m]", false, (*myLanes)[0]->getLength());
169  ret->mkItem("allowed speed [m/s]", false, getAllowedSpeed());
170  ret->mkItem("brutto occupancy [%]", true, new FunctionBinding<GUIEdge, double>(this, &GUIEdge::getBruttoOccupancy, 100.));
171  ret->mkItem("mean vehicle speed [m/s]", true, new FunctionBinding<GUIEdge, double>(this, &GUIEdge::getMeanSpeed));
172  ret->mkItem("flow [veh/h/lane]", true, new FunctionBinding<GUIEdge, double>(this, &GUIEdge::getFlow));
173  ret->mkItem("routing speed [m/s]", true, new FunctionBinding<MSEdge, double>(this, &MSEdge::getRoutingSpeed));
175  ret->mkItem("vehicle ids", false, getVehicleIDs());
176  // add segment items
178  ret->mkItem("segment index", false, segment->getIndex());
179  ret->mkItem("segment queues", false, segment->numQueues());
180  ret->mkItem("segment length [m]", false, segment->getLength());
181  ret->mkItem("segment allowed speed [m/s]", false, segment->getEdge().getSpeedLimit());
182  ret->mkItem("segment jam threshold [%]", false, segment->getRelativeJamThreshold() * 100);
183  ret->mkItem("segment brutto occupancy [%]", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getRelativeOccupancy, 100));
184  ret->mkItem("segment mean vehicle speed [m/s]", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getMeanSpeed));
185  ret->mkItem("segment flow [veh/h/lane]", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getFlow));
186  ret->mkItem("segment #vehicles", true, new CastingFunctionBinding<MESegment, double, int>(segment, &MESegment::getCarNumber));
187  ret->mkItem("segment leader leave time", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getEventTimeSeconds));
188  ret->mkItem("segment headway [s]", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getLastHeadwaySeconds));
189  ret->mkItem("segment entry blocktime [s]", true, new FunctionBinding<MESegment, double>(segment, &MESegment::getEntryBlockTimeSeconds));
190 
191  // close building
192  ret->closeBuilding();
193  return ret;
194 }
195 
196 
197 Boundary
199  Boundary b = getBoundary();
200  // ensure that vehicles and persons on the side are drawn even if the edge
201  // is outside the view
202  b.grow(10);
203  return b;
204 }
205 
206 
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 != nullptr) {
220  l->drawGL(s);
221  }
222  }
224  if (s.scale * s.vehicleSize.getExaggeration(s, nullptr) > s.vehicleSize.minSize) {
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  const bool drawEdgeValue = s.edgeValue.show && (myFunction == EDGEFUNC_NORMAL
237  if (drawEdgeName || drawInternalEdgeName || drawCwaEdgeName || drawStreetName || drawEdgeValue) {
238  GUILane* lane1 = dynamic_cast<GUILane*>((*myLanes)[0]);
239  GUILane* lane2 = dynamic_cast<GUILane*>((*myLanes).back());
240  if (lane1 != nullptr && lane2 != nullptr) {
241  Position p = lane1->getShape().positionAtOffset(lane1->getShape().length() / (double) 2.);
242  p.add(lane2->getShape().positionAtOffset(lane2->getShape().length() / (double) 2.));
243  p.mul(.5);
244  double angle = s.getTextAngle(lane1->getShape().rotationDegreeAtOffset(lane1->getShape().length() / (double) 2.) + 90);
245  if (drawEdgeName) {
246  drawName(p, s.scale, s.edgeName, angle);
247  } else if (drawInternalEdgeName) {
248  drawName(p, s.scale, s.internalEdgeName, angle);
249  } else if (drawCwaEdgeName) {
250  drawName(p, s.scale, s.cwaEdgeName, angle);
251  }
252  if (drawStreetName) {
254  }
255  if (drawEdgeValue) {
256  const int activeScheme = s.getLaneEdgeMode();
257  // use value of leftmost lane to hopefully avoid sidewalks, bikelanes etc
258  double value = (MSGlobals::gUseMesoSim
259  ? getColorValue(s, activeScheme)
260  : lane2->getColorValue(s, activeScheme));
261  GLHelper::drawTextSettings(s.edgeValue, toString(value), p, s.scale, angle);
262  }
263  }
264  }
265  if (s.scale * s.personSize.getExaggeration(s, nullptr) > s.personSize.minSize) {
267  for (std::set<MSTransportable*>::const_iterator i = myPersons.begin(); i != myPersons.end(); ++i) {
268  GUIPerson* person = dynamic_cast<GUIPerson*>(*i);
269  assert(person != 0);
270  person->drawGL(s);
271  }
272  }
273  if (s.scale * s.containerSize.getExaggeration(s, nullptr) > s.containerSize.minSize) {
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  }
281 }
282 
283 
284 void
287  if (vehicleControl != nullptr) {
288  // draw the meso vehicles
289  vehicleControl->secureVehicles();
291  int laneIndex = 0;
292  MESegment::Queue queue;
293  for (std::vector<MSLane*>::const_iterator msl = myLanes->begin(); msl != myLanes->end(); ++msl, ++laneIndex) {
294  GUILane* l = static_cast<GUILane*>(*msl);
295  // go through the vehicles
296  double segmentOffset = 0; // offset at start of current segment
297  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
298  segment != nullptr; segment = segment->getNextSegment()) {
299  const double length = segment->getLength();
300  if (laneIndex < segment->numQueues()) {
301  // make a copy so we don't have to worry about synchronization
302  queue = segment->getQueue(laneIndex);
303  const int queueSize = (int)queue.size();
304  double vehiclePosition = segmentOffset + length;
305  // draw vehicles beginning with the leader at the end of the segment
306  double xOff = 0;
307  for (int i = 0; i < queueSize; ++i) {
308  GUIMEVehicle* veh = static_cast<GUIMEVehicle*>(queue[queueSize - i - 1]);
309  const double vehLength = veh->getVehicleType().getLengthWithGap();
310  while (vehiclePosition < segmentOffset) {
311  // if there is only a single queue for a
312  // multi-lane edge shift vehicles and start
313  // drawing again from the end of the segment
314  vehiclePosition += length;
315  xOff += 2;
316  }
317  const Position p = l->geometryPositionAtOffset(vehiclePosition);
318  const double angle = l->getShape().rotationAtOffset(l->interpolateLanePosToGeometryPos(vehiclePosition));
319  veh->drawOnPos(s, p, angle);
320  vehiclePosition -= vehLength;
321  }
322  }
323  segmentOffset += length;
324  }
325  glPopMatrix();
326  }
327  vehicleControl->releaseVehicles();
328  }
329 }
330 
331 
332 
333 int
335  int vehNo = 0;
336  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != nullptr; segment = segment->getNextSegment()) {
337  vehNo += segment->getCarNumber();
338  }
339  return (int)vehNo;
340 }
341 
342 
343 std::string
345  std::string result = " ";
346  std::vector<const MEVehicle*> vehs;
347  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != nullptr; segment = segment->getNextSegment()) {
348  std::vector<const MEVehicle*> segmentVehs = segment->getVehicles();
349  vehs.insert(vehs.end(), segmentVehs.begin(), segmentVehs.end());
350  }
351  for (std::vector<const MEVehicle*>::const_iterator it = vehs.begin(); it != vehs.end(); it++) {
352  result += (*it)->getID() + " ";
353  }
354  return result;
355 }
356 
357 
358 double
360  double flow = 0;
361  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != nullptr; segment = segment->getNextSegment()) {
362  flow += (double) segment->getCarNumber() * segment->getMeanSpeed();
363  }
364  return 3600 * flow / (*myLanes)[0]->getLength();
365 }
366 
367 
368 double
370  double occ = 0;
371  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != nullptr; segment = segment->getNextSegment()) {
372  occ += segment->getBruttoOccupancy();
373  }
374  return occ / (*myLanes)[0]->getLength() / (double)(myLanes->size());
375 }
376 
377 
378 double
380  return (*myLanes)[0]->getSpeedLimit();
381 }
382 
383 
384 double
386  return getMeanSpeed() / getAllowedSpeed();
387 }
388 
389 
390 void
392  myMesoColor = RGBColor(0, 0, 0); // default background color when using multiColor
393  const GUIColorer& c = s.edgeColorer;
394  if (!setFunctionalColor(c) && !setMultiColor(c)) {
396  }
397 }
398 
399 
400 bool
402  const int activeScheme = c.getActive();
403  int activeMicroScheme = -1;
404  switch (activeScheme) {
405  case 0:
406  activeMicroScheme = 0; // color uniform
407  break;
408  case 9:
409  activeMicroScheme = 18; // color by angle
410  break;
411  case 17:
412  activeMicroScheme = 30; // color by TAZ
413  break;
414  default:
415  return false;
416  }
417  GUILane* guiLane = static_cast<GUILane*>(getLanes()[0]);
418  return guiLane->setFunctionalColor(c, myMesoColor, activeMicroScheme);
419 }
420 
421 
422 bool
424  const int activeScheme = c.getActive();
425  mySegmentColors.clear();
426  switch (activeScheme) {
427  case 10: // alternating segments
428  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
429  segment != nullptr; segment = segment->getNextSegment()) {
430  mySegmentColors.push_back(c.getScheme().getColor(segment->getIndex() % 2));
431  }
432  //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";
433  return true;
434  case 11: // by segment jammed state
435  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
436  segment != nullptr; segment = segment->getNextSegment()) {
437  mySegmentColors.push_back(c.getScheme().getColor(segment->free() ? 0 : 1));
438  }
439  return true;
440  case 12: // by segment occupancy
441  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
442  segment != nullptr; segment = segment->getNextSegment()) {
443  mySegmentColors.push_back(c.getScheme().getColor(segment->getRelativeOccupancy()));
444  }
445  return true;
446  case 13: // by segment speed
447  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
448  segment != nullptr; segment = segment->getNextSegment()) {
449  mySegmentColors.push_back(c.getScheme().getColor(segment->getMeanSpeed()));
450  }
451  return true;
452  case 14: // by segment flow
453  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
454  segment != nullptr; segment = segment->getNextSegment()) {
455  mySegmentColors.push_back(c.getScheme().getColor(3600 * segment->getCarNumber() * segment->getMeanSpeed() / segment->getLength()));
456  }
457  return true;
458  case 15: // by segment relative speed
459  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
460  segment != nullptr; segment = segment->getNextSegment()) {
461  mySegmentColors.push_back(c.getScheme().getColor(segment->getMeanSpeed() / getAllowedSpeed()));
462  }
463  return true;
464  default:
465  return false;
466  }
467 }
468 
469 
470 double
471 GUIEdge::getColorValue(const GUIVisualizationSettings& /*s*/, int activeScheme) const {
472  switch (activeScheme) {
473  case 1:
474  return gSelected.isSelected(getType(), getGlID());
475  case 2:
476  return getFunction();
477  case 3:
478  return getAllowedSpeed();
479  case 4:
480  return getBruttoOccupancy();
481  case 5:
482  return getMeanSpeed();
483  case 6:
484  return getFlow();
485  case 7:
486  return getRelativeSpeed();
487  case 8:
488  return getRoutingSpeed();
489  case 16:
491  }
492  return 0;
493 }
494 
495 
496 double
497 GUIEdge::getScaleValue(int activeScheme) const {
498  switch (activeScheme) {
499  case 1:
500  return gSelected.isSelected(getType(), getGlID());
501  case 2:
502  return getAllowedSpeed();
503  case 3:
504  return getBruttoOccupancy();
505  case 4:
506  return getMeanSpeed();
507  case 5:
508  return getFlow();
509  case 6:
510  return getRelativeSpeed();
511  case 7:
513  }
514  return 0;
515 }
516 
517 
518 MESegment*
520  const PositionVector& shape = getLanes()[0]->getShape();
521  const double lanePos = shape.nearest_offset_to_point2D(pos);
522  return MSGlobals::gMesoNet->getSegmentForEdge(*this, lanePos);
523 }
524 
525 
526 
527 void
529  const std::vector<MSLane*>& lanes = getLanes();
530  const bool isClosed = lane->isClosed();
531  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
532  GUILane* l = dynamic_cast<GUILane*>(*i);
533  if (l->isClosed() == isClosed) {
534  l->closeTraffic(false);
535  }
536  }
538  for (MSEdge* const pred : getPredecessors()) {
539  pred->rebuildAllowedTargets();
540  }
541 }
542 
543 
544 void
546  MSEdgeVector edges;
547  edges.push_back(this);
548  GUITriggeredRerouter* rr = new GUITriggeredRerouter(getID() + "_dynamic_rerouter", edges, 1, "", false, 0, "",
549  GUINet::getGUIInstance()->getVisualisationSpeedUp());
550 
553  ri.end = SUMOTime_MAX;
555  rr->myIntervals.push_back(ri);
556 
557  // trigger rerouting for vehicles already on this edge
558  const std::vector<MSLane*>& lanes = getLanes();
559  for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
560  const MSLane::VehCont& vehicles = (*i)->getVehiclesSecure();
561  for (MSLane::VehCont::const_iterator v = vehicles.begin(); v != vehicles.end(); ++v) {
562  if ((*v)->getLane() == (*i)) {
564  } // else: this is the shadow during a continuous lane change
565  }
566  (*i)->releaseVehicles();
567  }
568 }
569 
570 
571 bool
574 }
575 /****************************************************************************/
576 
int getVehicleNo() const
Definition: GUIEdge.cpp:334
const SumoXMLEdgeFunc myFunction
the purpose of the edge
Definition: MSEdge.h:761
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:793
double getBruttoOccupancy() const
Definition: GUIEdge.cpp:369
double getRelativeOccupancy() const
Returns the relative occupany of the segment (percentage of road used))
Definition: MESegment.h:176
double scale
information about a lane&#39;s width (temporary, used for a single view)
std::vector< MEVehicle * > Queue
Definition: MESegment.h:79
double getMeanSpeed() const
wrapper to satisfy the FunctionBinding signature
Definition: MESegment.h:201
GUIVisualizationTextSettings streetName
bool setFunctionalColor(const GUIColorer &c, RGBColor &col, int activeScheme=-1) const
Definition: GUILane.cpp:950
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
Reroutes vehicles passing an edge One rerouter can be active on multiple edges. To reduce drawing loa...
double getLength() const
Returns the length of the segment in meters.
Definition: MESegment.h:160
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
Definition: MELoop.cpp:283
int getCarNumber() const
Returns the total number of cars on the segment.
Definition: MESegment.h:124
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
void add(const Position &pos)
Adds the given position to this one.
Definition: Position.h:127
double getScaleValue(int activeScheme) const
gets the scaling value according to the current scheme index
Definition: GUIEdge.cpp:497
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIEdge.cpp:146
void releaseVehicles()
unlock access to vehicle removal/additions for thread synchronization
void closeTraffic(bool rebuildAllowed=true)
close this lane for traffic
Definition: GUILane.cpp:1249
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.
const MSEdgeVector & getPredecessors() const
Definition: MSEdge.h:338
double getEventTimeSeconds() const
Like getEventTime but returns seconds (for visualization)
Definition: MESegment.h:283
GUIColorer edgeColorer
The mesoscopic edge colorer.
int getIndex() const
Returns the running index of the segment in the edge (0 is the most upstream).
Definition: MESegment.h:144
double getEntryBlockTimeSeconds() const
get the last headway time in seconds
Definition: MESegment.h:293
GUIVisualizationTextSettings edgeValue
bool isClosed() const
Definition: GUILane.h:251
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048)
Definition: GLHelper.cpp:635
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
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:165
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:742
double getLength() const
Returns the lane&#39;s length.
Definition: MSLane.h:514
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:78
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:568
void drawMesoVehicles(const GUIVisualizationSettings &s) const
Definition: GUIEdge.cpp:285
std::string getVehicleIDs() const
Definition: GUIEdge.cpp:344
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:899
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
MSLane & getLane(int laneNo)
returns the enumerated lane (!!! why not private with a friend?)
Definition: GUIEdge.cpp:82
GUIVisualizationTextSettings edgeName
bool setFunctionalColor(const GUIColorer &c) const
sets the color according to the current scheme index and some edge function
Definition: GUIEdge.cpp:401
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:391
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIEdge.cpp:471
int getLaneEdgeMode() const
Returns the number of the active lane (edge) coloring schme.
void rebuildAllowedLanes()
Definition: MSEdge.cpp:258
~GUIEdge()
Destructor.
Definition: GUIEdge.cpp:73
double getAllowedSpeed() const
Definition: GUIEdge.cpp:379
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:528
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.
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:778
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:781
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:263
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:877
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
Definition: GUILane.cpp:1027
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:755
const T getColor(const double value) const
bool isInternal() const
return whether this edge is an internal edge
Definition: MSEdge.h:225
void addRerouter()
add a rerouter
Definition: GUIEdge.cpp:545
std::vector< MSVehicle * > VehCont
Container for vehicles.
Definition: MSLane.h:90
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:262
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:385
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:519
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:423
const MSVehicleType & getVehicleType() const
Returns the vehicle&#39;s type definition.
bool isTazConnector() const
Definition: MSEdge.h:248
A MSVehicle extended by some values for usage within the gui.
Definition: GUIMEVehicle.h:55
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:369
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:184
double getLastHeadwaySeconds() const
get the last headway time in seconds
Definition: MESegment.h:288
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
A single mesoscopic segment (cell)
Definition: MESegment.h:50
double getFlow() const
returns flow based on headway
Definition: MESegment.cpp:707
double interpolateLanePosToGeometryPos(double lanePos) const
Definition: MSLane.h:472
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:572
int numQueues() const
return the number of queues
Definition: MESegment.h:129
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
Definition: MSLane.h:478
std::string myStreetName
the real-world name of this edge (need not be unique)
Definition: MSEdge.h:811
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
bool drawCrossingsAndWalkingareas
whether crosings and walkingareas shall be drawn
GUIGlID getGlID() const
Returns the numerical id of the object.
static DictType myDict
Static dictionary to associate string-ids with objects.
Definition: MSEdge.h:849
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
bool drawJunctionShape
whether the shape of the junction should be drawn
FXbool locked()
check if mutex is locked
Definition: MFXMutex.h:63
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUILane.cpp:477
void mul(double val)
Multiplies both positions with the given value.
Definition: Position.h:107
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
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
static double getTotalLength(bool includeInternal, bool eachLane)
Definition: GUIEdge.cpp: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:359
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:783
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
GUISelectedStorage gSelected
A global holder of selected objects.
static bool gUseMesoSim
Definition: MSGlobals.h:91
const MSEdge & getEdge() const
Returns the edge this segment belongs to.
Definition: MESegment.h:266
Representation of a lane in the micro simulation.
Definition: MSLane.h:78
A window containing a gl-object&#39;s parameter.
SumoXMLEdgeFunc getFunction() const
Returns the edge type (SumoXMLEdgeFunc)
Definition: MSEdge.h:220
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:790