51 #include <mesosim/MELoop.h>
52 #include <mesosim/MESegment.h>
53 #include <mesosim/MEVehicle.h>
56 #ifdef CHECK_MEMORY_LEAKS
58 #endif // CHECK_MEMORY_LEAKS
73 const std::string& streetName,
74 const std::string& edgeType) :
75 Named(id), myNumericalID(numericalID), myLanes(0),
76 myLaneChanger(0), myFunction(function), myVaporizationRequests(0),
77 myLastFailedInsertionTime(-1),
78 myFromJunction(0), myToJunction(0),
79 myStreetName(streetName),
81 myAmRoundabout(false) {}
90 for (AllowedLanesCont::iterator i1 = (*i2).second.begin(); i1 != (*i2).second.end(); i1++) {
121 for (std::vector<MSLane*>::iterator it =
myLanes->begin(); it !=
myLanes->end(); ++it) {
135 myAllowed[0] =
new std::vector<MSLane*>();
136 for (std::vector<MSLane*>::iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
139 for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); ++j) {
140 MSLane* toL = (*j)->getLane();
152 myAllowed[&to] =
new std::vector<MSLane*>();
156 #ifdef HAVE_INTERNAL_LANES
157 toL = (*j)->getViaLane();
177 for (AllowedLanesCont::iterator i1 = (*i2).second.begin(); i1 != (*i2).second.end(); i1++) {
185 for (std::vector<MSLane*>::iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
208 if (index == (
int)
myLanes->size()) {
211 const int resultIndex = index + offset;
212 if (resultIndex >= (
int)
myLanes->size() || resultIndex < 0) {
215 return (*
myLanes)[resultIndex];
220 const std::vector<MSLane*>*
226 const std::vector<MSLane*>*
232 const std::vector<MSLane*>*
234 AllowedLanesCont::const_iterator it = c.find(dest);
242 const std::vector<MSLane*>*
257 for (AllowedLanesCont::const_iterator i1 =
myAllowed.begin(); i1 !=
myAllowed.end(); ++i1) {
258 const MSEdge* edge = i1->first;
259 const std::vector<MSLane*>* lanes = i1->second;
262 for (std::vector<MSLane*>::const_iterator i2 = lanes->begin(); i2 != lanes->end(); ++i2) {
264 if ((*i2)->allowsVehicleClass(vclass)) {
302 unsigned int noCars = INT_MAX;
303 for (std::vector<MSLane*>::const_iterator i = allowed->begin(); i != allowed->end(); ++i) {
304 if ((*i)->getVehicleNumber() < noCars) {
333 const std::vector<MSVehicle::LaneQ>& bl = veh.
getBestLanes();
335 for (std::vector<MSVehicle::LaneQ>::const_iterator i = bl.begin(); i != bl.end(); ++i) {
336 if ((*i).length > bestLength) {
337 bestLength = (*i).length;
340 std::vector<MSLane*>* bestLanes =
new std::vector<MSLane*>();
341 for (std::vector<MSVehicle::LaneQ>::const_iterator i = bl.begin(); i != bl.end(); ++i) {
342 if ((*i).length == bestLength) {
343 bestLanes->push_back((*i).lane);
380 v.
getID() +
"'. Inserting at lane end instead.");
392 MESegment* segment = MSGlobals::gMesoNet->getSegmentForEdge(*
this, pos);
393 MEVehicle* veh =
static_cast<MEVehicle*
>(&v);
395 while (segment != 0 && !result) {
396 result = segment->initialise(veh, time);
397 segment = segment->getNextSegment();
400 result = segment->initialise(veh, time);
408 return insertionLane != 0 && insertionLane->
insertVehicle(static_cast<MSVehicle&>(v));
421 #ifdef HAVE_INTERNAL_LANES
423 MSEdge::getInternalFollowingEdge(
MSEdge* followerAfterInternal)
const {
425 for (std::vector<MSLane*>::const_iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
428 for (MSLinkCont::const_iterator j = lc.begin(); j != lc.end(); ++j) {
431 if (link->getViaLane() != 0) {
432 return &link->getViaLane()->getEdge();
446 assert(minSpeed > 0);
450 MESegment* first = MSGlobals::gMesoNet->getSegmentForEdge(*
this);
451 unsigned segments = 0;
453 v += first->getMeanSpeed();
454 first = first->getNextSegment();
456 }
while (first != 0);
460 for (std::vector<MSLane*>::iterator i =
myLanes->begin(); i !=
myLanes->end(); ++i) {
461 v += (*i)->getMeanSpeed();
467 v =
MAX2(minSpeed, v);
474 DictType::iterator it =
myDict.find(
id);
490 DictType::iterator it =
myDict.find(
id);
520 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); ++i) {
529 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); ++i) {
530 into.push_back((*i).first);
537 const std::string& rid) {
539 std::istringstream in(desc, std::ios::binary);
552 const std::string& rid) {
553 for (std::vector<std::string>::const_iterator i = desc.begin(); i != desc.end(); ++i) {
557 throw ProcessError(
"The edge '" + *i +
"' within the route " + rid +
" is not known."
558 +
"\n The route can not be build.");
560 into.push_back(edge);
568 return getLanes()[0]->getShape()[-1].distanceTo2D(other->
getLanes()[0]->getShape()[0]);
584 return getLanes()[0]->getSpeedLimit();
591 return getLanes()[0]->getVehicleMaxSpeed(veh);
595 std::vector<MSPerson*>