Puts step maneuver handling into implementation file
This commit is contained in:
parent
3e4b48e206
commit
15752335f4
@ -24,29 +24,11 @@ namespace guidance
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
// FIXME move implementation to cpp
|
||||
inline StepManeuver stepManeuverFromGeometry(extractor::guidance::TurnInstruction instruction,
|
||||
const LegGeometry &leg_geometry,
|
||||
const std::size_t segment_index,
|
||||
const unsigned exit)
|
||||
{
|
||||
auto turn_index = leg_geometry.BackIndex(segment_index);
|
||||
BOOST_ASSERT(turn_index > 0);
|
||||
BOOST_ASSERT(turn_index < leg_geometry.locations.size() - 1);
|
||||
|
||||
// TODO chose a bigger look-a-head to smooth complex geometry
|
||||
const auto pre_turn_coordinate = leg_geometry.locations[turn_index - 1];
|
||||
const auto turn_coordinate = leg_geometry.locations[turn_index];
|
||||
const auto post_turn_coordinate = leg_geometry.locations[turn_index + 1];
|
||||
|
||||
const double pre_turn_bearing =
|
||||
util::coordinate_calculation::bearing(pre_turn_coordinate, turn_coordinate);
|
||||
const double post_turn_bearing =
|
||||
util::coordinate_calculation::bearing(turn_coordinate, post_turn_coordinate);
|
||||
|
||||
return StepManeuver{turn_coordinate, pre_turn_bearing, post_turn_bearing, instruction, exit};
|
||||
}
|
||||
}
|
||||
StepManeuver stepManeuverFromGeometry(extractor::guidance::TurnInstruction instruction,
|
||||
const LegGeometry &leg_geometry,
|
||||
const std::size_t segment_index,
|
||||
const unsigned exit);
|
||||
} // ns detail
|
||||
|
||||
template <typename DataFacadeT>
|
||||
std::vector<RouteStep> assembleSteps(const DataFacadeT &facade,
|
||||
|
@ -5,7 +5,8 @@
|
||||
#include "util/integer_range.hpp"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include <vector>
|
||||
#include <cstdlib>
|
||||
|
@ -4,6 +4,8 @@
|
||||
#include "extractor/travel_mode.hpp"
|
||||
#include "engine/guidance/step_maneuver.hpp"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
39
src/engine/guidance/assemble_steps.cpp
Normal file
39
src/engine/guidance/assemble_steps.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
#include "engine/guidance/assemble_steps.hpp"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace engine
|
||||
{
|
||||
namespace guidance
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
StepManeuver stepManeuverFromGeometry(extractor::guidance::TurnInstruction instruction,
|
||||
const LegGeometry &leg_geometry,
|
||||
const std::size_t segment_index,
|
||||
const unsigned exit)
|
||||
{
|
||||
auto turn_index = leg_geometry.BackIndex(segment_index);
|
||||
BOOST_ASSERT(turn_index > 0);
|
||||
BOOST_ASSERT(turn_index < leg_geometry.locations.size() - 1);
|
||||
|
||||
// TODO chose a bigger look-a-head to smooth complex geometry
|
||||
const auto pre_turn_coordinate = leg_geometry.locations[turn_index - 1];
|
||||
const auto turn_coordinate = leg_geometry.locations[turn_index];
|
||||
const auto post_turn_coordinate = leg_geometry.locations[turn_index + 1];
|
||||
|
||||
const double pre_turn_bearing =
|
||||
util::coordinate_calculation::bearing(pre_turn_coordinate, turn_coordinate);
|
||||
const double post_turn_bearing =
|
||||
util::coordinate_calculation::bearing(turn_coordinate, post_turn_coordinate);
|
||||
|
||||
return StepManeuver{turn_coordinate, pre_turn_bearing, post_turn_bearing, instruction, exit};
|
||||
}
|
||||
} // ns detail
|
||||
} // ns engine
|
||||
} // ns guidance
|
||||
} // ns detail
|
Loading…
Reference in New Issue
Block a user