mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 21:33:59 +00:00
Format all C++ and Java code via clang-format
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
@@ -127,11 +127,11 @@ routing::VehicleType Response::GetVehicleType() const
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
|
||||
RoutingApi::RoutingApi(std::string name, std::string token, uint32_t maxRPS)
|
||||
: m_apiName(std::move(name))
|
||||
, m_accessToken(std::move(token))
|
||||
, m_maxRPS(maxRPS) {}
|
||||
, m_maxRPS(maxRPS)
|
||||
{}
|
||||
|
||||
Response RoutingApi::CalculateRoute(Params const & params, int32_t startTimeZoneUTC) const
|
||||
{
|
||||
|
||||
@@ -58,9 +58,7 @@ namespace google
|
||||
// static
|
||||
std::string const GoogleApi::kApiName = "google";
|
||||
|
||||
GoogleApi::GoogleApi(std::string const & token)
|
||||
: RoutingApi(kApiName, token, kMaxRPS)
|
||||
{}
|
||||
GoogleApi::GoogleApi(std::string const & token) : RoutingApi(kApiName, token, kMaxRPS) {}
|
||||
|
||||
Response GoogleApi::CalculateRoute(Params const & params, int32_t startTimeZoneUTC) const
|
||||
{
|
||||
@@ -80,7 +78,7 @@ Response GoogleApi::CalculateRoute(Params const & params, int32_t startTimeZoneU
|
||||
|
||||
auto const startLatLon = leg.m_steps.front().m_startLocation;
|
||||
apiRoute.m_waypoints.emplace_back(startLatLon.m_lat, startLatLon.m_lon);
|
||||
for (const auto & step : leg.m_steps)
|
||||
for (auto const & step : leg.m_steps)
|
||||
{
|
||||
auto const & prev = step.m_startLocation;
|
||||
auto const & next = step.m_endLocation;
|
||||
@@ -135,11 +133,9 @@ std::string GoogleApi::GetDirectionsURL(Params const & params, int32_t startTime
|
||||
LOG(LDEBUG, ("&departure_time =", secondFromEpoch));
|
||||
|
||||
std::stringstream ss;
|
||||
ss << kBaseUrl
|
||||
<< "&origin=" << std::to_string(start.m_lat) << "," << std::to_string(start.m_lon)
|
||||
ss << kBaseUrl << "&origin=" << std::to_string(start.m_lat) << "," << std::to_string(start.m_lon)
|
||||
<< "&destination=" << std::to_string(finish.m_lat) << "," << std::to_string(finish.m_lon)
|
||||
<< "&key=" << GetAccessToken()
|
||||
<< "&alternatives=true"
|
||||
<< "&key=" << GetAccessToken() << "&alternatives=true"
|
||||
<< "&departure_time=" << secondFromEpoch;
|
||||
|
||||
return ss.str();
|
||||
|
||||
@@ -32,6 +32,6 @@ private:
|
||||
GoogleResponse MakeRequest(Params const & params, int32_t startTimeZoneUTC) const;
|
||||
std::string GetDirectionsURL(Params const & params, int32_t startTimeZoneUTC) const;
|
||||
};
|
||||
} // namespace mapbox
|
||||
} // namespace google
|
||||
} // namespace api
|
||||
} // namespace routing_quality
|
||||
|
||||
@@ -27,6 +27,6 @@ std::string DebugPrint(LatLon const & latlon)
|
||||
ss << "google::LatLon(" << latlon.m_lat << ", " << latlon.m_lon << ")";
|
||||
return ss.str();
|
||||
}
|
||||
} // namespace mapbox
|
||||
} // namespace google
|
||||
} // namespace api
|
||||
} // namespace routing_quality
|
||||
|
||||
@@ -15,8 +15,7 @@ namespace google
|
||||
{
|
||||
struct LatLon
|
||||
{
|
||||
DECLARE_VISITOR(visitor(m_lat, "lat"),
|
||||
visitor(m_lon, "lng"))
|
||||
DECLARE_VISITOR(visitor(m_lat, "lat"), visitor(m_lon, "lng"))
|
||||
|
||||
bool operator==(LatLon const & rhs) const;
|
||||
|
||||
@@ -26,8 +25,7 @@ struct LatLon
|
||||
|
||||
struct Step
|
||||
{
|
||||
DECLARE_VISITOR(visitor(m_startLocation, "start_location"),
|
||||
visitor(m_endLocation, "end_location"))
|
||||
DECLARE_VISITOR(visitor(m_startLocation, "start_location"), visitor(m_endLocation, "end_location"))
|
||||
|
||||
bool operator==(Step const & rhs) const;
|
||||
|
||||
@@ -51,9 +49,7 @@ struct Distance
|
||||
|
||||
struct Leg
|
||||
{
|
||||
DECLARE_VISITOR(visitor(m_distance, "distance"),
|
||||
visitor(m_duration, "duration"),
|
||||
visitor(m_steps, "steps"))
|
||||
DECLARE_VISITOR(visitor(m_distance, "distance"), visitor(m_duration, "duration"), visitor(m_steps, "steps"))
|
||||
|
||||
Distance m_distance;
|
||||
Duration m_duration;
|
||||
@@ -76,6 +72,6 @@ struct GoogleResponse
|
||||
};
|
||||
|
||||
std::string DebugPrint(LatLon const & latlon);
|
||||
} // namespace mapbox
|
||||
} // namespace google
|
||||
} // namespace api
|
||||
} // namespace routing_quality
|
||||
|
||||
@@ -55,9 +55,7 @@ namespace routing_quality::api::mapbox
|
||||
// static
|
||||
std::string const MapboxApi::kApiName = "mapbox";
|
||||
|
||||
MapboxApi::MapboxApi(std::string const & token)
|
||||
: RoutingApi(kApiName, token, kMaxRPS)
|
||||
{}
|
||||
MapboxApi::MapboxApi(std::string const & token) : RoutingApi(kApiName, token, kMaxRPS) {}
|
||||
|
||||
Response MapboxApi::CalculateRoute(Params const & params, int32_t /* startTimeZoneUTC */) const
|
||||
{
|
||||
@@ -120,8 +118,7 @@ std::string MapboxApi::GetDirectionsURL(Params const & params) const
|
||||
coords.emplace_back(mercator::ToLatLon(point));
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << kBaseURL << "directions/" << kDirectionsApiVersion << "/"
|
||||
<< VehicleTypeToMapboxType(params.m_type) << "/";
|
||||
oss << kBaseURL << "directions/" << kDirectionsApiVersion << "/" << VehicleTypeToMapboxType(params.m_type) << "/";
|
||||
oss << LatLonsToString(coords) << "?";
|
||||
oss << "access_token=" << GetAccessToken() << "&";
|
||||
oss << "overview=simplified&"
|
||||
@@ -130,4 +127,4 @@ std::string MapboxApi::GetDirectionsURL(Params const & params) const
|
||||
|
||||
return oss.str();
|
||||
}
|
||||
} // namespace mapbox::api::routing_quality
|
||||
} // namespace routing_quality::api::mapbox
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
#include "routing/routing_quality/api/mapbox/types.hpp"
|
||||
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
@@ -27,9 +27,7 @@ struct Geometry
|
||||
|
||||
struct Route
|
||||
{
|
||||
DECLARE_VISITOR(visitor(m_geometry, "geometry"),
|
||||
visitor(m_duration, "duration"),
|
||||
visitor(m_distance, "distance"))
|
||||
DECLARE_VISITOR(visitor(m_geometry, "geometry"), visitor(m_duration, "duration"), visitor(m_distance, "distance"))
|
||||
|
||||
Geometry m_geometry;
|
||||
double m_duration = 0.0;
|
||||
|
||||
Reference in New Issue
Block a user