50 #include <mesosim/MELoop.h>
51 #include <mesosim/MESegment.h>
52 #include <mesosim/MEVehicle.h>
55 #ifdef CHECK_MEMORY_LEAKS
57 #endif // CHECK_MEMORY_LEAKS
72 const std::string& streetName) :
73 Named(id), myNumericalID(numericalID), myLanes(0),
74 myLaneChanger(0), myFunction(function), myVaporizationRequests(0),
75 myLastFailedInsertionTime(-1), myStreetName(streetName), myAmRoundabout(false) {}
84 for (AllowedLanesCont::iterator i1 = (*i2).second.begin(); i1 != (*i2).second.end(); i1++) {
115 for (std::vector<MSLane*>::iterator it =
myLanes->begin(); it !=
myLanes->end(); ++it) {
129 myAllowed[0] =
new std::vector<MSLane*>();
130 for (std::vector<MSLane*>::iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
133 for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); ++j) {
134 MSLane* toL = (*j)->getLane();
146 myAllowed[&to] =
new std::vector<MSLane*>();
150 #ifdef HAVE_INTERNAL_LANES
151 toL = (*j)->getViaLane();
169 for (AllowedLanesCont::iterator i1 = (*i2).second.begin(); i1 != (*i2).second.end(); i1++) {
177 for (std::vector<MSLane*>::iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
200 if (index == (
int)
myLanes->size()) {
203 const int resultIndex = index + offset;
204 if (resultIndex >= (
int)
myLanes->size() || resultIndex < 0) {
207 return (*
myLanes)[resultIndex];
212 const std::vector<MSLane*>*
218 const std::vector<MSLane*>*
224 const std::vector<MSLane*>*
226 AllowedLanesCont::const_iterator it = c.find(dest);
234 const std::vector<MSLane*>*
249 for (AllowedLanesCont::const_iterator i1 =
myAllowed.begin(); i1 !=
myAllowed.end(); ++i1) {
250 const MSEdge* edge = i1->first;
251 const std::vector<MSLane*>* lanes = i1->second;
254 for (std::vector<MSLane*>::const_iterator i2 = lanes->begin(); i2 != lanes->end(); ++i2) {
256 if ((*i2)->allowsVehicleClass(vclass)) {
294 unsigned int noCars = INT_MAX;
295 for (std::vector<MSLane*>::const_iterator i = allowed->begin(); i != allowed->end(); ++i) {
296 if ((*i)->getVehicleNumber() < noCars) {
327 for (std::vector<MSVehicle::LaneQ>::const_iterator i = bl.begin(); i != bl.end(); ++i) {
328 if ((*i).length > bestLength) {
329 bestLength = (*i).length;
332 std::vector<MSLane*>* bestLanes =
new std::vector<MSLane*>();
333 for (std::vector<MSVehicle::LaneQ>::const_iterator i = bl.begin(); i != bl.end(); ++i) {
334 if ((*i).length == bestLength) {
335 bestLanes->push_back((*i).lane);
372 v.
getID() +
"'. Inserting at lane end instead.");
384 MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*
this, pos);
385 MEVehicle* veh =
static_cast<MEVehicle*
>(&v);
387 while (segment != 0 && !result) {
388 result = segment->initialise(veh, time);
389 segment = segment->getNextSegment();
392 result = segment->initialise(veh, time);
400 return insertionLane != 0 && insertionLane->
insertVehicle(static_cast<MSVehicle&>(v));
413 #ifdef HAVE_INTERNAL_LANES
415 MSEdge::getInternalFollowingEdge(
MSEdge* followerAfterInternal)
const {
417 for (std::vector<MSLane*>::const_iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
420 for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); ++j) {
423 if (link->getViaLane() != 0) {
424 return &link->getViaLane()->getEdge();
438 assert(minSpeed > 0);
442 MESegment* first = MSGlobals::gMesoNet->getSegmentForEdge(*
this);
443 unsigned segments = 0;
445 v += first->getMeanSpeed();
446 first = first->getNextSegment();
448 }
while (first != 0);
452 for (std::vector<MSLane*>::iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
453 v += (*i)->getMeanSpeed();
459 v =
MAX2(minSpeed, v);
466 DictType::iterator it =
myDict.find(
id);
482 DictType::iterator it =
myDict.find(
id);
512 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); ++i) {
521 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); ++i) {
522 into.push_back((*i).first);
529 const std::string& rid) {
531 std::istringstream in(desc, std::ios::binary);
544 const std::string& rid) {
545 for (std::vector<std::string>::const_iterator i = desc.begin(); i != desc.end(); ++i) {
549 throw ProcessError(
"The edge '" + *i +
"' within the route " + rid +
" is not known."
550 +
"\n The route can not be build.");
552 into.push_back(edge);
560 return getLanes()[0]->getShape()[-1].distanceTo2D(other->
getLanes()[0]->getShape()[0]);
576 return getLanes()[0]->getSpeedLimit();
583 return getLanes()[0]->getVehicleMaxSpeed(veh);