Clang format.
This commit is contained in:
parent
d012b44b7f
commit
35422a0fb5
@ -215,14 +215,14 @@ class RouteAPI : public BaseAPI
|
|||||||
nodes.values.reserve(leg_geometry.osm_node_ids.size());
|
nodes.values.reserve(leg_geometry.osm_node_ids.size());
|
||||||
datasources.values.reserve(leg_geometry.annotations.size());
|
datasources.values.reserve(leg_geometry.annotations.size());
|
||||||
|
|
||||||
std::for_each(
|
std::for_each(leg_geometry.annotations.begin(),
|
||||||
leg_geometry.annotations.begin(),
|
leg_geometry.annotations.end(),
|
||||||
leg_geometry.annotations.end(),
|
[this, &durations, &distances, &datasources](
|
||||||
[this, &durations, &distances, &datasources](const guidance::LegGeometry::Annotation &step) {
|
const guidance::LegGeometry::Annotation &step) {
|
||||||
durations.values.push_back(step.duration);
|
durations.values.push_back(step.duration);
|
||||||
distances.values.push_back(step.distance);
|
distances.values.push_back(step.distance);
|
||||||
datasources.values.push_back(step.datasource);
|
datasources.values.push_back(step.datasource);
|
||||||
});
|
});
|
||||||
std::for_each(leg_geometry.osm_node_ids.begin(),
|
std::for_each(leg_geometry.osm_node_ids.begin(),
|
||||||
leg_geometry.osm_node_ids.end(),
|
leg_geometry.osm_node_ids.end(),
|
||||||
[this, &nodes](const OSMNodeID &node_id) {
|
[this, &nodes](const OSMNodeID &node_id) {
|
||||||
|
@ -73,7 +73,8 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
|||||||
auto results = rtree.Nearest(
|
auto results = rtree.Nearest(
|
||||||
input_coordinate,
|
input_coordinate,
|
||||||
[this, bearing, bearing_range, max_distance](const CandidateSegment &segment) {
|
[this, bearing, bearing_range, max_distance](const CandidateSegment &segment) {
|
||||||
return boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),HasValidEdge(segment));
|
return boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),
|
||||||
|
HasValidEdge(segment));
|
||||||
},
|
},
|
||||||
[this, max_distance, input_coordinate](const std::size_t,
|
[this, max_distance, input_coordinate](const std::size_t,
|
||||||
const CandidateSegment &segment) {
|
const CandidateSegment &segment) {
|
||||||
@ -91,14 +92,15 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
|||||||
const int bearing,
|
const int bearing,
|
||||||
const int bearing_range) const
|
const int bearing_range) const
|
||||||
{
|
{
|
||||||
auto results =
|
auto results = rtree.Nearest(
|
||||||
rtree.Nearest(input_coordinate,
|
input_coordinate,
|
||||||
[this, bearing, bearing_range](const CandidateSegment &segment) {
|
[this, bearing, bearing_range](const CandidateSegment &segment) {
|
||||||
return boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range), HasValidEdge(segment));
|
return boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),
|
||||||
},
|
HasValidEdge(segment));
|
||||||
[max_results](const std::size_t num_results, const CandidateSegment &) {
|
},
|
||||||
return num_results >= max_results;
|
[max_results](const std::size_t num_results, const CandidateSegment &) {
|
||||||
});
|
return num_results >= max_results;
|
||||||
|
});
|
||||||
|
|
||||||
return MakePhantomNodes(input_coordinate, results);
|
return MakePhantomNodes(input_coordinate, results);
|
||||||
}
|
}
|
||||||
@ -113,16 +115,17 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
|||||||
const int bearing,
|
const int bearing,
|
||||||
const int bearing_range) const
|
const int bearing_range) const
|
||||||
{
|
{
|
||||||
auto results =
|
auto results = rtree.Nearest(
|
||||||
rtree.Nearest(input_coordinate,
|
input_coordinate,
|
||||||
[this, bearing, bearing_range](const CandidateSegment &segment) {
|
[this, bearing, bearing_range](const CandidateSegment &segment) {
|
||||||
return boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range), HasValidEdge(segment));
|
return boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),
|
||||||
},
|
HasValidEdge(segment));
|
||||||
[this, max_distance, max_results, input_coordinate](
|
},
|
||||||
const std::size_t num_results, const CandidateSegment &segment) {
|
[this, max_distance, max_results, input_coordinate](const std::size_t num_results,
|
||||||
return num_results >= max_results ||
|
const CandidateSegment &segment) {
|
||||||
CheckSegmentDistance(input_coordinate, segment, max_distance);
|
return num_results >= max_results ||
|
||||||
});
|
CheckSegmentDistance(input_coordinate, segment, max_distance);
|
||||||
|
});
|
||||||
|
|
||||||
return MakePhantomNodes(input_coordinate, results);
|
return MakePhantomNodes(input_coordinate, results);
|
||||||
}
|
}
|
||||||
@ -214,7 +217,8 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
|||||||
auto use_segment = (!has_small_component ||
|
auto use_segment = (!has_small_component ||
|
||||||
(!has_big_component && !segment.data.component.is_tiny));
|
(!has_big_component && !segment.data.component.is_tiny));
|
||||||
auto use_directions = std::make_pair(use_segment, use_segment);
|
auto use_directions = std::make_pair(use_segment, use_segment);
|
||||||
if (!use_directions.first && !use_directions.second) return use_directions;
|
if (!use_directions.first && !use_directions.second)
|
||||||
|
return use_directions;
|
||||||
const auto valid_edges = HasValidEdge(segment);
|
const auto valid_edges = HasValidEdge(segment);
|
||||||
|
|
||||||
if (valid_edges.first || valid_edges.second)
|
if (valid_edges.first || valid_edges.second)
|
||||||
@ -259,7 +263,9 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
|||||||
|
|
||||||
if (use_segment)
|
if (use_segment)
|
||||||
{
|
{
|
||||||
use_directions = boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range), HasValidEdge(segment));
|
use_directions =
|
||||||
|
boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),
|
||||||
|
HasValidEdge(segment));
|
||||||
if (use_directions.first || use_directions.second)
|
if (use_directions.first || use_directions.second)
|
||||||
{
|
{
|
||||||
has_big_component = has_big_component || !segment.data.component.is_tiny;
|
has_big_component = has_big_component || !segment.data.component.is_tiny;
|
||||||
@ -304,7 +310,9 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
|||||||
|
|
||||||
if (use_segment)
|
if (use_segment)
|
||||||
{
|
{
|
||||||
use_directions = boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range), HasValidEdge(segment));
|
use_directions =
|
||||||
|
boolPairAnd(CheckSegmentBearing(segment, bearing, bearing_range),
|
||||||
|
HasValidEdge(segment));
|
||||||
if (use_directions.first || use_directions.second)
|
if (use_directions.first || use_directions.second)
|
||||||
{
|
{
|
||||||
has_big_component = has_big_component || !segment.data.component.is_tiny;
|
has_big_component = has_big_component || !segment.data.component.is_tiny;
|
||||||
@ -490,7 +498,8 @@ template <typename RTreeT, typename DataFacadeT> class GeospatialQuery
|
|||||||
|
|
||||||
BOOST_ASSERT(segment.data.fwd_segment_position < reverse_weight_vector.size());
|
BOOST_ASSERT(segment.data.fwd_segment_position < reverse_weight_vector.size());
|
||||||
|
|
||||||
if (reverse_weight_vector[reverse_weight_vector.size() - segment.data.fwd_segment_position - 1] != INVALID_EDGE_WEIGHT)
|
if (reverse_weight_vector[reverse_weight_vector.size() -
|
||||||
|
segment.data.fwd_segment_position - 1] != INVALID_EDGE_WEIGHT)
|
||||||
{
|
{
|
||||||
reverse_edge_valid = segment.data.reverse_segment_id.enabled;
|
reverse_edge_valid = segment.data.reverse_segment_id.enabled;
|
||||||
}
|
}
|
||||||
|
@ -51,8 +51,8 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
|||||||
reverse_geometry[reverse_geometry.size() - source_node.fwd_segment_position - 1]));
|
reverse_geometry[reverse_geometry.size() - source_node.fwd_segment_position - 1]));
|
||||||
|
|
||||||
std::vector<uint8_t> forward_datasource_vector;
|
std::vector<uint8_t> forward_datasource_vector;
|
||||||
facade.GetUncompressedDatasources(source_node.forward_packed_geometry_id, forward_datasource_vector);
|
facade.GetUncompressedDatasources(source_node.forward_packed_geometry_id,
|
||||||
|
forward_datasource_vector);
|
||||||
|
|
||||||
auto cumulative_distance = 0.;
|
auto cumulative_distance = 0.;
|
||||||
auto current_distance = 0.;
|
auto current_distance = 0.;
|
||||||
@ -73,8 +73,8 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
|||||||
}
|
}
|
||||||
|
|
||||||
prev_coordinate = coordinate;
|
prev_coordinate = coordinate;
|
||||||
geometry.annotations.emplace_back(
|
geometry.annotations.emplace_back(LegGeometry::Annotation{
|
||||||
LegGeometry::Annotation{current_distance, path_point.duration_until_turn / 10., path_point.datasource_id});
|
current_distance, path_point.duration_until_turn / 10., path_point.datasource_id});
|
||||||
geometry.locations.push_back(std::move(coordinate));
|
geometry.locations.push_back(std::move(coordinate));
|
||||||
geometry.osm_node_ids.push_back(facade.GetOSMNodeIDOfNode(path_point.turn_via_node));
|
geometry.osm_node_ids.push_back(facade.GetOSMNodeIDOfNode(path_point.turn_via_node));
|
||||||
}
|
}
|
||||||
@ -88,7 +88,9 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
|||||||
facade.GetUncompressedDatasources(target_node.forward_packed_geometry_id, forward_datasources);
|
facade.GetUncompressedDatasources(target_node.forward_packed_geometry_id, forward_datasources);
|
||||||
|
|
||||||
geometry.annotations.emplace_back(
|
geometry.annotations.emplace_back(
|
||||||
LegGeometry::Annotation{current_distance, target_node.forward_weight / 10., forward_datasources[target_node.fwd_segment_position]});
|
LegGeometry::Annotation{current_distance,
|
||||||
|
target_node.forward_weight / 10.,
|
||||||
|
forward_datasources[target_node.fwd_segment_position]});
|
||||||
geometry.segment_offsets.push_back(geometry.locations.size());
|
geometry.segment_offsets.push_back(geometry.locations.size());
|
||||||
geometry.locations.push_back(target_node.location);
|
geometry.locations.push_back(target_node.location);
|
||||||
|
|
||||||
@ -99,7 +101,6 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
|||||||
geometry.osm_node_ids.push_back(
|
geometry.osm_node_ids.push_back(
|
||||||
facade.GetOSMNodeIDOfNode(forward_geometry[target_node.fwd_segment_position]));
|
facade.GetOSMNodeIDOfNode(forward_geometry[target_node.fwd_segment_position]));
|
||||||
|
|
||||||
|
|
||||||
BOOST_ASSERT(geometry.segment_distances.size() == geometry.segment_offsets.size() - 1);
|
BOOST_ASSERT(geometry.segment_distances.size() == geometry.segment_offsets.size() - 1);
|
||||||
BOOST_ASSERT(geometry.locations.size() > geometry.segment_distances.size());
|
BOOST_ASSERT(geometry.locations.size() > geometry.segment_distances.size());
|
||||||
BOOST_ASSERT(geometry.annotations.size() == geometry.locations.size() - 1);
|
BOOST_ASSERT(geometry.annotations.size() == geometry.locations.size() - 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user