SUMO - Simulation of Urban MObility
GUIEdge.cpp
Go to the documentation of this file.
1 /****************************************************************************/
10 // A road/street connecting two junctions (gui-version)
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2001-2015 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <vector>
35 #include <cmath>
36 #include <string>
37 #include <algorithm>
42 #include <utils/geom/GeomHelper.h>
45 #include <utils/gui/div/GLHelper.h>
48 #include <microsim/MSBaseVehicle.h>
49 #include <microsim/MSEdge.h>
50 #include <microsim/MSJunction.h>
51 #include <microsim/MSLaneChanger.h>
52 #include <microsim/MSGlobals.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 
62 #ifdef HAVE_INTERNAL
63 #include <mesogui/GUIMEVehicleControl.h>
64 #include <mesosim/MESegment.h>
65 #include <mesosim/MELoop.h>
66 #include <mesosim/MEVehicle.h>
67 #endif
68 
69 #ifdef CHECK_MEMORY_LEAKS
70 #include <foreign/nvwa/debug_new.h>
71 #endif // CHECK_MEMORY_LEAKS
72 
73 
74 // ===========================================================================
75 // included modules
76 // ===========================================================================
77 GUIEdge::GUIEdge(const std::string& id, int numericalID,
78  const EdgeBasicFunction function,
79  const std::string& streetName, const std::string& edgeType, int priority)
80  : MSEdge(id, numericalID, function, streetName, edgeType, priority),
81  GUIGlObject(GLO_EDGE, id) {}
82 
83 
85  // just to quit cleanly on a failure
86  if (myLock.locked()) {
87  myLock.unlock();
88  }
89 }
90 
91 
92 MSLane&
93 GUIEdge::getLane(size_t laneNo) {
94  assert(laneNo < myLanes->size());
95  return *((*myLanes)[laneNo]);
96 }
97 
98 
99 std::vector<GUIGlID>
100 GUIEdge::getIDs(bool includeInternal) {
101  std::vector<GUIGlID> ret;
102  ret.reserve(MSEdge::myDict.size());
103  for (MSEdge::DictType::const_iterator i = MSEdge::myDict.begin(); i != MSEdge::myDict.end(); ++i) {
104  const GUIEdge* edge = dynamic_cast<const GUIEdge*>(i->second);
105  assert(edge);
106  if (edge->getPurpose() != EDGEFUNCTION_INTERNAL || includeInternal) {
107  ret.push_back(edge->getGlID());
108  }
109  }
110  return ret;
111 }
112 
113 
114 SUMOReal
115 GUIEdge::getTotalLength(bool includeInternal, bool eachLane) {
116  SUMOReal result = 0;
117  for (MSEdge::DictType::const_iterator i = MSEdge::myDict.begin(); i != MSEdge::myDict.end(); ++i) {
118  const MSEdge* edge = i->second;
119  if (edge->getPurpose() != EDGEFUNCTION_INTERNAL || includeInternal) {
120  // @note needs to be change once lanes may have different length
121  result += edge->getLength() * (eachLane ? edge->getLanes().size() : 1);
122  }
123  }
124  return result;
125 }
126 
127 
128 Boundary
130  Boundary ret;
131  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
132  ret.add((*i)->getShape().getBoxBoundary());
133  }
134  ret.grow(10);
135  return ret;
136 }
137 
138 
139 void
140 GUIEdge::fill(std::vector<GUIEdge*>& netsWrappers) {
141  size_t size = MSEdge::dictSize();
142  netsWrappers.reserve(size);
143  for (DictType::iterator i = myDict.begin(); i != myDict.end(); ++i) {
144  if (i->second->getPurpose() != MSEdge::EDGEFUNCTION_DISTRICT) {
145  netsWrappers.push_back(static_cast<GUIEdge*>((*i).second));
146  }
147  }
148 }
149 
150 
151 
154  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
155  buildPopupHeader(ret, app);
161  }
162  const SUMOReal pos = getLanes()[0]->getShape().nearest_offset_to_point2D(parent.getPositionInformation());
163  new FXMenuCommand(ret, ("pos: " + toString(pos)).c_str(), 0, 0, 0);
164  buildPositionCopyEntry(ret, false);
165  return ret;
166 }
167 
168 
171  GUISUMOAbstractView& parent) {
172  GUIParameterTableWindow* ret = 0;
173 #ifdef HAVE_INTERNAL
174  ret = new GUIParameterTableWindow(app, *this, 16);
175  // add edge items
176  ret->mkItem("length [m]", false, (*myLanes)[0]->getLength());
177  ret->mkItem("allowed speed [m/s]", false, getAllowedSpeed());
178  ret->mkItem("occupancy [%]", true, new FunctionBinding<GUIEdge, SUMOReal>(this, &GUIEdge::getBruttoOccupancy, 100.));
179  ret->mkItem("mean vehicle speed [m/s]", true, new FunctionBinding<GUIEdge, SUMOReal>(this, &GUIEdge::getMeanSpeed));
180  ret->mkItem("flow [veh/h/lane]", true, new FunctionBinding<GUIEdge, SUMOReal>(this, &GUIEdge::getFlow));
181  ret->mkItem("#vehicles", true, new CastingFunctionBinding<GUIEdge, SUMOReal, unsigned int>(this, &GUIEdge::getVehicleNo));
182  ret->mkItem("vehicle ids", false, getVehicleIDs());
183  // add segment items
184  MESegment* segment = getSegmentAtPosition(parent.getPositionInformation());
185  ret->mkItem("segment index", false, segment->getIndex());
186  ret->mkItem("segment length [m]", false, segment->getLength());
187  ret->mkItem("segment allowed speed [m/s]", false, segment->getMaxSpeed());
188  ret->mkItem("segment jam threshold [%]", false, segment->getRelativeJamThreshold());
189  ret->mkItem("segment occupancy [%]", true, new FunctionBinding<MESegment, SUMOReal>(segment, &MESegment::getRelativeOccupancy));
190  ret->mkItem("segment mean vehicle speed [m/s]", true, new FunctionBinding<MESegment, SUMOReal>(segment, &MESegment::getMeanSpeed));
191  ret->mkItem("segment flow [veh/h/lane]", true, new FunctionBinding<MESegment, SUMOReal>(segment, &MESegment::getFlow));
192  ret->mkItem("segment #vehicles", true, new CastingFunctionBinding<MESegment, SUMOReal, size_t>(segment, &MESegment::getCarNumber));
193  ret->mkItem("segment leader leave time", true, new FunctionBinding<MESegment, SUMOReal>(segment, &MESegment::getEventTimeSeconds));
194 
195  // close building
196  ret->closeBuilding();
197 #else
198  UNUSED_PARAMETER(app);
199  UNUSED_PARAMETER(parent);
200 #endif
201  return ret;
202 }
203 
204 
205 Boundary
207  Boundary b = getBoundary();
208  b.grow(20);
209  return b;
210 }
211 
212 
213 void
216  return;
217  }
218  glPushName(getGlID());
219  // draw the lanes
220  for (std::vector<MSLane*>::const_iterator i = myLanes->begin(); i != myLanes->end(); ++i) {
221 #ifdef HAVE_INTERNAL
223  setColor(s);
224  }
225 #endif
226  GUILane* l = dynamic_cast<GUILane*>(*i);
227  if (l != 0) {
228  l->drawGL(s);
229  }
230  }
231 #ifdef HAVE_INTERNAL
234  drawMesoVehicles(s);
235  }
236  }
237 #endif
238  glPopName();
239  // (optionally) draw the name and/or the street name
240  const bool drawEdgeName = s.edgeName.show && myFunction == EDGEFUNCTION_NORMAL;
241  const bool drawInternalEdgeName = s.internalEdgeName.show && myFunction == EDGEFUNCTION_INTERNAL;
242  const bool drawCwaEdgeName = s.cwaEdgeName.show && (myFunction == EDGEFUNCTION_CROSSING || myFunction == EDGEFUNCTION_WALKINGAREA);
243  const bool drawStreetName = s.streetName.show && myStreetName != "";
244  if (drawEdgeName || drawInternalEdgeName || drawCwaEdgeName || drawStreetName) {
245  GUILane* lane1 = dynamic_cast<GUILane*>((*myLanes)[0]);
246  GUILane* lane2 = dynamic_cast<GUILane*>((*myLanes).back());
247  if (lane1 != 0 && lane2 != 0) {
248  Position p = lane1->getShape().positionAtOffset(lane1->getShape().length() / (SUMOReal) 2.);
249  p.add(lane2->getShape().positionAtOffset(lane2->getShape().length() / (SUMOReal) 2.));
250  p.mul(.5);
251  SUMOReal angle = lane1->getShape().rotationDegreeAtOffset(lane1->getShape().length() / (SUMOReal) 2.);
252  angle += 90;
253  if (angle > 90 && angle < 270) {
254  angle -= 180;
255  }
256  if (drawEdgeName) {
257  drawName(p, s.scale, s.edgeName, angle);
258  } else if (drawInternalEdgeName) {
259  drawName(p, s.scale, s.internalEdgeName, angle);
260  } else if (drawCwaEdgeName) {
261  drawName(p, s.scale, s.cwaEdgeName, angle);
262  }
263  if (drawStreetName) {
265  s.streetName.size / s.scale, s.streetName.color, angle);
266  }
267  }
268  }
270  myLock.lock();
271  for (std::set<MSPerson*>::const_iterator i = myPersons.begin(); i != myPersons.end(); ++i) {
272  GUIPerson* person = dynamic_cast<GUIPerson*>(*i);
273  assert(person != 0);
274  person->drawGL(s);
275  }
276  myLock.unlock();
277  }
279  myLock.lock();
280  for (std::set<MSContainer*>::const_iterator i = myContainers.begin(); i != myContainers.end(); ++i) {
281  GUIContainer* container = dynamic_cast<GUIContainer*>(*i);
282  assert(container != 0);
283  container->drawGL(s);
284  }
285  myLock.unlock();
286  }
287 }
288 
289 
290 #ifdef HAVE_INTERNAL
291 void
292 GUIEdge::drawMesoVehicles(const GUIVisualizationSettings& s) const {
293  const GUIVisualizationTextSettings& nameSettings = s.vehicleName;
294  const SUMOReal exaggeration = s.vehicleSize.getExaggeration(s);
295  GUIMEVehicleControl* vehicleControl = GUINet::getGUIInstance()->getGUIMEVehicleControl();
296  if (vehicleControl != 0) {
297  // draw the meso vehicles
298  vehicleControl->secureVehicles();
299  size_t laneIndex = 0;
300  MESegment::Queue queue;
301  for (std::vector<MSLane*>::const_iterator msl = myLanes->begin(); msl != myLanes->end(); ++msl, ++laneIndex) {
302  GUILane* l = static_cast<GUILane*>(*msl);
303  // go through the vehicles
304  SUMOReal segmentOffset = 0; // offset at start of current segment
305  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this);
306  segment != 0; segment = segment->getNextSegment()) {
307  const SUMOReal length = segment->getLength() * segment->getLengthGeometryFactor();
308  if (laneIndex < segment->numQueues()) {
309  // make a copy so we don't have to worry about synchronization
310  queue = segment->getQueue(laneIndex);
311  const SUMOReal avgCarSize = segment->getBruttoOccupancy() / segment->getCarNumber();
312  const SUMOReal avgCarHalfSize = 0.5 * avgCarSize;
313  const size_t queueSize = queue.size();
314  SUMOReal vehiclePosition = segmentOffset + length;
315  // draw vehicles beginning with the leader at the end of the segment
316  SUMOReal xOff = 0;
317  for (size_t i = 0; i < queueSize; ++i) {
318  MSBaseVehicle* veh = queue[queueSize - i - 1];
319  const SUMOReal vehLength = veh->getVehicleType().getLengthWithGap();
320  setVehicleColor(s, veh);
321  while (vehiclePosition < segmentOffset) {
322  // if there is only a single queue for a
323  // multi-lane edge shift vehicles and start
324  // drawing again from the end of the segment
325  vehiclePosition += length;
326  xOff += 2;
327  }
328  const Position p = l->geometryPositionAtOffset(vehiclePosition);
329  const SUMOReal angle = -l->getShape().rotationDegreeAtOffset(l->interpolateLanePosToGeometryPos(vehiclePosition));
330  glPushMatrix();
331  glTranslated(p.x(), p.y(), 0);
332  glRotated(angle, 0, 0, 1);
333  glTranslated(xOff, 0, GLO_VEHICLE);
334  glScaled(exaggeration, vehLength * exaggeration, 1);
335  glBegin(GL_TRIANGLES);
336  glVertex2d(0, 0);
337  glVertex2d(0 - 1.25, 1);
338  glVertex2d(0 + 1.25, 1);
339  glEnd();
340  glPopMatrix();
341  if (nameSettings.show) {
342  glPushMatrix();
343  glRotated(angle, 0, 0, 1);
344  glTranslated(xOff, 0, 0);
345  glRotated(-angle, 0, 0, 1);
346  GLHelper::drawText(veh->getID(),
347  l->geometryPositionAtOffset(vehiclePosition - 0.5 * vehLength),
348  GLO_MAX, nameSettings.size / s.scale, nameSettings.color);
349  glPopMatrix();
350  }
351  vehiclePosition -= vehLength;
352  }
353  }
354  segmentOffset += length;
355  }
356  glPopMatrix();
357  }
358  vehicleControl->releaseVehicles();
359  }
360 }
361 
362 
363 
364 unsigned int
365 GUIEdge::getVehicleNo() const {
366  size_t vehNo = 0;
367  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
368  vehNo += segment->getCarNumber();
369  }
370  return (unsigned int)vehNo;
371 }
372 
373 
374 std::string
375 GUIEdge::getVehicleIDs() const {
376  std::string result = " ";
377  std::vector<const MEVehicle*> vehs;
378  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
379  std::vector<const MEVehicle*> segmentVehs = segment->getVehicles();
380  vehs.insert(vehs.end(), segmentVehs.begin(), segmentVehs.end());
381  }
382  for (std::vector<const MEVehicle*>::const_iterator it = vehs.begin(); it != vehs.end(); it++) {
383  result += (*it)->getID() + " ";
384  }
385  return result;
386 }
387 
388 
389 SUMOReal
390 GUIEdge::getFlow() const {
391  SUMOReal flow = 0;
392  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
393  flow += (SUMOReal) segment->getCarNumber() * segment->getMeanSpeed();
394  }
395  return 3600 * flow / (*myLanes)[0]->getLength();
396 }
397 
398 
399 SUMOReal
400 GUIEdge::getBruttoOccupancy() const {
401  SUMOReal occ = 0;
402  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
403  occ += segment->getBruttoOccupancy();
404  }
405  return occ / (*myLanes)[0]->getLength() / (SUMOReal)(myLanes->size());
406 }
407 
408 
409 SUMOReal
410 GUIEdge::getMeanSpeed() const {
411  SUMOReal v = 0;
412  SUMOReal no = 0;
413  for (MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*this); segment != 0; segment = segment->getNextSegment()) {
414  SUMOReal vehNo = (SUMOReal) segment->getCarNumber();
415  v += vehNo * segment->getMeanSpeed();
416  no += vehNo;
417  }
418  if (no == 0) {
419  return getSpeedLimit();
420  }
421  return v / no;
422 }
423 
424 
425 SUMOReal
426 GUIEdge::getAllowedSpeed() const {
427  return (*myLanes)[0]->getSpeedLimit();
428 }
429 
430 
431 SUMOReal
432 GUIEdge::getRelativeSpeed() const {
433  return getMeanSpeed() / getAllowedSpeed();
434 }
435 
436 
437 void
438 GUIEdge::setColor(const GUIVisualizationSettings& s) const {
439  GLHelper::setColor(s.edgeColorer.getScheme().getColor(getColorValue(s.edgeColorer.getActive())));
440 }
441 
442 
443 SUMOReal
444 GUIEdge::getColorValue(size_t activeScheme) const {
445  switch (activeScheme) {
446  case 1:
447  return gSelected.isSelected(getType(), getGlID());
448  case 2:
449  return getPurpose();
450  case 3:
451  return getAllowedSpeed();
452  case 4:
453  return getBruttoOccupancy();
454  case 5:
455  return getMeanSpeed();
456  case 6:
457  return getFlow();
458  case 7:
459  return getRelativeSpeed();
460  }
461  return 0;
462 }
463 
464 
465 SUMOReal
466 GUIEdge::getScaleValue(size_t activeScheme) const {
467  switch (activeScheme) {
468  case 1:
469  return gSelected.isSelected(getType(), getGlID());
470  case 2:
471  return getAllowedSpeed();
472  case 3:
473  return getBruttoOccupancy();
474  case 4:
475  return getMeanSpeed();
476  case 5:
477  return getFlow();
478  case 6:
479  return getRelativeSpeed();
480  }
481  return 0;
482 }
483 
484 
485 MESegment*
486 GUIEdge::getSegmentAtPosition(const Position& pos) {
487  const PositionVector& shape = getLanes()[0]->getShape();
488  const SUMOReal lanePos = shape.nearest_offset_to_point2D(pos);
489  return MSGlobals::gMesoNet->getSegmentForEdge(*this, lanePos);
490 }
491 
492 
493 void
494 GUIEdge::setVehicleColor(const GUIVisualizationSettings& s, MSBaseVehicle* veh) const {
495  const GUIColorer& c = s.vehicleColorer;
496  if (!GUIVehicle::setFunctionalColor(c.getActive(), veh)) {
497  GLHelper::setColor(c.getScheme().getColor(getVehicleColorValue(c.getActive(), veh)));
498  }
499 }
500 
501 
502 SUMOReal
503 GUIEdge::getVehicleColorValue(size_t activeScheme, MSBaseVehicle* veh) const {
504  switch (activeScheme) {
505  case 8:
506  return veh->getSpeed();
507  case 9:
508  return STEPS2TIME(veh->getWaitingTime());
509  case 10:
510  return 0; // invalid getLastLaneChangeOffset();
511  case 11:
512  return MIN2(veh->getMaxSpeed(), getVehicleMaxSpeed(veh));
513  case 12:
514  return 0; // invalid getCO2Emissions();
515  case 13:
516  return 0; // invalid getCOEmissions();
517  case 14:
518  return 0; // invalid getPMxEmissions();
519  case 15:
520  return 0; // invalid getNOxEmissions();
521  case 16:
522  return 0; // invalid getHCEmissions();
523  case 17:
524  return 0; // invalid getFuelConsumption();
525  case 18:
526  return 0; // invalid getHarmonoise_NoiseEmissions();
527  case 19: // !!! unused!?
528  if (veh->getNumberReroutes() == 0) {
529  return -1;
530  }
531  return veh->getNumberReroutes();
532  case 20:
533  return 0; // invalid gSelected.isSelected(GLO_VEHICLE, getGlID());
534  case 21:
535  return 0; // invalid getBestLaneOffset();
536  case 22:
537  return 0; // invalid getAcceleration();
538  case 23:
539  return 0; // invalid getTimeGap();
540  }
541  return 0;
542 }
543 
544 
545 
546 
547 
548 
549 
550 
551 #endif
552 
553 /****************************************************************************/
554 
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIEdge.cpp:206
std::set< MSPerson * > myPersons
Persons on the edge (only for drawing)
Definition: MSEdge.h:733
unsigned int getNumberReroutes() const
Returns the number of new routes this vehicle got.
GUIVisualizationTextSettings streetName
static bool setFunctionalColor(size_t activeScheme, const MSBaseVehicle *veh)
sets the color according to the current scheme index and some vehicle function
SUMOReal nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
void buildNameCopyPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds entries which allow to copy the name / typed name into the clipboard.
a vehicles
void add(const Position &pos)
Adds the given position to this one.
Definition: Position.h:119
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIEdge.cpp:153
const Position geometryPositionAtOffset(SUMOReal offset) const
Definition: MSLane.h:340
SUMOReal getMaxSpeed() const
Returns the maximum speed.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:186
SUMOReal getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
Stores the information about how to visualize structures.
const EdgeBasicFunction myFunction
the purpose of the edge
Definition: MSEdge.h:714
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUILane.cpp:406
GUIVisualizationTextSettings vehicleName
const std::string & getStreetName() const
Returns the street name of the edge.
Definition: MSEdge.h:264
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
The edge is a macroscopic connector (source/sink)
Definition: MSEdge.h:96
bool isSelected(GUIGlObjectType type, GUIGlID id)
Returns the information whether the object with the given type and id is selected.
GUIVisualizationTextSettings cwaEdgeName
static void drawText(const std::string &text, const Position &pos, const SUMOReal layer, const SUMOReal size, const RGBColor &col=RGBColor::BLACK, const SUMOReal angle=0)
draw Text with given parameters
Definition: GLHelper.cpp:459
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:52
EdgeBasicFunction
Defines possible edge types.
Definition: MSEdge.h:90
static SUMOReal getTotalLength(bool includeInternal, bool eachLane)
Definition: GUIEdge.cpp:115
SUMOReal x() const
Returns the x-position.
Definition: Position.h:63
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.
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.h:115
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:39
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
SUMOReal scale
information about a lane's width (temporary, used for a single view)
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:70
GUIColorer vehicleColorer
The vehicle colorer.
GUIVisualizationTextSettings edgeName
A road/street connecting two junctions (gui-version)
Definition: GUIEdge.h:61
A road/street connecting two junctions.
Definition: MSEdge.h:81
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.h:159
SUMOReal getLength() const
return the length of the edge
Definition: MSEdge.h:535
~GUIEdge()
Destructor.
Definition: GUIEdge.cpp:84
The edge is a district edge.
Definition: MSEdge.h:100
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:442
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
Definition: GUINet.cpp:490
GUIVisualizationTextSettings internalEdgeName
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
A list of positions.
virtual GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIEdge.cpp:170
#define STEPS2TIME(x)
Definition: SUMOTime.h:65
Position positionAtOffset(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
const T getColor(const SUMOReal value) const
T MIN2(T a, T b)
Definition: StdDefs.h:68
float minSize
The minimum size to draw this object.
const std::vector< MSLane * > * myLanes
Container for the edge's lane; should be sorted: (right-hand-traffic) the more left the lane...
Definition: MSEdge.h:708
MSLane & getLane(size_t laneNo)
returns the enumerated lane (!!! why not private with a friend?)
Definition: GUIEdge.cpp:93
void drawName(const Position &pos, const SUMOReal scale, const GUIVisualizationTextSettings &settings, const SUMOReal angle=0) const
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:53
SUMOReal getSpeedLimit() const
Returns the speed limit of the edge The speed limit of the first lane is retured; should probably be...
Definition: MSEdge.cpp:634
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPerson.cpp:179
void unlock()
release mutex lock
Definition: MFXMutex.cpp:96
GUIEdge(const std::string &id, int numericalID, const EdgeBasicFunction function, const std::string &streetName, const std::string &edgeType, int priority)
Constructor.
Definition: GUIEdge.cpp:77
The edge is a pedestrian walking area (a special type of internal edge)
Definition: MSEdge.h:104
static std::vector< GUIGlID > getIDs(bool includeInternal)
Definition: GUIEdge.cpp:100
SUMOReal length() const
Returns the length.
SUMOReal rotationDegreeAtOffset(SUMOReal pos) const
Returns the rotation at the given length.
void add(SUMOReal x, SUMOReal y)
Makes the boundary include the given coordinate.
Definition: Boundary.cpp:76
Boundary & grow(SUMOReal by)
extends the boundary by the given amount
Definition: Boundary.cpp:200
EdgeBasicFunction getPurpose() const
Returns the edge type (EdgeBasicFunction)
Definition: MSEdge.h:235
virtual SUMOReal getSpeed() const =0
Returns the vehicle's current speed.
std::set< MSContainer * > myContainers
Containers on the edge.
Definition: MSEdge.h:736
GUIVisualizationSizeSettings containerSize
MFXMutex myLock
The mutex used to avoid concurrent updates of myPersons/ myContainers.
Definition: GUIEdge.h:212
The edge is a normal street.
Definition: MSEdge.h:94
SUMOReal interpolateLanePosToGeometryPos(SUMOReal lanePos) const
Definition: MSLane.h:334
SUMOReal y() const
Returns the y-position.
Definition: Position.h:68
The edge is a pedestrian crossing (a special type of internal edge)
Definition: MSEdge.h:102
static size_t dictSize()
Returns the number of edges.
Definition: MSEdge.cpp:565
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
Definition: MSBaseVehicle.h:90
The popup menu of a globject.
an edge
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIEdge.cpp:214
std::string myStreetName
the real-world name of this edge (need not be unique)
Definition: MSEdge.h:755
void mul(SUMOReal val)
Multiplies both positions with the given value.
Definition: Position.h:99
void buildSelectionPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to (de)select the object.
GUIVisualizationSizeSettings personSize
void lock()
lock mutex
Definition: MFXMutex.cpp:86
virtual SUMOTime getWaitingTime() const =0
static DictType myDict
Static dictionary to associate string-ids with objects.
Definition: MSEdge.h:784
#define SUMOReal
Definition: config.h:218
static const bool gUseMesoSim
Definition: MSGlobals.h:102
GUIVisualizationSizeSettings vehicleSize
Boundary getBoundary() const
Returns the street's geometry.
Definition: GUIEdge.cpp:129
FXbool locked()
Definition: MFXMutex.h:70
SUMOReal getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the maximum speed the vehicle may use on this edge.
Definition: MSEdge.cpp:641
empty max
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
The edge is an internal edge.
Definition: MSEdge.h:98
void mkItem(const char *name, bool dynamic, ValueSource< unsigned > *src)
Adds a row which obtains its value from an unsigned-ValueSource.
GUISelectedStorage gSelected
A global holder of selected objects.
void closeBuilding()
Closes the building of the table.
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
A window containing a gl-object's parameter.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
static void fill(std::vector< GUIEdge * > &netsWrappers)
Definition: GUIEdge.cpp:140
SUMOReal getExaggeration(const GUIVisualizationSettings &s) const
return the drawing size including exaggeration and constantSize values
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
const std::string & getID() const
Returns the name of the vehicle.
const PositionVector & getShape() const
Definition: GUILane.cpp:699