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++) {
105 myAllowed[0] =
new std::vector<MSLane*>();
106 for (std::vector<MSLane*>::iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
109 for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); ++j) {
110 MSLane* toL = (*j)->getLane();
122 myAllowed[&to] =
new std::vector<MSLane*>();
126 #ifdef HAVE_INTERNAL_LANES
127 toL = (*j)->getViaLane();
145 for (AllowedLanesCont::iterator i1 = (*i2).second.begin(); i1 != (*i2).second.end(); i1++) {
153 for (std::vector<MSLane*>::iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
163 std::vector<MSLane*>::iterator laneIt = find(
myLanes->begin(),
myLanes->end(), lane);
167 return *(laneIt + 1);
173 std::vector<MSLane*>::iterator laneIt = find(
myLanes->begin(),
myLanes->end(), lane);
177 return *(laneIt - 1);
181 const std::vector<MSLane*>*
187 const std::vector<MSLane*>*
193 const std::vector<MSLane*>*
195 AllowedLanesCont::const_iterator it = c.find(dest);
203 const std::vector<MSLane*>*
218 for (AllowedLanesCont::const_iterator i1 =
myAllowed.begin(); i1 !=
myAllowed.end(); ++i1) {
219 const MSEdge* edge = i1->first;
220 const std::vector<MSLane*>* lanes = i1->second;
223 for (std::vector<MSLane*>::const_iterator i2 = lanes->begin(); i2 != lanes->end(); ++i2) {
225 if ((*i2)->allowsVehicleClass(vclass)) {
263 unsigned int noCars = INT_MAX;
264 for (std::vector<MSLane*>::const_iterator i = allowed->begin(); i != allowed->end(); ++i) {
265 if ((*i)->getVehicleNumber() < noCars) {
296 for (std::vector<MSVehicle::LaneQ>::const_iterator i = bl.begin(); i != bl.end(); ++i) {
297 if ((*i).length > bestLength) {
298 bestLength = (*i).length;
301 std::vector<MSLane*>* bestLanes =
new std::vector<MSLane*>();
302 for (std::vector<MSVehicle::LaneQ>::const_iterator i = bl.begin(); i != bl.end(); ++i) {
303 if ((*i).length == bestLength) {
304 bestLanes->push_back((*i).lane);
341 v.
getID() +
"'. Inserting at lane end instead.");
353 MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*
this, pos);
354 MEVehicle* veh =
static_cast<MEVehicle*
>(&v);
356 while (segment != 0 && !result) {
357 result = segment->initialise(veh, time);
358 segment = segment->getNextSegment();
361 result = segment->initialise(veh, time);
369 return insertionLane != 0 && insertionLane->
insertVehicle(static_cast<MSVehicle&>(v));
384 #ifdef HAVE_INTERNAL_LANES
386 MSEdge::getInternalFollowingEdge(
MSEdge* followerAfterInternal)
const {
388 for (std::vector<MSLane*>::const_iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
391 for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); ++j) {
394 if (link->getViaLane() != 0) {
395 return &link->getViaLane()->getEdge();
409 assert(minSpeed > 0);
413 MESegment* first = MSGlobals::gMesoNet->getSegmentForEdge(*
this);
414 unsigned segments = 0;
416 v += first->getMeanSpeed();
417 first = first->getNextSegment();
419 }
while (first != 0);
423 for (std::vector<MSLane*>::iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
424 v += (*i)->getMeanSpeed();
430 v =
MAX2(minSpeed, v);
437 DictType::iterator it =
myDict.find(
id);
455 DictType::iterator it =
myDict.find(
id);
485 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); ++i) {
494 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); ++i) {
495 into.push_back((*i).first);
502 const std::string& rid) {
504 std::istringstream in(desc, std::ios::binary);
517 const std::string& rid) {
518 for (std::vector<std::string>::const_iterator i = desc.begin(); i != desc.end(); ++i) {
522 throw ProcessError(
"The edge '" + *i +
"' within the route " + rid +
" is not known."
523 +
"\n The route can not be build.");
525 into.push_back(edge);
533 return getLanes()[0]->getShape()[-1].distanceTo2D(other->
getLanes()[0]->getShape()[0]);
549 return getLanes()[0]->getSpeedLimit();
556 return getLanes()[0]->getVehicleMaxSpeed(veh);