From 497709da13ca3e168987d1e9d862c795cedbc157 Mon Sep 17 00:00:00 2001 From: Lev Dragunov Date: Wed, 22 Mar 2017 12:00:46 +0300 Subject: [PATCH] Review fixes --- docs/http.md | 2 +- features/testbot/matching.feature | 6 +++--- include/engine/api/match_parameters.hpp | 13 +++++-------- include/server/api/match_parameter_grammar.hpp | 14 ++++++-------- src/engine/plugins/match.cpp | 4 ++-- 5 files changed, 17 insertions(+), 22 deletions(-) diff --git a/docs/http.md b/docs/http.md index f84535dad..67af020fc 100644 --- a/docs/http.md +++ b/docs/http.md @@ -280,7 +280,7 @@ In addition to the [general options](#general-options) the following options are |timestamps |`{timestamp};{timestamp}[;{timestamp} ...]` |Timestamps for the input locations in seconds since UNIX epoch. Timestamps need to be monotonically increasing. | |radiuses |`{radius};{radius}[;{radius} ...]` |Standard deviation of GPS precision used for map matching. If applicable use GPS accuracy.| |gaps |`split` (default), `ignore` |Allows the input track splitting based on huge timestamp gaps between points. | -|tidying |`true`, `false` (default) |Allows the input track modification to obtain better matching quality for noisy tracks. | +|tidy |`true`, `false` (default) |Allows the input track modification to obtain better matching quality for noisy tracks. | |Parameter |Values | |------------|-----------------------------------| diff --git a/features/testbot/matching.feature b/features/testbot/matching.feature index 3060bb713..2cae46390 100644 --- a/features/testbot/matching.feature +++ b/features/testbot/matching.feature @@ -62,7 +62,7 @@ Feature: Basic Map Matching Given a grid size of 100 meters Given the query options - | tidying | true | + | tidy | true | Given the node map """ @@ -82,7 +82,7 @@ Feature: Basic Map Matching Given a grid size of 100 meters Given the query options - | tidying | true | + | tidy | true | Given the node map """ @@ -102,7 +102,7 @@ Feature: Basic Map Matching Given a grid size of 8 meters Given the query options - | tidying | true | + | tidy | true | Given the node map """ diff --git a/include/engine/api/match_parameters.hpp b/include/engine/api/match_parameters.hpp index 37938e980..4e037fb45 100644 --- a/include/engine/api/match_parameters.hpp +++ b/include/engine/api/match_parameters.hpp @@ -63,23 +63,20 @@ struct MatchParameters : public RouteParameters RouteParameters::GeometriesType::Polyline, RouteParameters::OverviewType::Simplified, {}), - gaps_processing(GapsType::Split), use_tidying(false) + gaps(GapsType::Split), tidy(false) { } template - MatchParameters(std::vector timestamps_, - GapsType gaps_processing_, - bool use_tidying_, - Args... args_) + MatchParameters(std::vector timestamps_, GapsType gaps_, bool tidy_, Args... args_) : RouteParameters{std::forward(args_)...}, timestamps{std::move(timestamps_)}, - gaps_processing(gaps_processing_), use_tidying(use_tidying_) + gaps(gaps_), tidy(tidy_) { } std::vector timestamps; - GapsType gaps_processing; - bool use_tidying; + GapsType gaps; + bool tidy; bool IsValid() const { diff --git a/include/server/api/match_parameter_grammar.hpp b/include/server/api/match_parameter_grammar.hpp index 5a62622e2..1ea190a11 100644 --- a/include/server/api/match_parameter_grammar.hpp +++ b/include/server/api/match_parameter_grammar.hpp @@ -38,14 +38,12 @@ struct MatchParametersGrammar final : public RouteParametersGrammar -qi::lit(".json") > - -('?' > - (timestamps_rule(qi::_r1) | BaseGrammar::base_rule(qi::_r1) | - (qi::lit("gaps=") > - gaps_type[ph::bind(&engine::api::MatchParameters::gaps_processing, qi::_r1) = - qi::_1]) | - (qi::lit("tidying=") > qi::bool_[ph::bind(&engine::api::MatchParameters::use_tidying, - qi::_r1) = qi::_1])) % - '&'); + -('?' > (timestamps_rule(qi::_r1) | BaseGrammar::base_rule(qi::_r1) | + (qi::lit("gaps=") > + gaps_type[ph::bind(&engine::api::MatchParameters::gaps, qi::_r1) = qi::_1]) | + (qi::lit("tidy=") > + qi::bool_[ph::bind(&engine::api::MatchParameters::tidy, qi::_r1) = qi::_1])) % + '&'); } private: diff --git a/src/engine/plugins/match.cpp b/src/engine/plugins/match.cpp index d053cb315..88035cda6 100644 --- a/src/engine/plugins/match.cpp +++ b/src/engine/plugins/match.cpp @@ -148,7 +148,7 @@ Status MatchPlugin::HandleRequest(const datafacade::ContiguousInternalMemoryData SubMatchingList sub_matchings; api::tidy::Result tidied; - if (parameters.use_tidying) + if (parameters.tidy) { // Transparently tidy match parameters, do map matching on tidied parameters. // Then use the mapping to restore the original <-> tidied relationship. @@ -207,7 +207,7 @@ Status MatchPlugin::HandleRequest(const datafacade::ContiguousInternalMemoryData tidied.parameters.coordinates, tidied.parameters.timestamps, tidied.parameters.radiuses, - parameters.gaps_processing == api::MatchParameters::GapsType::Split); + parameters.gaps == api::MatchParameters::GapsType::Split); if (sub_matchings.size() == 0) {