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, false,
RouteParameters::GeometriesType::Polyline, RouteParameters::GeometriesType::Polyline,
RouteParameters::OverviewType::Simplified, RouteParameters::OverviewType::Simplified,
{}), track_preprocessing(PreprocessingType::Simple) {}),
track_preprocessing(PreprocessingType::Simple)
{ {
} }
template <typename... Args> template <typename... Args>
MatchParameters(std::vector<unsigned> timestamps_, PreprocessingType track_preprocessing_, Args... args_) MatchParameters(std::vector<unsigned> timestamps_,
: RouteParameters{std::forward<Args>(args_)...}, timestamps{std::move(timestamps_)}, track_preprocessing(track_preprocessing_) 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> &source_indices,
const std::vector<std::size_t> &target_indices) const final override; const std::vector<std::size_t> &target_indices) const final override;
routing_algorithms::SubMatchingList MapMatching( routing_algorithms::SubMatchingList
const routing_algorithms::CandidateLists &candidates_list, MapMatching(const routing_algorithms::CandidateLists &candidates_list,
const std::vector<util::Coordinate> &trace_coordinates, const std::vector<util::Coordinate> &trace_coordinates,
const std::vector<unsigned> &trace_timestamps, const std::vector<unsigned> &trace_timestamps,
const std::vector<boost::optional<double>> &trace_gps_precision, const std::vector<boost::optional<double>> &trace_gps_precision,
const bool use_tidying) const final override; const bool use_tidying) const final override;
std::vector<routing_algorithms::TurnData> std::vector<routing_algorithms::TurnData>
GetTileTurns(const std::vector<datafacade::BaseDataFacade::RTreeLeaf> &edges, 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 std::vector<boost::optional<double>> &trace_gps_precision,
const bool use_tidying) const const bool use_tidying) const
{ {
return routing_algorithms::mapMatching( return routing_algorithms::mapMatching(heaps,
heaps, facade, candidates_list, trace_coordinates, trace_timestamps, trace_gps_precision, use_tidying); facade,
candidates_list,
trace_coordinates,
trace_timestamps,
trace_gps_precision,
use_tidying);
} }
template <typename AlgorithmT> 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]; ';')[ph::bind(&engine::api::MatchParameters::timestamps, qi::_r1) = qi::_1];
preprocessing_type.add("simple", engine::api::MatchParameters::PreprocessingType::Simple)( preprocessing_type.add("simple", engine::api::MatchParameters::PreprocessingType::Simple)(
"full", engine::api::MatchParameters::PreprocessingType::Full)( "full", engine::api::MatchParameters::PreprocessingType::Full)(
"false", engine::api::MatchParameters::PreprocessingType::False); "false", engine::api::MatchParameters::PreprocessingType::False);
root_rule =
root_rule = BaseGrammar::query_rule(qi::_r1) > -qi::lit(".json") > 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]) (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: private:

View File

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

View File

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