Clang formatting.

This commit is contained in:
Lev Dragunov 2017-03-14 14:35:56 +03:00 committed by Patrick Niklaus
parent e9c0987e8a
commit 69422cc4e7
5 changed files with 59 additions and 47 deletions

View File

@ -63,13 +63,17 @@ struct MatchParameters : public RouteParameters
false,
RouteParameters::GeometriesType::Polyline,
RouteParameters::OverviewType::Simplified,
{}), track_preprocessing(PreprocessingType::Simple)
{}),
track_preprocessing(PreprocessingType::Simple)
{
}
template <typename... Args>
MatchParameters(std::vector<unsigned> timestamps_, PreprocessingType track_preprocessing_, Args... args_)
: RouteParameters{std::forward<Args>(args_)...}, timestamps{std::move(timestamps_)}, track_preprocessing(track_preprocessing_)
MatchParameters(std::vector<unsigned> timestamps_,
PreprocessingType track_preprocessing_,
Args... args_)
: RouteParameters{std::forward<Args>(args_)...}, timestamps{std::move(timestamps_)},
track_preprocessing(track_preprocessing_)
{
}

View File

@ -80,12 +80,12 @@ template <typename AlgorithmT> class RoutingAlgorithms final : public RoutingAlg
const std::vector<std::size_t> &source_indices,
const std::vector<std::size_t> &target_indices) const final override;
routing_algorithms::SubMatchingList MapMatching(
const routing_algorithms::CandidateLists &candidates_list,
const std::vector<util::Coordinate> &trace_coordinates,
const std::vector<unsigned> &trace_timestamps,
const std::vector<boost::optional<double>> &trace_gps_precision,
const bool use_tidying) const final override;
routing_algorithms::SubMatchingList
MapMatching(const routing_algorithms::CandidateLists &candidates_list,
const std::vector<util::Coordinate> &trace_coordinates,
const std::vector<unsigned> &trace_timestamps,
const std::vector<boost::optional<double>> &trace_gps_precision,
const bool use_tidying) const final override;
std::vector<routing_algorithms::TurnData>
GetTileTurns(const std::vector<datafacade::BaseDataFacade::RTreeLeaf> &edges,
@ -168,8 +168,13 @@ inline routing_algorithms::SubMatchingList RoutingAlgorithms<AlgorithmT>::MapMat
const std::vector<boost::optional<double>> &trace_gps_precision,
const bool use_tidying) const
{
return routing_algorithms::mapMatching(
heaps, facade, candidates_list, trace_coordinates, trace_timestamps, trace_gps_precision, use_tidying);
return routing_algorithms::mapMatching(heaps,
facade,
candidates_list,
trace_coordinates,
trace_timestamps,
trace_gps_precision,
use_tidying);
}
template <typename AlgorithmT>

View File

@ -34,14 +34,17 @@ struct MatchParametersGrammar final : public RouteParametersGrammar<Iterator, Si
';')[ph::bind(&engine::api::MatchParameters::timestamps, qi::_r1) = qi::_1];
preprocessing_type.add("simple", engine::api::MatchParameters::PreprocessingType::Simple)(
"full", engine::api::MatchParameters::PreprocessingType::Full)(
"false", engine::api::MatchParameters::PreprocessingType::False);
"full", engine::api::MatchParameters::PreprocessingType::Full)(
"false", engine::api::MatchParameters::PreprocessingType::False);
root_rule = BaseGrammar::query_rule(qi::_r1) > -qi::lit(".json") >
-('?' > (timestamps_rule(qi::_r1) | BaseGrammar::base_rule(qi::_r1) | (
qi::lit("preprocess=") > preprocessing_type[ph::bind(&engine::api::MatchParameters::track_preprocessing, qi::_r1) = qi::_1])
) % '&');
root_rule =
BaseGrammar::query_rule(qi::_r1) > -qi::lit(".json") >
-('?' >
(timestamps_rule(qi::_r1) | BaseGrammar::base_rule(qi::_r1) |
(qi::lit("preprocess=") >
preprocessing_type[ph::bind(&engine::api::MatchParameters::track_preprocessing,
qi::_r1) = qi::_1])) %
'&');
}
private:

View File

@ -177,32 +177,32 @@ Status MatchPlugin::HandleRequest(const datafacade::ContiguousInternalMemoryData
SubMatchingList sub_matchings;
if (parameters.track_preprocessing == api::MatchParameters::PreprocessingType::Full)
{
// Transparently tidy match parameters, do map matching on tidied parameters.
// Then use the mapping to restore the original <-> tidied relationship.
auto tidied = api::tidy::tidy(parameters);
// Transparently tidy match parameters, do map matching on tidied parameters.
// Then use the mapping to restore the original <-> tidied relationship.
auto tidied = api::tidy::tidy(parameters);
// TODO is search radiuses still actual
auto candidates_lists = GetPhantomNodesInRange(facade, tidied.parameters, search_radiuses);
// TODO is search radiuses still actual
auto candidates_lists = GetPhantomNodesInRange(facade, tidied.parameters, search_radiuses);
filterCandidates(tidied.parameters.coordinates, candidates_lists);
if (std::all_of(candidates_lists.begin(),
candidates_lists.end(),
[](const std::vector<PhantomNodeWithDistance> &candidates) {
return candidates.empty();
}))
{
return Error("NoSegment",
std::string("Could not find a matching segment for any coordinate."),
json_result);
}
filterCandidates(tidied.parameters.coordinates, candidates_lists);
if (std::all_of(candidates_lists.begin(),
candidates_lists.end(),
[](const std::vector<PhantomNodeWithDistance> &candidates) {
return candidates.empty();
}))
{
return Error("NoSegment",
std::string("Could not find a matching segment for any coordinate."),
json_result);
}
// call the actual map matching
sub_matchings = algorithms.MapMatching(
candidates_lists,
tidied.parameters.coordinates,
tidied.parameters.timestamps,
tidied.parameters.radiuses,
!(parameters.track_preprocessing == api::MatchParameters::PreprocessingType::False));
// call the actual map matching
sub_matchings = algorithms.MapMatching(
candidates_lists,
tidied.parameters.coordinates,
tidied.parameters.timestamps,
tidied.parameters.radiuses,
!(parameters.track_preprocessing == api::MatchParameters::PreprocessingType::False));
}
else
{
@ -223,11 +223,11 @@ Status MatchPlugin::HandleRequest(const datafacade::ContiguousInternalMemoryData
// call the actual map matching
sub_matchings = algorithms.MapMatching(
candidates_lists,
parameters.coordinates,
parameters.timestamps,
parameters.radiuses,
!(parameters.track_preprocessing == api::MatchParameters::PreprocessingType::False));
candidates_lists,
parameters.coordinates,
parameters.timestamps,
parameters.radiuses,
!(parameters.track_preprocessing == api::MatchParameters::PreprocessingType::False));
}
if (sub_matchings.size() == 0)

View File

@ -169,7 +169,7 @@ mapMatchingImpl(SearchEngineData &engine_working_data,
if (use_timestamps)
{
return trace_timestamps[t] - trace_timestamps[prev_unbroken_timestamps.back()] >
max_broken_time;
max_broken_time;
}
else
{