Format with clang-format 3.8
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
#ifndef ENGINE_GUIDANCE_ASSEMBLE_OVERVIEW_HPP
|
||||
#define ENGINE_GUIDANCE_ASSEMBLE_OVERVIEW_HPP
|
||||
|
||||
#include "engine/guidance/leg_geometry.hpp"
|
||||
#include "engine/douglas_peucker.hpp"
|
||||
#include "engine/guidance/leg_geometry.hpp"
|
||||
#include "util/viewport.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <tuple>
|
||||
#include <numeric>
|
||||
#include <utility>
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
#include <numeric>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
@@ -23,8 +23,10 @@ namespace
|
||||
|
||||
unsigned calculateOverviewZoomLevel(const std::vector<LegGeometry> &leg_geometries)
|
||||
{
|
||||
util::Coordinate south_west{util::FixedLongitude{std::numeric_limits<int>::max()}, util::FixedLatitude{std::numeric_limits<int>::max()}};
|
||||
util::Coordinate north_east{util::FixedLongitude{std::numeric_limits<int>::min()}, util::FixedLatitude{std::numeric_limits<int>::min()}};
|
||||
util::Coordinate south_west{util::FixedLongitude{std::numeric_limits<int>::max()},
|
||||
util::FixedLatitude{std::numeric_limits<int>::max()}};
|
||||
util::Coordinate north_east{util::FixedLongitude{std::numeric_limits<int>::min()},
|
||||
util::FixedLatitude{std::numeric_limits<int>::min()}};
|
||||
|
||||
for (const auto &leg_geometry : leg_geometries)
|
||||
{
|
||||
@@ -46,7 +48,7 @@ std::vector<util::Coordinate> simplifyGeometry(const std::vector<LegGeometry> &l
|
||||
{
|
||||
std::vector<util::Coordinate> overview_geometry;
|
||||
auto leg_index = 0UL;
|
||||
for (const auto& geometry : leg_geometries)
|
||||
for (const auto &geometry : leg_geometries)
|
||||
{
|
||||
auto simplified_geometry =
|
||||
douglasPeucker(geometry.locations.begin(), geometry.locations.end(), zoom_level);
|
||||
@@ -55,8 +57,8 @@ std::vector<util::Coordinate> simplifyGeometry(const std::vector<LegGeometry> &l
|
||||
{
|
||||
simplified_geometry.pop_back();
|
||||
}
|
||||
overview_geometry.insert(overview_geometry.end(), simplified_geometry.begin(),
|
||||
simplified_geometry.end());
|
||||
overview_geometry.insert(
|
||||
overview_geometry.end(), simplified_geometry.begin(), simplified_geometry.end());
|
||||
}
|
||||
return overview_geometry;
|
||||
}
|
||||
@@ -72,17 +74,19 @@ std::vector<util::Coordinate> assembleOverview(const std::vector<LegGeometry> &l
|
||||
}
|
||||
BOOST_ASSERT(!use_simplification);
|
||||
|
||||
auto overview_size = std::accumulate(leg_geometries.begin(), leg_geometries.end(), 0,
|
||||
[](const std::size_t sum, const LegGeometry &leg_geometry)
|
||||
{
|
||||
return sum + leg_geometry.locations.size();
|
||||
}) -
|
||||
leg_geometries.size() + 1;
|
||||
auto overview_size =
|
||||
std::accumulate(leg_geometries.begin(),
|
||||
leg_geometries.end(),
|
||||
0,
|
||||
[](const std::size_t sum, const LegGeometry &leg_geometry) {
|
||||
return sum + leg_geometry.locations.size();
|
||||
}) -
|
||||
leg_geometries.size() + 1;
|
||||
std::vector<util::Coordinate> overview_geometry;
|
||||
overview_geometry.reserve(overview_size);
|
||||
|
||||
auto leg_index = 0UL;
|
||||
for (const auto& geometry : leg_geometries)
|
||||
for (const auto &geometry : leg_geometries)
|
||||
{
|
||||
auto begin = geometry.locations.begin();
|
||||
auto end = geometry.locations.end();
|
||||
|
||||
@@ -11,16 +11,14 @@ namespace guidance
|
||||
|
||||
Route assembleRoute(const std::vector<RouteLeg> &route_legs)
|
||||
{
|
||||
auto distance = std::accumulate(route_legs.begin(), route_legs.end(), 0.,
|
||||
[](const double sum, const RouteLeg &leg)
|
||||
{
|
||||
return sum + leg.distance;
|
||||
});
|
||||
auto duration = std::accumulate(route_legs.begin(), route_legs.end(), 0.,
|
||||
[](const double sum, const RouteLeg &leg)
|
||||
{
|
||||
return sum + leg.duration;
|
||||
});
|
||||
auto distance = std::accumulate(
|
||||
route_legs.begin(), route_legs.end(), 0., [](const double sum, const RouteLeg &leg) {
|
||||
return sum + leg.distance;
|
||||
});
|
||||
auto duration = std::accumulate(
|
||||
route_legs.begin(), route_legs.end(), 0., [](const double sum, const RouteLeg &leg) {
|
||||
return sum + leg.duration;
|
||||
});
|
||||
|
||||
return Route{duration, distance};
|
||||
}
|
||||
|
||||
@@ -36,7 +36,8 @@ std::pair<short, short> getDepartBearings(const LegGeometry &leg_geometry)
|
||||
const auto turn_coordinate = leg_geometry.locations.front();
|
||||
const auto post_turn_coordinate = *(leg_geometry.locations.begin() + 1);
|
||||
return std::make_pair<short, short>(
|
||||
0, std::round(util::coordinate_calculation::bearing(turn_coordinate, post_turn_coordinate)));
|
||||
0,
|
||||
std::round(util::coordinate_calculation::bearing(turn_coordinate, post_turn_coordinate)));
|
||||
}
|
||||
|
||||
std::pair<short, short> getArriveBearings(const LegGeometry &leg_geometry)
|
||||
|
||||
@@ -104,12 +104,14 @@ RouteStep forwardInto(RouteStep destination, const RouteStep &source)
|
||||
if (destination.geometry_begin < source.geometry_begin)
|
||||
{
|
||||
destination.intersections.insert(destination.intersections.end(),
|
||||
source.intersections.begin(), source.intersections.end());
|
||||
source.intersections.begin(),
|
||||
source.intersections.end());
|
||||
}
|
||||
else
|
||||
{
|
||||
destination.intersections.insert(destination.intersections.begin(),
|
||||
source.intersections.begin(), source.intersections.end());
|
||||
source.intersections.begin(),
|
||||
source.intersections.end());
|
||||
}
|
||||
|
||||
destination.geometry_begin = std::min(destination.geometry_begin, source.geometry_begin);
|
||||
@@ -305,8 +307,8 @@ RouteStep elongate(RouteStep step, const RouteStep &by_step)
|
||||
|
||||
// if we elongate in the back, we only need to copy the intersections to the beginning.
|
||||
// the bearings remain the same, as the location of the turn doesn't change
|
||||
step.intersections.insert(step.intersections.end(), by_step.intersections.begin(),
|
||||
by_step.intersections.end());
|
||||
step.intersections.insert(
|
||||
step.intersections.end(), by_step.intersections.begin(), by_step.intersections.end());
|
||||
}
|
||||
// by_step comes before step -> we append at the front
|
||||
else
|
||||
@@ -319,8 +321,8 @@ RouteStep elongate(RouteStep step, const RouteStep &by_step)
|
||||
// elongating in the front changes the location of the maneuver
|
||||
step.maneuver = by_step.maneuver;
|
||||
|
||||
step.intersections.insert(step.intersections.begin(), by_step.intersections.begin(),
|
||||
by_step.intersections.end());
|
||||
step.intersections.insert(
|
||||
step.intersections.begin(), by_step.intersections.begin(), by_step.intersections.end());
|
||||
}
|
||||
return step;
|
||||
}
|
||||
@@ -738,7 +740,8 @@ void trimShortSegments(std::vector<RouteStep> &steps, LegGeometry &geometry)
|
||||
BOOST_ASSERT(geometry.segment_offsets[1] == 1);
|
||||
// geometry offsets have to be adjusted. Move all offsets to the front and reduce by
|
||||
// one. (This is an inplace forward one and reduce by one)
|
||||
std::transform(geometry.segment_offsets.begin() + 1, geometry.segment_offsets.end(),
|
||||
std::transform(geometry.segment_offsets.begin() + 1,
|
||||
geometry.segment_offsets.end(),
|
||||
geometry.segment_offsets.begin(),
|
||||
[](const std::size_t val) { return val - 1; });
|
||||
|
||||
@@ -772,7 +775,8 @@ void trimShortSegments(std::vector<RouteStep> &steps, LegGeometry &geometry)
|
||||
steps.front().geometry_begin = 1;
|
||||
|
||||
// reduce all offsets by one (inplace)
|
||||
std::transform(geometry.segment_offsets.begin(), geometry.segment_offsets.end(),
|
||||
std::transform(geometry.segment_offsets.begin(),
|
||||
geometry.segment_offsets.end(),
|
||||
geometry.segment_offsets.begin(),
|
||||
[](const std::size_t val) { return val - 1; });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user