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) {}
84 for (AllowedLanesCont::iterator i1 = (*i2).second.begin(); i1 != (*i2).second.end(); i1++) {
108 myAllowed[0] =
new std::vector<MSLane*>();
109 for (std::vector<MSLane*>::iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
112 for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); ++j) {
113 MSLane* toL = (*j)->getLane();
125 myAllowed[&to] =
new std::vector<MSLane*>();
129 #ifdef HAVE_INTERNAL_LANES
130 toL = (*j)->getViaLane();
148 for (AllowedLanesCont::iterator i1 = (*i2).second.begin(); i1 != (*i2).second.end(); i1++) {
156 for (std::vector<MSLane*>::iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
166 std::vector<MSLane*>::iterator laneIt = find(
myLanes->begin(),
myLanes->end(), lane);
170 return *(laneIt + 1);
176 std::vector<MSLane*>::iterator laneIt = find(
myLanes->begin(),
myLanes->end(), lane);
180 return *(laneIt - 1);
184 const std::vector<MSLane*>*
190 const std::vector<MSLane*>*
196 const std::vector<MSLane*>*
198 AllowedLanesCont::const_iterator it = c.find(dest);
206 const std::vector<MSLane*>*
221 for (AllowedLanesCont::const_iterator i1 =
myAllowed.begin(); i1 !=
myAllowed.end(); ++i1) {
222 const MSEdge* edge = i1->first;
223 const std::vector<MSLane*>* lanes = i1->second;
226 for (std::vector<MSLane*>::const_iterator i2 = lanes->begin(); i2 != lanes->end(); ++i2) {
228 if ((*i2)->allowsVehicleClass(vclass)) {
266 unsigned int noCars = INT_MAX;
267 for (std::vector<MSLane*>::const_iterator i = allowed->begin(); i != allowed->end(); ++i) {
268 if ((*i)->getVehicleNumber() < noCars) {
299 for (std::vector<MSVehicle::LaneQ>::const_iterator i = bl.begin(); i != bl.end(); ++i) {
300 if ((*i).length > bestLength) {
301 bestLength = (*i).length;
304 std::vector<MSLane*>* bestLanes =
new std::vector<MSLane*>();
305 for (std::vector<MSVehicle::LaneQ>::const_iterator i = bl.begin(); i != bl.end(); ++i) {
306 if ((*i).length == bestLength) {
307 bestLanes->push_back((*i).lane);
344 v.
getID() +
"'. Inserting at lane end instead.");
356 MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*
this, pos);
357 MEVehicle* veh =
static_cast<MEVehicle*
>(&v);
359 while (segment != 0 && !result) {
360 result = segment->initialise(veh, time);
361 segment = segment->getNextSegment();
364 result = segment->initialise(veh, time);
372 return insertionLane != 0 && insertionLane->
insertVehicle(static_cast<MSVehicle&>(v));
387 #ifdef HAVE_INTERNAL_LANES
389 MSEdge::getInternalFollowingEdge(
MSEdge* followerAfterInternal)
const {
391 for (std::vector<MSLane*>::const_iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
394 for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); ++j) {
397 if (link->getViaLane() != 0) {
398 return &link->getViaLane()->getEdge();
412 assert(minSpeed > 0);
416 MESegment* first = MSGlobals::gMesoNet->getSegmentForEdge(*
this);
417 unsigned segments = 0;
419 v += first->getMeanSpeed();
420 first = first->getNextSegment();
422 }
while (first != 0);
426 for (std::vector<MSLane*>::iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
427 v += (*i)->getMeanSpeed();
433 v =
MAX2(minSpeed, v);
440 DictType::iterator it =
myDict.find(
id);
458 DictType::iterator it =
myDict.find(
id);
488 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); ++i) {
497 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); ++i) {
498 into.push_back((*i).first);
505 const std::string& rid) {
507 std::istringstream in(desc, std::ios::binary);
520 const std::string& rid) {
521 for (std::vector<std::string>::const_iterator i = desc.begin(); i != desc.end(); ++i) {
525 throw ProcessError(
"The edge '" + *i +
"' within the route " + rid +
" is not known."
526 +
"\n The route can not be build.");
528 into.push_back(edge);
536 return getLanes()[0]->getShape()[-1].distanceTo2D(other->
getLanes()[0]->getShape()[0]);
552 return getLanes()[0]->getSpeedLimit();
559 return getLanes()[0]->getVehicleMaxSpeed(veh);