osrm-backend/include/engine/internal_route_result.hpp

73 lines
2.0 KiB
C++
Raw Normal View History

#ifndef RAW_ROUTE_DATA_H
#define RAW_ROUTE_DATA_H
2011-07-07 13:03:32 -04:00
2016-01-02 11:13:44 -05:00
#include "engine/phantom_node.hpp"
#include "extractor/travel_mode.hpp"
#include "extractor/turn_instructions.hpp"
#include "util/typedefs.hpp"
2012-08-27 11:40:59 -04:00
2016-01-02 11:13:44 -05:00
#include "osrm/coordinate.hpp"
#include <vector>
2016-01-05 10:51:13 -05:00
namespace osrm
{
namespace engine
{
2014-05-07 12:39:16 -04:00
struct PathData
{
PathData()
: node(SPECIAL_NODEID), name_id(INVALID_EDGE_WEIGHT), segment_duration(INVALID_EDGE_WEIGHT),
2016-01-07 19:31:57 -05:00
turn_instruction(extractor::TurnInstruction::NoTurn),
travel_mode(TRAVEL_MODE_INACCESSIBLE)
2014-05-07 12:39:16 -04:00
{
}
PathData(NodeID node,
unsigned name_id,
2016-01-05 10:51:13 -05:00
extractor::TurnInstruction turn_instruction,
EdgeWeight segment_duration,
2016-01-05 10:51:13 -05:00
extractor::TravelMode travel_mode)
: node(node), name_id(name_id), segment_duration(segment_duration),
turn_instruction(turn_instruction), travel_mode(travel_mode)
2014-05-07 12:39:16 -04:00
{
}
2012-08-27 11:40:59 -04:00
NodeID node;
unsigned name_id;
EdgeWeight segment_duration;
2016-01-05 10:51:13 -05:00
extractor::TurnInstruction turn_instruction;
extractor::TravelMode travel_mode : 4;
2012-08-27 11:40:59 -04:00
};
struct InternalRouteResult
2014-05-07 12:39:16 -04:00
{
std::vector<std::vector<PathData>> unpacked_path_segments;
std::vector<PathData> unpacked_alternative;
std::vector<PhantomNodes> segment_end_coordinates;
std::vector<bool> source_traversed_in_reverse;
std::vector<bool> target_traversed_in_reverse;
std::vector<bool> alt_source_traversed_in_reverse;
std::vector<bool> alt_target_traversed_in_reverse;
2014-05-07 12:39:16 -04:00
int shortest_path_length;
int alternative_path_length;
2016-01-04 04:19:25 -05:00
bool is_valid() const { return INVALID_EDGE_WEIGHT != shortest_path_length; }
bool has_alternative() const { return INVALID_EDGE_WEIGHT != alternative_path_length; }
bool is_via_leg(const std::size_t leg) const
{
return (leg != unpacked_path_segments.size() - 1);
}
InternalRouteResult()
: shortest_path_length(INVALID_EDGE_WEIGHT), alternative_path_length(INVALID_EDGE_WEIGHT)
2014-05-07 12:39:16 -04:00
{
}
2011-07-07 13:03:32 -04:00
};
2016-01-05 10:51:13 -05:00
}
}
#endif // RAW_ROUTE_DATA_H