Remove data duplicates in .node file
This commit is contained in:
committed by
Patrick Niklaus
parent
8934167e76
commit
ca6b1b39b7
@@ -50,14 +50,19 @@ class BaseAPI
|
||||
{
|
||||
if (parameters.generate_hints)
|
||||
{
|
||||
return json::makeWaypoint(phantom.location,
|
||||
facade.GetNameForID(phantom.name_id).to_string(),
|
||||
Hint{phantom, facade.GetCheckSum()});
|
||||
// TODO: check forward/reverse
|
||||
return json::makeWaypoint(
|
||||
phantom.location,
|
||||
facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id)).to_string(),
|
||||
Hint{phantom, facade.GetCheckSum()});
|
||||
}
|
||||
else
|
||||
{
|
||||
return json::makeWaypoint(phantom.location,
|
||||
facade.GetNameForID(phantom.name_id).to_string());
|
||||
// TODO: check forward/reverse
|
||||
return json::makeWaypoint(
|
||||
phantom.location,
|
||||
facade.GetNameForID(facade.GetNameIndex(phantom.forward_segment_id.id))
|
||||
.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -374,14 +374,20 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
||||
EdgeDuration forward_duration_offset = 0, forward_duration = 0;
|
||||
EdgeDuration reverse_duration_offset = 0, reverse_duration = 0;
|
||||
|
||||
BOOST_ASSERT(data.forward_segment_id.enabled || data.reverse_segment_id.enabled);
|
||||
BOOST_ASSERT(!data.reverse_segment_id.enabled ||
|
||||
datafacade.GetGeometryIndex(data.forward_segment_id.id).id ==
|
||||
datafacade.GetGeometryIndex(data.reverse_segment_id.id).id);
|
||||
const auto geometry_id = datafacade.GetGeometryIndex(data.forward_segment_id.id).id;
|
||||
|
||||
const std::vector<EdgeWeight> forward_weight_vector =
|
||||
datafacade.GetUncompressedForwardWeights(data.packed_geometry_id);
|
||||
datafacade.GetUncompressedForwardWeights(geometry_id);
|
||||
const std::vector<EdgeWeight> reverse_weight_vector =
|
||||
datafacade.GetUncompressedReverseWeights(data.packed_geometry_id);
|
||||
datafacade.GetUncompressedReverseWeights(geometry_id);
|
||||
const std::vector<EdgeWeight> forward_duration_vector =
|
||||
datafacade.GetUncompressedForwardDurations(data.packed_geometry_id);
|
||||
datafacade.GetUncompressedForwardDurations(geometry_id);
|
||||
const std::vector<EdgeWeight> reverse_duration_vector =
|
||||
datafacade.GetUncompressedReverseDurations(data.packed_geometry_id);
|
||||
datafacade.GetUncompressedReverseDurations(geometry_id);
|
||||
|
||||
for (std::size_t i = 0; i < data.fwd_segment_position; i++)
|
||||
{
|
||||
@@ -505,20 +511,25 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
||||
bool forward_edge_valid = false;
|
||||
bool reverse_edge_valid = false;
|
||||
|
||||
const std::vector<EdgeWeight> forward_weight_vector =
|
||||
datafacade.GetUncompressedForwardWeights(segment.data.packed_geometry_id);
|
||||
const auto &data = segment.data;
|
||||
BOOST_ASSERT(data.forward_segment_id.enabled);
|
||||
BOOST_ASSERT(data.forward_segment_id.id != SPECIAL_NODEID);
|
||||
const auto geometry_id = datafacade.GetGeometryIndex(data.forward_segment_id.id).id;
|
||||
|
||||
if (forward_weight_vector[segment.data.fwd_segment_position] != INVALID_EDGE_WEIGHT)
|
||||
const std::vector<EdgeWeight> forward_weight_vector =
|
||||
datafacade.GetUncompressedForwardWeights(geometry_id);
|
||||
|
||||
if (forward_weight_vector[data.fwd_segment_position] != INVALID_EDGE_WEIGHT)
|
||||
{
|
||||
forward_edge_valid = segment.data.forward_segment_id.enabled;
|
||||
forward_edge_valid = data.forward_segment_id.enabled;
|
||||
}
|
||||
|
||||
const std::vector<EdgeWeight> reverse_weight_vector =
|
||||
datafacade.GetUncompressedReverseWeights(segment.data.packed_geometry_id);
|
||||
if (reverse_weight_vector[reverse_weight_vector.size() - segment.data.fwd_segment_position -
|
||||
1] != INVALID_EDGE_WEIGHT)
|
||||
datafacade.GetUncompressedReverseWeights(geometry_id);
|
||||
if (reverse_weight_vector[reverse_weight_vector.size() - data.fwd_segment_position - 1] !=
|
||||
INVALID_EDGE_WEIGHT)
|
||||
{
|
||||
reverse_edge_valid = segment.data.reverse_segment_id.enabled;
|
||||
reverse_edge_valid = data.reverse_segment_id.enabled;
|
||||
}
|
||||
|
||||
return std::make_pair(forward_edge_valid, reverse_edge_valid);
|
||||
|
||||
@@ -51,8 +51,11 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
||||
// source node rev: 2 0 <- 1 <- 2
|
||||
const auto source_segment_start_coordinate =
|
||||
source_node.fwd_segment_position + (reversed_source ? 1 : 0);
|
||||
const auto source_node_id =
|
||||
reversed_source ? source_node.reverse_segment_id.id : source_node.forward_segment_id.id;
|
||||
const auto source_gemetry_id = facade.GetGeometryIndex(source_node_id).id;
|
||||
const std::vector<NodeID> source_geometry =
|
||||
facade.GetUncompressedForwardGeometry(source_node.packed_geometry_id);
|
||||
facade.GetUncompressedForwardGeometry(source_gemetry_id);
|
||||
geometry.osm_node_ids.push_back(
|
||||
facade.GetOSMNodeIDOfNode(source_geometry[source_segment_start_coordinate]));
|
||||
|
||||
@@ -89,8 +92,11 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
||||
// segment leading to the target node
|
||||
geometry.segment_distances.push_back(cumulative_distance);
|
||||
|
||||
const auto target_node_id =
|
||||
reversed_target ? target_node.reverse_segment_id.id : target_node.forward_segment_id.id;
|
||||
const auto target_gemetry_id = facade.GetGeometryIndex(target_node_id).id;
|
||||
const std::vector<DatasourceID> forward_datasources =
|
||||
facade.GetUncompressedForwardDatasources(target_node.packed_geometry_id);
|
||||
facade.GetUncompressedForwardDatasources(target_gemetry_id);
|
||||
|
||||
// FIXME if source and target phantoms are on the same segment then duration and weight
|
||||
// will be from one projected point till end of segment
|
||||
@@ -113,7 +119,7 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
||||
const auto target_segment_end_coordinate =
|
||||
target_node.fwd_segment_position + (reversed_target ? 0 : 1);
|
||||
const std::vector<NodeID> target_geometry =
|
||||
facade.GetUncompressedForwardGeometry(target_node.packed_geometry_id);
|
||||
facade.GetUncompressedForwardGeometry(target_gemetry_id);
|
||||
geometry.osm_node_ids.push_back(
|
||||
facade.GetOSMNodeIDOfNode(target_geometry[target_segment_end_coordinate]));
|
||||
|
||||
|
||||
@@ -40,7 +40,8 @@ struct NamedSegment
|
||||
|
||||
template <std::size_t SegmentNumber>
|
||||
|
||||
std::array<std::uint32_t, SegmentNumber> summarizeRoute(const std::vector<PathData> &route_data,
|
||||
std::array<std::uint32_t, SegmentNumber> summarizeRoute(const datafacade::BaseDataFacade &facade,
|
||||
const std::vector<PathData> &route_data,
|
||||
const PhantomNode &target_node,
|
||||
const bool target_traversed_in_reverse)
|
||||
{
|
||||
@@ -80,8 +81,10 @@ std::array<std::uint32_t, SegmentNumber> summarizeRoute(const std::vector<PathDa
|
||||
});
|
||||
const auto target_duration =
|
||||
target_traversed_in_reverse ? target_node.reverse_duration : target_node.forward_duration;
|
||||
const auto target_node_id = target_traversed_in_reverse ? target_node.reverse_segment_id.id
|
||||
: target_node.forward_segment_id.id;
|
||||
if (target_duration > 1)
|
||||
segments.push_back({target_duration, index++, target_node.name_id});
|
||||
segments.push_back({target_duration, index++, facade.GetNameIndex(target_node_id)});
|
||||
// this makes sure that the segment with the lowest position comes first
|
||||
std::sort(
|
||||
segments.begin(), segments.end(), [](const NamedSegment &lhs, const NamedSegment &rhs) {
|
||||
@@ -183,7 +186,7 @@ inline RouteLeg assembleLeg(const datafacade::BaseDataFacade &facade,
|
||||
if (needs_summary)
|
||||
{
|
||||
auto summary_array = detail::summarizeRoute<detail::MAX_USED_SEGMENTS>(
|
||||
route_data, target_node, target_traversed_in_reverse);
|
||||
facade, route_data, target_node, target_traversed_in_reverse);
|
||||
|
||||
BOOST_ASSERT(detail::MAX_USED_SEGMENTS > 0);
|
||||
BOOST_ASSERT(summary_array.begin() != summary_array.end());
|
||||
|
||||
@@ -49,15 +49,19 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
|
||||
source_traversed_in_reverse ? source_node.reverse_weight : source_node.forward_weight;
|
||||
const EdgeWeight source_duration =
|
||||
source_traversed_in_reverse ? source_node.reverse_duration : source_node.forward_duration;
|
||||
const auto source_mode = source_traversed_in_reverse ? source_node.backward_travel_mode
|
||||
: source_node.forward_travel_mode;
|
||||
const auto source_node_id = source_traversed_in_reverse ? source_node.reverse_segment_id.id
|
||||
: source_node.forward_segment_id.id;
|
||||
const auto source_name_id = facade.GetNameIndex(source_node_id);
|
||||
const auto source_mode = facade.GetTravelMode(source_node_id);
|
||||
|
||||
const EdgeWeight target_duration =
|
||||
target_traversed_in_reverse ? target_node.reverse_duration : target_node.forward_duration;
|
||||
const EdgeWeight target_weight =
|
||||
target_traversed_in_reverse ? target_node.reverse_weight : target_node.forward_weight;
|
||||
const auto target_mode = target_traversed_in_reverse ? target_node.backward_travel_mode
|
||||
: target_node.forward_travel_mode;
|
||||
const auto target_node_id = target_traversed_in_reverse ? target_node.reverse_segment_id.id
|
||||
: target_node.forward_segment_id.id;
|
||||
const auto target_name_id = facade.GetNameIndex(target_node_id);
|
||||
const auto target_mode = facade.GetTravelMode(target_node_id);
|
||||
|
||||
const auto number_of_segments = leg_geometry.GetNumberOfSegments();
|
||||
|
||||
@@ -95,7 +99,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
|
||||
|
||||
// some name changes are not announced in our processing. For these, we have to keep the
|
||||
// first name on the segment
|
||||
auto step_name_id = source_node.name_id;
|
||||
auto step_name_id = source_name_id;
|
||||
for (std::size_t leg_data_index = 0; leg_data_index < leg_data.size(); ++leg_data_index)
|
||||
{
|
||||
const auto &path_point = leg_data[leg_data_index];
|
||||
@@ -134,7 +138,7 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
|
||||
}
|
||||
else
|
||||
{
|
||||
step_name_id = target_node.name_id;
|
||||
step_name_id = facade.GetNameIndex(target_node_id);
|
||||
}
|
||||
|
||||
// extract bearings
|
||||
@@ -230,11 +234,11 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
|
||||
BOOST_ASSERT(target_duration >= source_duration || weight == 0);
|
||||
const EdgeWeight duration = std::max(0, target_duration - source_duration);
|
||||
|
||||
steps.push_back(RouteStep{source_node.name_id,
|
||||
facade.GetNameForID(source_node.name_id).to_string(),
|
||||
facade.GetRefForID(source_node.name_id).to_string(),
|
||||
facade.GetPronunciationForID(source_node.name_id).to_string(),
|
||||
facade.GetDestinationsForID(source_node.name_id).to_string(),
|
||||
steps.push_back(RouteStep{source_name_id,
|
||||
facade.GetNameForID(source_name_id).to_string(),
|
||||
facade.GetRefForID(source_name_id).to_string(),
|
||||
facade.GetPronunciationForID(source_name_id).to_string(),
|
||||
facade.GetDestinationsForID(source_name_id).to_string(),
|
||||
NO_ROTARY_NAME,
|
||||
NO_ROTARY_NAME,
|
||||
duration / 10.,
|
||||
@@ -268,11 +272,11 @@ inline std::vector<RouteStep> assembleSteps(const datafacade::BaseDataFacade &fa
|
||||
0};
|
||||
|
||||
BOOST_ASSERT(!leg_geometry.locations.empty());
|
||||
steps.push_back(RouteStep{target_node.name_id,
|
||||
facade.GetNameForID(target_node.name_id).to_string(),
|
||||
facade.GetRefForID(target_node.name_id).to_string(),
|
||||
facade.GetPronunciationForID(target_node.name_id).to_string(),
|
||||
facade.GetDestinationsForID(target_node.name_id).to_string(),
|
||||
steps.push_back(RouteStep{target_name_id,
|
||||
facade.GetNameForID(target_name_id).to_string(),
|
||||
facade.GetRefForID(target_name_id).to_string(),
|
||||
facade.GetPronunciationForID(target_name_id).to_string(),
|
||||
facade.GetDestinationsForID(target_name_id).to_string(),
|
||||
NO_ROTARY_NAME,
|
||||
NO_ROTARY_NAME,
|
||||
ZERO_DURATION,
|
||||
|
||||
@@ -63,8 +63,8 @@ struct Hint
|
||||
friend std::ostream &operator<<(std::ostream &, const Hint &);
|
||||
};
|
||||
|
||||
static_assert(sizeof(Hint) == 72 + 4, "Hint is bigger than expected");
|
||||
constexpr std::size_t ENCODED_HINT_SIZE = 104;
|
||||
static_assert(sizeof(Hint) == 64 + 4, "Hint is bigger than expected");
|
||||
constexpr std::size_t ENCODED_HINT_SIZE = 92;
|
||||
static_assert(ENCODED_HINT_SIZE / 4 * 3 >= sizeof(Hint),
|
||||
"ENCODED_HINT_SIZE does not match size of Hint");
|
||||
}
|
||||
|
||||
@@ -48,16 +48,13 @@ struct PhantomNode
|
||||
{
|
||||
PhantomNode()
|
||||
: forward_segment_id{SPECIAL_SEGMENTID, false},
|
||||
reverse_segment_id{SPECIAL_SEGMENTID, false},
|
||||
name_id(std::numeric_limits<unsigned>::max()), forward_weight(INVALID_EDGE_WEIGHT),
|
||||
reverse_segment_id{SPECIAL_SEGMENTID, false}, forward_weight(INVALID_EDGE_WEIGHT),
|
||||
reverse_weight(INVALID_EDGE_WEIGHT), forward_weight_offset(0), reverse_weight_offset(0),
|
||||
forward_duration(MAXIMAL_EDGE_DURATION), reverse_duration(MAXIMAL_EDGE_DURATION),
|
||||
forward_duration_offset(0), reverse_duration_offset(0),
|
||||
packed_geometry_id(SPECIAL_GEOMETRYID), component{INVALID_COMPONENTID, false},
|
||||
fwd_segment_position(0), forward_travel_mode(TRAVEL_MODE_INACCESSIBLE),
|
||||
backward_travel_mode(TRAVEL_MODE_INACCESSIBLE), is_valid_forward_source(false),
|
||||
is_valid_forward_target(false), is_valid_reverse_source(false),
|
||||
is_valid_reverse_target(false)
|
||||
component{INVALID_COMPONENTID, false}, fwd_segment_position(0),
|
||||
is_valid_forward_source(false), is_valid_forward_target(false),
|
||||
is_valid_reverse_source(false), is_valid_reverse_target(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -95,7 +92,7 @@ struct PhantomNode
|
||||
(reverse_weight != INVALID_EDGE_WEIGHT)) &&
|
||||
((forward_duration != MAXIMAL_EDGE_DURATION) ||
|
||||
(reverse_duration != MAXIMAL_EDGE_DURATION)) &&
|
||||
(component.id != INVALID_COMPONENTID) && (name_id != INVALID_NAMEID);
|
||||
(component.id != INVALID_COMPONENTID);
|
||||
}
|
||||
|
||||
bool IsValid(const unsigned number_of_nodes, const util::Coordinate queried_coordinate) const
|
||||
@@ -103,7 +100,7 @@ struct PhantomNode
|
||||
return queried_coordinate == input_location && IsValid(number_of_nodes);
|
||||
}
|
||||
|
||||
bool IsValid() const { return location.IsValid() && (name_id != INVALID_NAMEID); }
|
||||
bool IsValid() const { return location.IsValid(); }
|
||||
|
||||
bool IsValidForwardSource() const
|
||||
{
|
||||
@@ -141,17 +138,13 @@ struct PhantomNode
|
||||
const util::Coordinate location,
|
||||
const util::Coordinate input_location)
|
||||
: forward_segment_id{other.forward_segment_id},
|
||||
reverse_segment_id{other.reverse_segment_id}, name_id{other.name_id},
|
||||
forward_weight{forward_weight}, reverse_weight{reverse_weight},
|
||||
forward_weight_offset{forward_weight_offset},
|
||||
reverse_segment_id{other.reverse_segment_id}, forward_weight{forward_weight},
|
||||
reverse_weight{reverse_weight}, forward_weight_offset{forward_weight_offset},
|
||||
reverse_weight_offset{reverse_weight_offset}, forward_duration{forward_duration},
|
||||
reverse_duration{reverse_duration}, forward_duration_offset{forward_duration_offset},
|
||||
reverse_duration_offset{reverse_duration_offset},
|
||||
packed_geometry_id{other.packed_geometry_id},
|
||||
component{other.component.id, other.component.is_tiny}, location{location},
|
||||
input_location{input_location}, fwd_segment_position{other.fwd_segment_position},
|
||||
forward_travel_mode{other.forward_travel_mode},
|
||||
backward_travel_mode{other.backward_travel_mode},
|
||||
is_valid_forward_source{is_valid_forward_source},
|
||||
is_valid_forward_target{is_valid_forward_target},
|
||||
is_valid_reverse_source{is_valid_reverse_source},
|
||||
@@ -161,7 +154,6 @@ struct PhantomNode
|
||||
|
||||
SegmentID forward_segment_id;
|
||||
SegmentID reverse_segment_id;
|
||||
unsigned name_id;
|
||||
EdgeWeight forward_weight;
|
||||
EdgeWeight reverse_weight;
|
||||
EdgeWeight forward_weight_offset; // TODO: try to remove -> requires path unpacking changes
|
||||
@@ -170,7 +162,6 @@ struct PhantomNode
|
||||
EdgeWeight reverse_duration;
|
||||
EdgeWeight forward_duration_offset; // TODO: try to remove -> requires path unpacking changes
|
||||
EdgeWeight reverse_duration_offset; // TODO: try to remove -> requires path unpacking changes
|
||||
unsigned packed_geometry_id;
|
||||
struct ComponentType
|
||||
{
|
||||
std::uint32_t id : 31;
|
||||
@@ -181,10 +172,6 @@ struct PhantomNode
|
||||
util::Coordinate location;
|
||||
util::Coordinate input_location;
|
||||
unsigned short fwd_segment_position;
|
||||
// note 4 bits would suffice for each,
|
||||
// but the saved byte would be padding anyway
|
||||
extractor::TravelMode forward_travel_mode : 4;
|
||||
extractor::TravelMode backward_travel_mode : 4;
|
||||
// is phantom node valid to be used as source or target
|
||||
private:
|
||||
bool is_valid_forward_source : 1;
|
||||
@@ -193,7 +180,7 @@ struct PhantomNode
|
||||
bool is_valid_reverse_target : 1;
|
||||
};
|
||||
|
||||
static_assert(sizeof(PhantomNode) == 72, "PhantomNode has more padding then expected");
|
||||
static_assert(sizeof(PhantomNode) == 64, "PhantomNode has more padding then expected");
|
||||
|
||||
using PhantomNodePair = std::pair<PhantomNode, PhantomNode>;
|
||||
|
||||
@@ -220,7 +207,6 @@ inline std::ostream &operator<<(std::ostream &out, const PhantomNode &pn)
|
||||
{
|
||||
out << "node1: " << pn.forward_segment_id.id << ", "
|
||||
<< "node2: " << pn.reverse_segment_id.id << ", "
|
||||
<< "name: " << pn.name_id << ", "
|
||||
<< "fwd-w: " << pn.forward_weight << ", "
|
||||
<< "rev-w: " << pn.reverse_weight << ", "
|
||||
<< "fwd-o: " << pn.forward_weight_offset << ", "
|
||||
@@ -229,7 +215,6 @@ inline std::ostream &operator<<(std::ostream &out, const PhantomNode &pn)
|
||||
<< "rev-d: " << pn.reverse_duration << ", "
|
||||
<< "fwd-do: " << pn.forward_duration_offset << ", "
|
||||
<< "rev-do: " << pn.reverse_duration_offset << ", "
|
||||
<< "geom: " << pn.packed_geometry_id << ", "
|
||||
<< "comp: " << pn.component.is_tiny << " / " << pn.component.id << ", "
|
||||
<< "pos: " << pn.fwd_segment_position << ", "
|
||||
<< "loc: " << pn.location;
|
||||
|
||||
@@ -91,15 +91,17 @@ void annotatePath(const FacadeT &facade,
|
||||
BOOST_ASSERT(!unpacked_nodes.empty());
|
||||
BOOST_ASSERT(unpacked_nodes.size() == unpacked_edges.size() + 1);
|
||||
|
||||
const auto source_node_id = unpacked_nodes.front();
|
||||
const auto target_node_id = unpacked_nodes.back();
|
||||
const bool start_traversed_in_reverse =
|
||||
phantom_node_pair.source_phantom.forward_segment_id.id != unpacked_nodes.front();
|
||||
phantom_node_pair.source_phantom.forward_segment_id.id != source_node_id;
|
||||
const bool target_traversed_in_reverse =
|
||||
phantom_node_pair.target_phantom.forward_segment_id.id != unpacked_nodes.back();
|
||||
phantom_node_pair.target_phantom.forward_segment_id.id != target_node_id;
|
||||
|
||||
BOOST_ASSERT(phantom_node_pair.source_phantom.forward_segment_id.id == unpacked_nodes.front() ||
|
||||
phantom_node_pair.source_phantom.reverse_segment_id.id == unpacked_nodes.front());
|
||||
BOOST_ASSERT(phantom_node_pair.target_phantom.forward_segment_id.id == unpacked_nodes.back() ||
|
||||
phantom_node_pair.target_phantom.reverse_segment_id.id == unpacked_nodes.back());
|
||||
BOOST_ASSERT(phantom_node_pair.source_phantom.forward_segment_id.id == source_node_id ||
|
||||
phantom_node_pair.source_phantom.reverse_segment_id.id == source_node_id);
|
||||
BOOST_ASSERT(phantom_node_pair.target_phantom.forward_segment_id.id == target_node_id ||
|
||||
phantom_node_pair.target_phantom.reverse_segment_id.id == target_node_id);
|
||||
|
||||
auto node_from = unpacked_nodes.begin(), node_last = std::prev(unpacked_nodes.end());
|
||||
for (auto edge = unpacked_edges.begin(); node_from != node_last; ++node_from, ++edge)
|
||||
@@ -109,10 +111,7 @@ void annotatePath(const FacadeT &facade,
|
||||
const auto node_id = *node_from; // edge-based graph node index
|
||||
const auto name_index = facade.GetNameIndex(node_id);
|
||||
const auto turn_instruction = facade.GetTurnInstructionForEdgeID(turn_id);
|
||||
const extractor::TravelMode travel_mode =
|
||||
(unpacked_path.empty() && start_traversed_in_reverse)
|
||||
? phantom_node_pair.source_phantom.backward_travel_mode
|
||||
: facade.GetTravelMode(node_id);
|
||||
const extractor::TravelMode travel_mode = facade.GetTravelMode(node_id);
|
||||
|
||||
const auto geometry_index = facade.GetGeometryIndex(node_id);
|
||||
std::vector<NodeID> id_vector;
|
||||
@@ -181,23 +180,16 @@ void annotatePath(const FacadeT &facade,
|
||||
std::vector<EdgeWeight> weight_vector;
|
||||
std::vector<EdgeWeight> duration_vector;
|
||||
std::vector<DatasourceID> datasource_vector;
|
||||
const bool is_local_path = (phantom_node_pair.source_phantom.packed_geometry_id ==
|
||||
phantom_node_pair.target_phantom.packed_geometry_id) &&
|
||||
unpacked_path.empty();
|
||||
const auto source_geometry_id = facade.GetGeometryIndex(source_node_id).id;
|
||||
const auto target_geometry_id = facade.GetGeometryIndex(target_node_id).id;
|
||||
const auto is_local_path = source_geometry_id == target_geometry_id && unpacked_path.empty();
|
||||
|
||||
if (target_traversed_in_reverse)
|
||||
{
|
||||
id_vector = facade.GetUncompressedReverseGeometry(
|
||||
phantom_node_pair.target_phantom.packed_geometry_id);
|
||||
|
||||
weight_vector = facade.GetUncompressedReverseWeights(
|
||||
phantom_node_pair.target_phantom.packed_geometry_id);
|
||||
|
||||
duration_vector = facade.GetUncompressedReverseDurations(
|
||||
phantom_node_pair.target_phantom.packed_geometry_id);
|
||||
|
||||
datasource_vector = facade.GetUncompressedReverseDatasources(
|
||||
phantom_node_pair.target_phantom.packed_geometry_id);
|
||||
id_vector = facade.GetUncompressedReverseGeometry(target_geometry_id);
|
||||
weight_vector = facade.GetUncompressedReverseWeights(target_geometry_id);
|
||||
duration_vector = facade.GetUncompressedReverseDurations(target_geometry_id);
|
||||
datasource_vector = facade.GetUncompressedReverseDatasources(target_geometry_id);
|
||||
|
||||
if (is_local_path)
|
||||
{
|
||||
@@ -215,17 +207,10 @@ void annotatePath(const FacadeT &facade,
|
||||
}
|
||||
end_index = phantom_node_pair.target_phantom.fwd_segment_position;
|
||||
|
||||
id_vector = facade.GetUncompressedForwardGeometry(
|
||||
phantom_node_pair.target_phantom.packed_geometry_id);
|
||||
|
||||
weight_vector = facade.GetUncompressedForwardWeights(
|
||||
phantom_node_pair.target_phantom.packed_geometry_id);
|
||||
|
||||
duration_vector = facade.GetUncompressedForwardDurations(
|
||||
phantom_node_pair.target_phantom.packed_geometry_id);
|
||||
|
||||
datasource_vector = facade.GetUncompressedForwardDatasources(
|
||||
phantom_node_pair.target_phantom.packed_geometry_id);
|
||||
id_vector = facade.GetUncompressedForwardGeometry(target_geometry_id);
|
||||
weight_vector = facade.GetUncompressedForwardWeights(target_geometry_id);
|
||||
duration_vector = facade.GetUncompressedForwardDurations(target_geometry_id);
|
||||
datasource_vector = facade.GetUncompressedForwardDatasources(target_geometry_id);
|
||||
}
|
||||
|
||||
// Given the following compressed geometry:
|
||||
@@ -239,20 +224,19 @@ void annotatePath(const FacadeT &facade,
|
||||
(start_index < end_index ? ++segment_idx : --segment_idx))
|
||||
{
|
||||
BOOST_ASSERT(segment_idx < id_vector.size() - 1);
|
||||
BOOST_ASSERT(phantom_node_pair.target_phantom.forward_travel_mode > 0);
|
||||
unpacked_path.push_back(PathData{
|
||||
id_vector[start_index < end_index ? segment_idx + 1 : segment_idx - 1],
|
||||
phantom_node_pair.target_phantom.name_id,
|
||||
weight_vector[segment_idx],
|
||||
duration_vector[segment_idx],
|
||||
extractor::guidance::TurnInstruction::NO_TURN(),
|
||||
{{0, INVALID_LANEID}, INVALID_LANE_DESCRIPTIONID},
|
||||
target_traversed_in_reverse ? phantom_node_pair.target_phantom.backward_travel_mode
|
||||
: phantom_node_pair.target_phantom.forward_travel_mode,
|
||||
INVALID_ENTRY_CLASSID,
|
||||
datasource_vector[segment_idx],
|
||||
util::guidance::TurnBearing(0),
|
||||
util::guidance::TurnBearing(0)});
|
||||
BOOST_ASSERT(facade.GetTravelMode(target_node_id) > 0);
|
||||
unpacked_path.push_back(
|
||||
PathData{id_vector[start_index < end_index ? segment_idx + 1 : segment_idx - 1],
|
||||
facade.GetNameIndex(target_node_id),
|
||||
weight_vector[segment_idx],
|
||||
duration_vector[segment_idx],
|
||||
extractor::guidance::TurnInstruction::NO_TURN(),
|
||||
{{0, INVALID_LANEID}, INVALID_LANE_DESCRIPTIONID},
|
||||
facade.GetTravelMode(target_node_id),
|
||||
INVALID_ENTRY_CLASSID,
|
||||
datasource_vector[segment_idx],
|
||||
util::guidance::TurnBearing(0),
|
||||
util::guidance::TurnBearing(0)});
|
||||
}
|
||||
|
||||
if (unpacked_path.size() > 0)
|
||||
|
||||
Reference in New Issue
Block a user