Skip to content

Commit

Permalink
different arrivalpos for intermediate car drives, refs #3843
Browse files Browse the repository at this point in the history
  • Loading branch information
behrisch committed Feb 27, 2018
1 parent 428b50a commit cae8329
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/microsim/MSRouteHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1136,14 +1136,18 @@ MSRouteHandler::addPersonTrip(const SUMOSAXAttributes& attrs) {
for (std::vector<MSNet::MSIntermodalRouter::TripItem>::iterator it = result.begin(); it != result.end(); ++it) {
if (!it->edges.empty()) {
bs = MSNet::getInstance()->getStoppingPlace(it->destStop, SUMO_TAG_BUS_STOP);
double localArrivalPos = bs != 0 ? bs->getAccessPos(it->edges.back()) : it->edges.back()->getLength() / 2.;
double localArrivalPos = bs != nullptr ? bs->getAccessPos(it->edges.back()) : it->edges.back()->getLength() / 2.;
if (it + 1 == result.end() && attrs.hasAttribute(SUMO_ATTR_ARRIVALPOS)) {
localArrivalPos = arrivalPos;
}
if (it->line == "") {
const double depPos = myActivePlan->back()->getDestinationStop() != 0 ? myActivePlan->back()->getDestinationStop()->getAccessPos(it->edges.front()) : departPos;
myActivePlan->push_back(new MSPerson::MSPersonStage_Walking(myVehicleParameter->id, it->edges, bs, duration, speed, depPos, localArrivalPos, departPosLat));
} else if (vehicle != 0 && it->line == vehicle->getID()) {
if (bs == nullptr && it + 1 != result.end()) {
// we have no defined endpoint and are in the middle of the trip, drive as far as possible
localArrivalPos = it->edges.back()->getLength();
}
myActivePlan->push_back(new MSPerson::MSPersonStage_Driving(*it->edges.back(), bs, localArrivalPos, std::vector<std::string>({ it->line })));
vehicle->replaceRouteEdges(it->edges, true);
vehicle->setArrivalPos(localArrivalPos);
Expand Down

0 comments on commit cae8329

Please sign in to comment.