MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / applyOverrides

Function applyOverrides

src/engine/guidance/post_processing.cpp:572–724  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

570}
571
572void applyOverrides(const datafacade::BaseDataFacade &facade,
573 std::vector<RouteStep> &steps,
574 const LegGeometry &leg_geometry)
575{
576 // Find overrides that match, and apply them
577 // The +/-1 here are to remove the depart and arrive steps, which
578 // we don't allow updates to
579 for (auto current_step_it = steps.begin(); current_step_it != steps.end(); ++current_step_it)
580 {
581 util::Log(logDEBUG) << "Searching for " << current_step_it->from_id << std::endl;
582 const auto overrides = facade.GetOverridesThatStartAt(current_step_it->from_id);
583 if (overrides.empty())
584 continue;
585 util::Log(logDEBUG) << "~~~~ GOT A HIT, checking the rest ~~~" << std::endl;
586 for (const extractor::ManeuverOverride &maneuver_relation : overrides)
587 {
588 util::Log(logDEBUG) << "Override sequence is ";
589 for (auto &n : maneuver_relation.node_sequence)
590 {
591 util::Log(logDEBUG) << n << " ";
592 }
593 util::Log(logDEBUG) << std::endl;
594 util::Log(logDEBUG) << "Override type is "
595 << osrm::guidance::internalInstructionTypeToString(
596 maneuver_relation.override_type)
597 << std::endl;
598 util::Log(logDEBUG) << "Override direction is "
599 << osrm::guidance::instructionModifierToString(
600 maneuver_relation.direction)
601 << std::endl;
602
603 util::Log(logDEBUG) << "Route sequence is ";
604 for (auto it = current_step_it; it != steps.end(); ++it)
605 {
606 util::Log(logDEBUG) << it->from_id << " ";
607 }
608 util::Log(logDEBUG) << std::endl;
609
610 auto search_iter = maneuver_relation.node_sequence.begin();
611 auto route_iter = current_step_it;
612 while (search_iter != maneuver_relation.node_sequence.end())
613 {
614 if (route_iter == steps.end())
615 break;
616
617 if (*search_iter == route_iter->from_id)
618 {
619 ++search_iter;
620 ++route_iter;
621 continue;
622 }
623 // Skip over duplicated EBNs in the step array
624 // EBNs are sometime duplicated because guidance code inserts
625 // "fake" steps that it later removes. This hasn't happened yet
626 // at this point, but we can safely just skip past the dupes.
627 if ((route_iter - 1)->from_id == route_iter->from_id)
628 {
629 ++route_iter;

Callers 1

MakeLegsMethod · 0.85

Calls 9

LogClass · 0.85
hasWaypointTypeFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
GetCoordinateOfNodeMethod · 0.45

Tested by

no test coverage detected