2014-11-25 10:30:43 -05:00
|
|
|
#ifndef RAW_ROUTE_DATA_H
|
|
|
|
#define RAW_ROUTE_DATA_H
|
2011-07-07 13:03:32 -04:00
|
|
|
|
2016-03-01 16:30:31 -05:00
|
|
|
#include "extractor/guidance/turn_instruction.hpp"
|
2016-04-26 07:27:40 -04:00
|
|
|
#include "extractor/travel_mode.hpp"
|
2016-05-27 15:05:04 -04:00
|
|
|
#include "engine/phantom_node.hpp"
|
2016-01-02 11:13:44 -05:00
|
|
|
#include "osrm/coordinate.hpp"
|
2017-06-19 09:27:46 -04:00
|
|
|
#include "util/guidance/entry_class.hpp"
|
2016-08-17 03:49:19 -04:00
|
|
|
#include "util/guidance/turn_bearing.hpp"
|
2016-06-15 08:38:24 -04:00
|
|
|
#include "util/guidance/turn_lanes.hpp"
|
|
|
|
#include "util/typedefs.hpp"
|
2013-12-17 11:59:44 -05:00
|
|
|
|
2013-08-14 07:41:23 -04:00
|
|
|
#include <vector>
|
|
|
|
|
2016-01-05 10:51:13 -05:00
|
|
|
namespace osrm
|
|
|
|
{
|
|
|
|
namespace engine
|
|
|
|
{
|
|
|
|
|
2014-05-07 12:39:16 -04:00
|
|
|
struct PathData
|
|
|
|
{
|
2016-01-28 10:28:44 -05:00
|
|
|
// id of via node of the turn
|
|
|
|
NodeID turn_via_node;
|
|
|
|
// name of the street that leads to the turn
|
2013-12-08 12:33:53 -05:00
|
|
|
unsigned name_id;
|
2016-05-12 12:50:10 -04:00
|
|
|
// weight that is traveled on the segment until the turn is reached
|
2017-07-24 15:47:05 -04:00
|
|
|
// including the turn weight, if one exists
|
2016-05-12 12:50:10 -04:00
|
|
|
EdgeWeight weight_until_turn;
|
2017-07-24 15:47:05 -04:00
|
|
|
// If this segment immediately preceeds a turn, then duration_of_turn
|
|
|
|
// will contain the weight of the turn. Otherwise it will be 0.
|
|
|
|
EdgeWeight weight_of_turn;
|
|
|
|
// duration that is traveled on the segment until the turn is reached,
|
|
|
|
// including a turn if the segment preceeds one.
|
2016-01-28 10:28:44 -05:00
|
|
|
EdgeWeight duration_until_turn;
|
2017-07-24 15:47:05 -04:00
|
|
|
// If this segment immediately preceeds a turn, then duration_of_turn
|
|
|
|
// will contain the duration of the turn. Otherwise it will be 0.
|
|
|
|
EdgeWeight duration_of_turn;
|
2016-01-28 10:28:44 -05:00
|
|
|
// instruction to execute at the turn
|
2016-03-01 16:30:31 -05:00
|
|
|
extractor::guidance::TurnInstruction turn_instruction;
|
2016-06-15 08:38:24 -04:00
|
|
|
// turn lane data
|
2016-10-04 15:28:13 -04:00
|
|
|
util::guidance::LaneTupleIdPair lane_data;
|
2016-01-28 10:28:44 -05:00
|
|
|
// travel mode of the street that leads to the turn
|
2016-01-05 10:51:13 -05:00
|
|
|
extractor::TravelMode travel_mode : 4;
|
2017-06-27 18:01:05 -04:00
|
|
|
// user defined classed of the street that leads to the turn
|
|
|
|
extractor::ClassData classes;
|
2016-04-26 07:27:40 -04:00
|
|
|
// entry class of the turn, indicating possibility of turns
|
2017-06-19 09:27:46 -04:00
|
|
|
util::guidance::EntryClass entry_class;
|
2016-07-20 08:59:16 -04:00
|
|
|
|
|
|
|
// Source of the speed value on this road segment
|
|
|
|
DatasourceID datasource_id;
|
2016-08-17 03:49:19 -04:00
|
|
|
|
|
|
|
// bearing (as seen from the intersection) pre-turn
|
|
|
|
util::guidance::TurnBearing pre_turn_bearing;
|
|
|
|
// bearing (as seen from the intersection) post-turn
|
|
|
|
util::guidance::TurnBearing post_turn_bearing;
|
2012-08-27 11:40:59 -04:00
|
|
|
};
|
|
|
|
|
2014-11-25 10:30:43 -05:00
|
|
|
struct InternalRouteResult
|
2014-05-07 12:39:16 -04:00
|
|
|
{
|
|
|
|
std::vector<std::vector<PathData>> unpacked_path_segments;
|
|
|
|
std::vector<PhantomNodes> segment_end_coordinates;
|
2014-05-27 10:54:10 -04:00
|
|
|
std::vector<bool> source_traversed_in_reverse;
|
|
|
|
std::vector<bool> target_traversed_in_reverse;
|
2017-05-11 10:36:37 -04:00
|
|
|
EdgeWeight shortest_path_weight = INVALID_EDGE_WEIGHT;
|
2014-03-28 12:13:00 -04:00
|
|
|
|
2017-05-11 10:36:37 -04:00
|
|
|
bool is_valid() const { return INVALID_EDGE_WEIGHT != shortest_path_weight; }
|
2016-01-04 04:19:25 -05:00
|
|
|
|
2014-08-11 14:29:15 -04:00
|
|
|
bool is_via_leg(const std::size_t leg) const
|
|
|
|
{
|
|
|
|
return (leg != unpacked_path_segments.size() - 1);
|
|
|
|
}
|
2017-04-06 08:28:43 -04:00
|
|
|
|
|
|
|
// Note: includes duration for turns, except for at start and end node.
|
|
|
|
EdgeWeight duration() const
|
|
|
|
{
|
|
|
|
EdgeWeight ret{0};
|
|
|
|
|
|
|
|
for (const auto &leg : unpacked_path_segments)
|
|
|
|
for (const auto &segment : leg)
|
|
|
|
ret += segment.duration_until_turn;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2011-07-07 13:03:32 -04:00
|
|
|
};
|
2017-05-11 12:44:48 -04:00
|
|
|
|
|
|
|
struct InternalManyRoutesResult
|
|
|
|
{
|
|
|
|
InternalManyRoutesResult() = default;
|
|
|
|
InternalManyRoutesResult(InternalRouteResult route) : routes{std::move(route)} {}
|
|
|
|
InternalManyRoutesResult(std::vector<InternalRouteResult> routes_) : routes{std::move(routes_)}
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<InternalRouteResult> routes;
|
|
|
|
};
|
2016-01-05 10:51:13 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-25 10:30:43 -05:00
|
|
|
#endif // RAW_ROUTE_DATA_H
|