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) {
179 if (index == (
int)
myLanes->size()) {
182 const int resultIndex = index + offset;
183 if (resultIndex >= (
int)
myLanes->size() || resultIndex < 0) {
192 if (predParallel != 0 && nextParallel != 0) {
194 if (connecting != 0) {
201 return (*
myLanes)[resultIndex];
206 const std::vector<MSLane*>*
212 const std::vector<MSLane*>*
218 const std::vector<MSLane*>*
220 AllowedLanesCont::const_iterator it = c.find(dest);
228 const std::vector<MSLane*>*
243 for (AllowedLanesCont::const_iterator i1 =
myAllowed.begin(); i1 !=
myAllowed.end(); ++i1) {
244 const MSEdge* edge = i1->first;
245 const std::vector<MSLane*>* lanes = i1->second;
248 for (std::vector<MSLane*>::const_iterator i2 = lanes->begin(); i2 != lanes->end(); ++i2) {
250 if ((*i2)->allowsVehicleClass(vclass)) {
288 unsigned int noCars = INT_MAX;
289 for (std::vector<MSLane*>::const_iterator i = allowed->begin(); i != allowed->end(); ++i) {
290 if ((*i)->getVehicleNumber() < noCars) {
321 for (std::vector<MSVehicle::LaneQ>::const_iterator i = bl.begin(); i != bl.end(); ++i) {
322 if ((*i).length > bestLength) {
323 bestLength = (*i).length;
326 std::vector<MSLane*>* bestLanes =
new std::vector<MSLane*>();
327 for (std::vector<MSVehicle::LaneQ>::const_iterator i = bl.begin(); i != bl.end(); ++i) {
328 if ((*i).length == bestLength) {
329 bestLanes->push_back((*i).lane);
366 v.
getID() +
"'. Inserting at lane end instead.");
378 MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*
this, pos);
379 MEVehicle* veh =
static_cast<MEVehicle*
>(&v);
381 while (segment != 0 && !result) {
382 result = segment->initialise(veh, time);
383 segment = segment->getNextSegment();
386 result = segment->initialise(veh, time);
394 return insertionLane != 0 && insertionLane->
insertVehicle(static_cast<MSVehicle&>(v));
409 #ifdef HAVE_INTERNAL_LANES
411 MSEdge::getInternalFollowingEdge(
MSEdge* followerAfterInternal)
const {
413 for (std::vector<MSLane*>::const_iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
416 for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); ++j) {
419 if (link->getViaLane() != 0) {
420 return &link->getViaLane()->getEdge();
434 assert(minSpeed > 0);
438 MESegment* first = MSGlobals::gMesoNet->getSegmentForEdge(*
this);
439 unsigned segments = 0;
441 v += first->getMeanSpeed();
442 first = first->getNextSegment();
444 }
while (first != 0);
448 for (std::vector<MSLane*>::iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
449 v += (*i)->getMeanSpeed();
455 v =
MAX2(minSpeed, v);
462 DictType::iterator it =
myDict.find(
id);
478 DictType::iterator it =
myDict.find(
id);
508 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); ++i) {
517 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); ++i) {
518 into.push_back((*i).first);
525 const std::string& rid) {
527 std::istringstream in(desc, std::ios::binary);
540 const std::string& rid) {
541 for (std::vector<std::string>::const_iterator i = desc.begin(); i != desc.end(); ++i) {
545 throw ProcessError(
"The edge '" + *i +
"' within the route " + rid +
" is not known."
546 +
"\n The route can not be build.");
548 into.push_back(edge);
556 return getLanes()[0]->getShape()[-1].distanceTo2D(other->
getLanes()[0]->getShape()[0]);
572 return getLanes()[0]->getSpeedLimit();
579 return getLanes()[0]->getVehicleMaxSpeed(veh);