43 #ifdef CHECK_MEMORY_LEAKS
45 #endif // CHECK_MEMORY_LEAKS
57 #ifndef HAVE_INTERNAL_LANES
63 myRequestIdx(0), myRespondIdx(0),
64 myState(state), myDirection(dir), myLength(length) {}
70 myRequestIdx(0), myRespondIdx(0),
71 myState(state), myDirection(dir), myLength(length),
82 const std::vector<MSLink*>& foeLinks,
83 const std::vector<MSLane*>& foeLanes,
84 MSLane* internalLaneBefore) {
91 #ifdef HAVE_INTERNAL_LANES
92 if (internalLaneBefore != 0) {
94 for (std::vector<MSLane*>::const_iterator it_lane =
myFoeLanes.begin(); it_lane !=
myFoeLanes.end(); ++it_lane) {
97 myLengthsBehindCrossing.push_back(std::make_pair(0, 0));
101 if (intersections1.size() == 0) {
102 intersections1.push_back(0);
103 }
else if (intersections1.size() > 1) {
104 std::sort(intersections1.begin(), intersections1.end());
106 std::vector<SUMOReal> intersections2 = (*it_lane)->getShape().intersectsAtLengths2D(internalLaneBefore->
getShape());
108 if (intersections2.size() == 0) {
109 intersections2.push_back(0);
110 }
else if (intersections2.size() > 1) {
111 std::sort(intersections2.begin(), intersections2.end());
113 myLengthsBehindCrossing.push_back(std::make_pair(
114 internalLaneBefore->
getLength() - intersections1.back(),
115 (*it_lane)->getLength() - intersections2.back()));
135 const bool setRequest,
const SUMOTime arrivalTimeBraking,
const SUMOReal arrivalSpeedBraking,
const SUMOTime waitingTime) {
139 arrivalTimeBraking, arrivalSpeedBraking, waitingTime)));
153 if ((*i)->isBlockingAnyone()) {
169 std::map<const SUMOVehicle*, ApproachingVehicleInformation>::const_iterator i =
myApproachingVehicles.find(veh);
180 return arrivalTime +
TIME2STEPS((
getLength() + vehicleLength) / (0.5 * (arrivalSpeed + leaveSpeed)));
187 std::vector<const SUMOVehicle*>* collectFoes)
const {
206 if ((*i)->blockedAtTime(arrivalTime, leaveTime, arrivalSpeed, leaveSpeed,
myLane == (*i)->getLane(),
207 impatience, decel, waitingTime, collectFoes)) {
218 std::vector<const SUMOVehicle*>* collectFoes)
const {
220 if (!i->second.willPass) {
224 assert(waitingTime > 0);
225 if (waitingTime > i->second.waitingTime) {
228 if (waitingTime == i->second.waitingTime && arrivalTime < i->second.arrivalTime) {
232 const SUMOTime foeArrivalTime = (
SUMOTime)((1.0 - impatience) * i->second.arrivalTime + impatience * i->second.arrivalTimeBraking);
233 if (i->second.leavingTime < arrivalTime) {
235 if (sameTargetLane && (arrivalTime - i->second.leavingTime <
myLookaheadTime
237 i->first->getVehicleType().getCarFollowModel().getMaxDecel(), decel))) {
238 if (collectFoes == 0) {
241 collectFoes->push_back(i->first);
244 }
else if (foeArrivalTime > leaveTime) {
248 decel, i->first->getVehicleType().getCarFollowModel().getMaxDecel()))) {
249 if (collectFoes == 0) {
252 collectFoes->push_back(i->first);
257 if (collectFoes == 0) {
260 collectFoes->push_back(i->first);
281 assert(distLeft > 0);
292 if ((*i)->blockedAtTime(arrivalTime, leaveTime, speed, speed,
myLane == (*i)->getLane(), 0, decel, 0)) {
297 if ((*i)->getVehicleNumber() > 0 || (*i)->getPartialOccupator() != 0) {
328 #ifdef HAVE_INTERNAL_LANES
329 const std::string via = getViaLane() == 0 ?
"" : getViaLane()->getID();
331 const std::string via =
"";
335 std::vector<std::pair<SUMOTime, const SUMOVehicle*> > toSort;
337 toSort.push_back(std::make_pair(it->second.arrivalTime, it->first));
339 std::sort(toSort.begin(), toSort.end());
340 for (std::vector<std::pair<SUMOTime, const SUMOVehicle*> >::const_iterator it = toSort.begin(); it != toSort.end(); ++it) {
356 #ifdef HAVE_INTERNAL_LANES
358 MSLink::getViaLane()
const {
359 return myJunctionInlane;
370 for (
size_t i = 0; i <
myFoeLanes.size(); ++i) {
373 const SUMOReal distToCrossing = dist - myLengthsBehindCrossing[i].first;
375 if (distToCrossing < 0) {
378 const SUMOReal foeDistToCrossing = foeLane->
getLength() - myLengthsBehindCrossing[i].second;
387 const bool cannotIgnore = contLane || sameTarget;
390 for (MSLane::VehCont::const_iterator it_veh = vehicles.begin(); it_veh != vehicles.end(); ++it_veh) {
400 const SUMOReal leaderBackDist = foeDistToCrossing - leaderBack;
402 if (leaderBackDist < 0) {
407 gap = distToCrossing - leaderBackDist - (sameTarget ? minGap : 0);
409 result.push_back(std::make_pair(leader, gap));
424 if (leaderBackDist < 0) {
429 gap = distToCrossing - leaderBackDist - (sameTarget ? minGap : 0);
431 result.push_back(std::make_pair(leader, gap));
443 #ifdef HAVE_INTERNAL_LANES
444 if (myJunctionInlane != 0) {
445 return myJunctionInlane;