Puts step maneuver handling into implementation file

This commit is contained in:
Daniel J. Hofmann 2016-03-03 15:34:13 +01:00 committed by Patrick Niklaus
parent 3e4b48e206
commit 15752335f4
4 changed files with 48 additions and 24 deletions

View File

@ -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,

View File

@ -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>

View File

@ -4,6 +4,8 @@
#include "extractor/travel_mode.hpp"
#include "engine/guidance/step_maneuver.hpp"
#include <cstddef>
#include <string>
#include <vector>

View 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