Add namespace around all files
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "engine/segment_information.hpp"
|
||||
#include "util/integer_range.hpp"
|
||||
#include "util/coordinate_calculation.hpp"
|
||||
#include "util/container.hpp"
|
||||
#include "extractor/turn_instructions.hpp"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
@@ -124,7 +125,7 @@ void SegmentList<DataFacadeT>::InitRoute(const PhantomNode &node, const bool tra
|
||||
const auto travel_mode =
|
||||
(traversed_in_reverse ? node.backward_travel_mode : node.forward_travel_mode);
|
||||
|
||||
AppendSegment(node.location, PathData(0, node.name_id, TurnInstruction::HeadOn,
|
||||
AppendSegment(node.location, PathData(0, node.name_id, extractor::TurnInstruction::HeadOn,
|
||||
segment_duration, travel_mode));
|
||||
}
|
||||
|
||||
@@ -142,10 +143,10 @@ void SegmentList<DataFacadeT>::AddLeg(const std::vector<PathData> &leg_data,
|
||||
|
||||
const EdgeWeight segment_duration =
|
||||
(traversed_in_reverse ? target_node.reverse_weight : target_node.forward_weight);
|
||||
const TravelMode travel_mode =
|
||||
const extractor::TravelMode travel_mode =
|
||||
(traversed_in_reverse ? target_node.backward_travel_mode : target_node.forward_travel_mode);
|
||||
segments.emplace_back(target_node.location, target_node.name_id, segment_duration, 0.f,
|
||||
is_via_leg ? TurnInstruction::ReachViaLocation : TurnInstruction::NoTurn,
|
||||
is_via_leg ? extractor::TurnInstruction::ReachViaLocation : extractor::TurnInstruction::NoTurn,
|
||||
true, true, travel_mode);
|
||||
}
|
||||
|
||||
@@ -187,12 +188,12 @@ void SegmentList<DataFacadeT>::AppendSegment(const FixedPointCoordinate &coordin
|
||||
}
|
||||
|
||||
// make sure mode changes are announced, even when there otherwise is no turn
|
||||
const auto getTurn = [](const PathData &path_point, const TravelMode previous_mode)
|
||||
const auto getTurn = [](const PathData &path_point, const extractor::TravelMode previous_mode)
|
||||
{
|
||||
if (TurnInstruction::NoTurn == path_point.turn_instruction and
|
||||
if (extractor::TurnInstruction::NoTurn == path_point.turn_instruction and
|
||||
previous_mode != path_point.travel_mode and path_point.segment_duration > 0)
|
||||
{
|
||||
return TurnInstruction::GoStraight;
|
||||
return extractor::TurnInstruction::GoStraight;
|
||||
}
|
||||
return path_point.turn_instruction;
|
||||
};
|
||||
@@ -215,11 +216,11 @@ void SegmentList<DataFacadeT>::Finalize(const bool extract_alternative,
|
||||
return;
|
||||
|
||||
segments[0].length = 0.f;
|
||||
for (const auto i : osrm::irange<std::size_t>(1, segments.size()))
|
||||
for (const auto i : util::irange<std::size_t>(1, segments.size()))
|
||||
{
|
||||
// move down names by one, q&d hack
|
||||
segments[i - 1].name_id = segments[i].name_id;
|
||||
segments[i].length = coordinate_calculation::greatCircleDistance(segments[i - 1].location,
|
||||
segments[i].length = util::coordinate_calculation::greatCircleDistance(segments[i - 1].location,
|
||||
segments[i].location);
|
||||
}
|
||||
|
||||
@@ -229,7 +230,7 @@ void SegmentList<DataFacadeT>::Finalize(const bool extract_alternative,
|
||||
|
||||
double path_length = 0;
|
||||
|
||||
for (const auto i : osrm::irange<std::size_t>(1, segments.size()))
|
||||
for (const auto i : util::irange<std::size_t>(1, segments.size()))
|
||||
{
|
||||
path_length += segments[i].length;
|
||||
segment_length += segments[i].length;
|
||||
@@ -237,7 +238,7 @@ void SegmentList<DataFacadeT>::Finalize(const bool extract_alternative,
|
||||
segments[segment_start_index].length = segment_length;
|
||||
segments[segment_start_index].duration = segment_duration;
|
||||
|
||||
if (TurnInstruction::NoTurn != segments[i].turn_instruction)
|
||||
if (extractor::TurnInstruction::NoTurn != segments[i].turn_instruction)
|
||||
{
|
||||
BOOST_ASSERT(segments[i].necessary);
|
||||
segment_length = 0;
|
||||
@@ -257,14 +258,14 @@ void SegmentList<DataFacadeT>::Finalize(const bool extract_alternative,
|
||||
{
|
||||
segments.pop_back();
|
||||
segments.back().necessary = true;
|
||||
segments.back().turn_instruction = TurnInstruction::NoTurn;
|
||||
segments.back().turn_instruction = extractor::TurnInstruction::NoTurn;
|
||||
}
|
||||
|
||||
if (segments.size() > 2 && std::numeric_limits<float>::epsilon() > segments.front().length &&
|
||||
!(segments.begin() + 1)->is_via_location)
|
||||
{
|
||||
segments.erase(segments.begin());
|
||||
segments.front().turn_instruction = TurnInstruction::HeadOn;
|
||||
segments.front().turn_instruction = extractor::TurnInstruction::HeadOn;
|
||||
segments.front().necessary = true;
|
||||
}
|
||||
|
||||
@@ -287,9 +288,9 @@ void SegmentList<DataFacadeT>::Finalize(const bool extract_alternative,
|
||||
via_indices.push_back(necessary_segments);
|
||||
|
||||
const double post_turn_bearing =
|
||||
coordinate_calculation::bearing(first.location, second.location);
|
||||
util::coordinate_calculation::bearing(first.location, second.location);
|
||||
const double pre_turn_bearing =
|
||||
coordinate_calculation::bearing(second.location, first.location);
|
||||
util::coordinate_calculation::bearing(second.location, first.location);
|
||||
first.post_turn_bearing = static_cast<short>(post_turn_bearing * 10);
|
||||
first.pre_turn_bearing = static_cast<short>(pre_turn_bearing * 10);
|
||||
|
||||
@@ -297,7 +298,7 @@ void SegmentList<DataFacadeT>::Finalize(const bool extract_alternative,
|
||||
};
|
||||
|
||||
// calculate which segments are necessary and update segments for bearings
|
||||
osrm::for_each_pair(segments, markNecessarySegments);
|
||||
util::for_each_pair(segments, markNecessarySegments);
|
||||
via_indices.push_back(necessary_segments);
|
||||
|
||||
BOOST_ASSERT(via_indices.size() >= 2);
|
||||
|
||||
@@ -22,10 +22,10 @@ namespace engine
|
||||
namespace guidance
|
||||
{
|
||||
template< typename DataFacadeT >
|
||||
inline osrm::json::Array
|
||||
inline util::json::Array
|
||||
AnnotateRoute(const std::vector<SegmentInformation> &route_segments, DataFacadeT* facade)
|
||||
{
|
||||
osrm::json::Array json_instruction_array;
|
||||
util::json::Array json_instruction_array;
|
||||
if( route_segments.empty() )
|
||||
return json_instruction_array;
|
||||
// Segment information has following format:
|
||||
@@ -45,11 +45,11 @@ AnnotateRoute(const std::vector<SegmentInformation> &route_segments, DataFacadeT
|
||||
//Generate annotations for every segment
|
||||
for (const SegmentInformation &segment : route_segments)
|
||||
{
|
||||
osrm::json::Array json_instruction_row;
|
||||
TurnInstruction current_instruction = segment.turn_instruction;
|
||||
if (TurnInstructionsClass::TurnIsNecessary(current_instruction))
|
||||
util::json::Array json_instruction_row;
|
||||
extractor::TurnInstruction current_instruction = segment.turn_instruction;
|
||||
if (extractor::TurnInstructionsClass::TurnIsNecessary(current_instruction))
|
||||
{
|
||||
if (TurnInstruction::EnterRoundAbout == current_instruction)
|
||||
if (extractor::TurnInstruction::EnterRoundAbout == current_instruction)
|
||||
{
|
||||
round_about.name_id = segment.name_id;
|
||||
round_about.start_index = necessary_segments_running_index;
|
||||
@@ -57,10 +57,10 @@ AnnotateRoute(const std::vector<SegmentInformation> &route_segments, DataFacadeT
|
||||
else
|
||||
{
|
||||
std::string current_turn_instruction;
|
||||
if (TurnInstruction::LeaveRoundAbout == current_instruction)
|
||||
if (extractor::TurnInstruction::LeaveRoundAbout == current_instruction)
|
||||
{
|
||||
temp_instruction =
|
||||
std::to_string(cast::enum_to_underlying(TurnInstruction::EnterRoundAbout));
|
||||
std::to_string(util::cast::enum_to_underlying(extractor::TurnInstruction::EnterRoundAbout));
|
||||
current_turn_instruction += temp_instruction;
|
||||
current_turn_instruction += "-";
|
||||
temp_instruction = std::to_string(round_about.leave_at_exit + 1);
|
||||
@@ -70,7 +70,7 @@ AnnotateRoute(const std::vector<SegmentInformation> &route_segments, DataFacadeT
|
||||
else
|
||||
{
|
||||
temp_instruction =
|
||||
std::to_string(cast::enum_to_underlying(current_instruction));
|
||||
std::to_string(util::cast::enum_to_underlying(current_instruction));
|
||||
current_turn_instruction += temp_instruction;
|
||||
}
|
||||
json_instruction_row.values.emplace_back(std::move(current_turn_instruction));
|
||||
@@ -84,7 +84,7 @@ AnnotateRoute(const std::vector<SegmentInformation> &route_segments, DataFacadeT
|
||||
|
||||
// post turn bearing
|
||||
const double post_turn_bearing_value = (segment.post_turn_bearing / 10.);
|
||||
json_instruction_row.values.push_back(bearing::get(post_turn_bearing_value));
|
||||
json_instruction_row.values.push_back(util::bearing::get(post_turn_bearing_value));
|
||||
json_instruction_row.values.push_back(
|
||||
static_cast<std::uint32_t>(std::round(post_turn_bearing_value)));
|
||||
|
||||
@@ -92,14 +92,14 @@ AnnotateRoute(const std::vector<SegmentInformation> &route_segments, DataFacadeT
|
||||
|
||||
// pre turn bearing
|
||||
const double pre_turn_bearing_value = (segment.pre_turn_bearing / 10.);
|
||||
json_instruction_row.values.push_back(bearing::get(pre_turn_bearing_value));
|
||||
json_instruction_row.values.push_back(util::bearing::get(pre_turn_bearing_value));
|
||||
json_instruction_row.values.push_back(
|
||||
static_cast<std::uint32_t>(std::round(pre_turn_bearing_value)));
|
||||
|
||||
json_instruction_array.values.push_back(json_instruction_row);
|
||||
}
|
||||
}
|
||||
else if (TurnInstruction::StayOnRoundAbout == current_instruction)
|
||||
else if (extractor::TurnInstruction::StayOnRoundAbout == current_instruction)
|
||||
{
|
||||
++round_about.leave_at_exit;
|
||||
}
|
||||
@@ -109,18 +109,18 @@ AnnotateRoute(const std::vector<SegmentInformation> &route_segments, DataFacadeT
|
||||
}
|
||||
}
|
||||
|
||||
osrm::json::Array json_last_instruction_row;
|
||||
util::json::Array json_last_instruction_row;
|
||||
temp_instruction =
|
||||
std::to_string(cast::enum_to_underlying(TurnInstruction::ReachedYourDestination));
|
||||
std::to_string(util::cast::enum_to_underlying(extractor::TurnInstruction::ReachedYourDestination));
|
||||
json_last_instruction_row.values.emplace_back( std::move(temp_instruction));
|
||||
json_last_instruction_row.values.push_back("");
|
||||
json_last_instruction_row.values.push_back(0);
|
||||
json_last_instruction_row.values.push_back(necessary_segments_running_index - 1);
|
||||
json_last_instruction_row.values.push_back(0);
|
||||
json_last_instruction_row.values.push_back("0m");
|
||||
json_last_instruction_row.values.push_back(bearing::get(0.0));
|
||||
json_last_instruction_row.values.push_back(util::bearing::get(0.0));
|
||||
json_last_instruction_row.values.push_back(0.);
|
||||
json_last_instruction_row.values.push_back(bearing::get(0.0));
|
||||
json_last_instruction_row.values.push_back(util::bearing::get(0.0));
|
||||
json_last_instruction_row.values.push_back(0.);
|
||||
json_instruction_array.values.emplace_back(std::move(json_last_instruction_row));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user