Apply clang-format
This commit is contained in:
@@ -195,26 +195,28 @@ void DescriptionFactory::Run(const unsigned zoom_level)
|
||||
|
||||
// fix what needs to be fixed else
|
||||
unsigned necessary_segments = 0; // a running index that counts the necessary pieces
|
||||
osrm::for_each_pair(
|
||||
path_description, [&](SegmentInformation &first, const SegmentInformation &second)
|
||||
{
|
||||
if (!first.necessary)
|
||||
{
|
||||
return;
|
||||
}
|
||||
osrm::for_each_pair(path_description,
|
||||
[&](SegmentInformation &first, const SegmentInformation &second)
|
||||
{
|
||||
if (!first.necessary)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (first.is_via_location)
|
||||
{ // mark the end of a leg (of several segments)
|
||||
via_indices.push_back(necessary_segments);
|
||||
}
|
||||
if (first.is_via_location)
|
||||
{ // mark the end of a leg (of several segments)
|
||||
via_indices.push_back(necessary_segments);
|
||||
}
|
||||
|
||||
const double post_turn_bearing = coordinate_calculation::bearing(first.location, second.location);
|
||||
const double pre_turn_bearing = 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);
|
||||
const double post_turn_bearing =
|
||||
coordinate_calculation::bearing(first.location, second.location);
|
||||
const double pre_turn_bearing =
|
||||
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);
|
||||
|
||||
++necessary_segments;
|
||||
});
|
||||
++necessary_segments;
|
||||
});
|
||||
|
||||
via_indices.push_back(necessary_segments);
|
||||
BOOST_ASSERT(via_indices.size() >= 2);
|
||||
|
||||
@@ -36,7 +36,7 @@ class named_mutex;
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
OSRM::OSRM_impl::OSRM_impl(LibOSRMConfig& lib_config)
|
||||
OSRM::OSRM_impl::OSRM_impl(LibOSRMConfig &lib_config)
|
||||
{
|
||||
if (lib_config.use_shared_memory)
|
||||
{
|
||||
@@ -58,10 +58,10 @@ OSRM::OSRM_impl::OSRM_impl(LibOSRMConfig& lib_config)
|
||||
RegisterPlugin(new MapMatchingPlugin<BaseDataFacade<QueryEdge::EdgeData>>(
|
||||
query_data_facade, lib_config.max_locations_map_matching));
|
||||
RegisterPlugin(new TimestampPlugin<BaseDataFacade<QueryEdge::EdgeData>>(query_data_facade));
|
||||
RegisterPlugin(new ViaRoutePlugin<BaseDataFacade<QueryEdge::EdgeData>>(query_data_facade,
|
||||
lib_config.max_locations_viaroute));
|
||||
RegisterPlugin(new RoundTripPlugin<BaseDataFacade<QueryEdge::EdgeData>>(query_data_facade,
|
||||
lib_config.max_locations_trip));
|
||||
RegisterPlugin(new ViaRoutePlugin<BaseDataFacade<QueryEdge::EdgeData>>(
|
||||
query_data_facade, lib_config.max_locations_viaroute));
|
||||
RegisterPlugin(new RoundTripPlugin<BaseDataFacade<QueryEdge::EdgeData>>(
|
||||
query_data_facade, lib_config.max_locations_trip));
|
||||
}
|
||||
|
||||
void OSRM::OSRM_impl::RegisterPlugin(BasePlugin *raw_plugin_ptr)
|
||||
@@ -71,7 +71,8 @@ void OSRM::OSRM_impl::RegisterPlugin(BasePlugin *raw_plugin_ptr)
|
||||
plugin_map[plugin_ptr->GetDescriptor()] = std::move(plugin_ptr);
|
||||
}
|
||||
|
||||
int OSRM::OSRM_impl::RunQuery(const RouteParameters &route_parameters, osrm::json::Object &json_result)
|
||||
int OSRM::OSRM_impl::RunQuery(const RouteParameters &route_parameters,
|
||||
osrm::json::Object &json_result)
|
||||
{
|
||||
const auto &plugin_iterator = plugin_map.find(route_parameters.service);
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ PhantomNode::PhantomNode(NodeID forward_node_id,
|
||||
: forward_node_id(forward_node_id), reverse_node_id(reverse_node_id), name_id(name_id),
|
||||
forward_weight(forward_weight), reverse_weight(reverse_weight),
|
||||
forward_offset(forward_offset), reverse_offset(reverse_offset),
|
||||
packed_geometry_id(packed_geometry_id), component{component_id, is_tiny_component}, location(location),
|
||||
fwd_segment_position(fwd_segment_position), forward_travel_mode(forward_travel_mode),
|
||||
backward_travel_mode(backward_travel_mode)
|
||||
packed_geometry_id(packed_geometry_id), component{component_id, is_tiny_component},
|
||||
location(location), fwd_segment_position(fwd_segment_position),
|
||||
forward_travel_mode(forward_travel_mode), backward_travel_mode(backward_travel_mode)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -62,16 +62,17 @@ PolylineCompressor::get_encoded_string(const std::vector<SegmentInformation> &po
|
||||
return encode_vector(delta_numbers);
|
||||
}
|
||||
|
||||
std::vector<FixedPointCoordinate> PolylineCompressor::decode_string(const std::string &geometry_string) const
|
||||
std::vector<FixedPointCoordinate>
|
||||
PolylineCompressor::decode_string(const std::string &geometry_string) const
|
||||
{
|
||||
std::vector<FixedPointCoordinate> new_coordinates;
|
||||
int index = 0, len = geometry_string.size();
|
||||
int lat = 0, lng = 0;
|
||||
|
||||
while (index < len)
|
||||
|
||||
while (index < len)
|
||||
{
|
||||
int b, shift = 0, result = 0;
|
||||
do
|
||||
do
|
||||
{
|
||||
b = geometry_string.at(index++) - 63;
|
||||
result |= (b & 0x1f) << shift;
|
||||
@@ -82,7 +83,7 @@ std::vector<FixedPointCoordinate> PolylineCompressor::decode_string(const std::s
|
||||
|
||||
shift = 0;
|
||||
result = 0;
|
||||
do
|
||||
do
|
||||
{
|
||||
b = geometry_string.at(index++) - 63;
|
||||
result |= (b & 0x1f) << shift;
|
||||
@@ -92,8 +93,8 @@ std::vector<FixedPointCoordinate> PolylineCompressor::decode_string(const std::s
|
||||
lng += dlng;
|
||||
|
||||
FixedPointCoordinate p;
|
||||
p.lat = COORDINATE_PRECISION * (((double) lat / 1E6));
|
||||
p.lon = COORDINATE_PRECISION * (((double) lng / 1E6));
|
||||
p.lat = COORDINATE_PRECISION * (((double)lat / 1E6));
|
||||
p.lon = COORDINATE_PRECISION * (((double)lng / 1E6));
|
||||
new_coordinates.push_back(p);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,14 +91,17 @@ void RouteParameters::addTimestamp(const unsigned timestamp)
|
||||
|
||||
void RouteParameters::addBearing(
|
||||
const boost::fusion::vector<int, boost::optional<int>> &received_bearing,
|
||||
boost::spirit::qi::unused_type /* unused */, bool& pass)
|
||||
boost::spirit::qi::unused_type /* unused */,
|
||||
bool &pass)
|
||||
{
|
||||
pass = false;
|
||||
const int bearing = boost::fusion::at_c<0>(received_bearing);
|
||||
const boost::optional<int> range = boost::fusion::at_c<1>(received_bearing);
|
||||
if (bearing < 0 || bearing > 359) return;
|
||||
if (range && (*range < 0 || *range > 180)) return;
|
||||
bearings.emplace_back(std::make_pair(bearing,range));
|
||||
if (bearing < 0 || bearing > 359)
|
||||
return;
|
||||
if (range && (*range < 0 || *range > 180))
|
||||
return;
|
||||
bearings.emplace_back(std::make_pair(bearing, range));
|
||||
pass = true;
|
||||
}
|
||||
|
||||
@@ -133,8 +136,7 @@ void RouteParameters::addDestination(
|
||||
uturns.push_back(uturn_default);
|
||||
}
|
||||
|
||||
void RouteParameters::addSource(
|
||||
const boost::fusion::vector<double, double> &received_coordinates)
|
||||
void RouteParameters::addSource(const boost::fusion::vector<double, double> &received_coordinates)
|
||||
{
|
||||
coordinates.emplace_back(
|
||||
static_cast<int>(COORDINATE_PRECISION * boost::fusion::at_c<0>(received_coordinates)),
|
||||
@@ -149,4 +151,3 @@ void RouteParameters::getCoordinatesFromGeometry(const std::string &geometry_str
|
||||
PolylineCompressor pc;
|
||||
coordinates = pc.decode_string(geometry_string);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user