diff --git a/include/engine/api/match_parameters.hpp b/include/engine/api/match_parameters.hpp index f27fe7829..cfb275edc 100644 --- a/include/engine/api/match_parameters.hpp +++ b/include/engine/api/match_parameters.hpp @@ -63,13 +63,17 @@ struct MatchParameters : public RouteParameters false, RouteParameters::GeometriesType::Polyline, RouteParameters::OverviewType::Simplified, - {}), track_preprocessing(PreprocessingType::Simple) + {}), + track_preprocessing(PreprocessingType::Simple) { } template - MatchParameters(std::vector timestamps_, PreprocessingType track_preprocessing_, Args... args_) - : RouteParameters{std::forward(args_)...}, timestamps{std::move(timestamps_)}, track_preprocessing(track_preprocessing_) + MatchParameters(std::vector timestamps_, + PreprocessingType track_preprocessing_, + Args... args_) + : RouteParameters{std::forward(args_)...}, timestamps{std::move(timestamps_)}, + track_preprocessing(track_preprocessing_) { } diff --git a/include/engine/routing_algorithms.hpp b/include/engine/routing_algorithms.hpp index 5bc8bd75d..20ac3faee 100644 --- a/include/engine/routing_algorithms.hpp +++ b/include/engine/routing_algorithms.hpp @@ -80,12 +80,12 @@ template class RoutingAlgorithms final : public RoutingAlg const std::vector &source_indices, const std::vector &target_indices) const final override; - routing_algorithms::SubMatchingList MapMatching( - const routing_algorithms::CandidateLists &candidates_list, - const std::vector &trace_coordinates, - const std::vector &trace_timestamps, - const std::vector> &trace_gps_precision, - const bool use_tidying) const final override; + routing_algorithms::SubMatchingList + MapMatching(const routing_algorithms::CandidateLists &candidates_list, + const std::vector &trace_coordinates, + const std::vector &trace_timestamps, + const std::vector> &trace_gps_precision, + const bool use_tidying) const final override; std::vector GetTileTurns(const std::vector &edges, @@ -168,8 +168,13 @@ inline routing_algorithms::SubMatchingList RoutingAlgorithms::MapMat const std::vector> &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 diff --git a/include/server/api/match_parameter_grammar.hpp b/include/server/api/match_parameter_grammar.hpp index 672d8bddb..e89264f21 100644 --- a/include/server/api/match_parameter_grammar.hpp +++ b/include/server/api/match_parameter_grammar.hpp @@ -34,14 +34,17 @@ struct MatchParametersGrammar final : public RouteParametersGrammar -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: diff --git a/src/engine/plugins/match.cpp b/src/engine/plugins/match.cpp index 264cfb67c..cb84079f6 100644 --- a/src/engine/plugins/match.cpp +++ b/src/engine/plugins/match.cpp @@ -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 &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 &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) diff --git a/src/engine/routing_algorithms/map_matching.cpp b/src/engine/routing_algorithms/map_matching.cpp index a1c41d39a..97d2b5d35 100644 --- a/src/engine/routing_algorithms/map_matching.cpp +++ b/src/engine/routing_algorithms/map_matching.cpp @@ -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 {