diff options
author | vng <viktor.govako@gmail.com> | 2014-07-24 21:15:16 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:21:51 +0300 |
commit | 4dda2e079c494dcb6524ddbf96135f0cadd75e16 (patch) | |
tree | 6bfa67323045f5693916e47e422459aca46c986e /search/result.hpp | |
parent | 3909bc8adce870bf1ce7f89078412d28994757e1 (diff) |
[search] Refactored emitting final search results.
Diffstat (limited to 'search/result.hpp')
-rw-r--r-- | search/result.hpp | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/search/result.hpp b/search/result.hpp index 36eb443b5d..e5cf84a202 100644 --- a/search/result.hpp +++ b/search/result.hpp @@ -20,36 +20,37 @@ public: { RESULT_FEATURE, RESULT_LATLON, - RESULT_SUGGESTION, - RESULT_POI_SUGGEST + RESULT_SUGGEST_PURE, + RESULT_SUGGEST_FROM_FEATURE }; /// For RESULT_FEATURE. - Result(FeatureID const & id, m2::PointD const & fCenter, + Result(FeatureID const & id, m2::PointD const & pt, string const & str, string const & region, - string const & flag, string const & type, - uint32_t featureType, double distance); + string const & type, uint32_t featureType); /// Used for point-like results on the map. Result(m2::PointD const & pt, string const & str, string const & type); - /// For RESULT_LATLON. - Result(m2::PointD const & fCenter, - string const & str, string const & region, - string const & flag, double distance); + /// @param[in] type Pass 0 - for RESULT_LATLON or building type for building address. + Result(m2::PointD const & pt, string const & str, + string const & region, string const & type); - /// For RESULT_SUGGESTION. + /// For RESULT_SUGGESTION_PURE. Result(string const & str, string const & suggest); + /// For RESULT_SUGGESTION_FROM_FEATURE. + Result(Result const & res, string const & suggest); + /// Strings that is displayed in the GUI. //@{ char const * GetString() const { return m_str.c_str(); } char const * GetRegionString() const { return m_region.c_str(); } - char const * GetRegionFlag() const { return m_flag.empty() ? 0 : m_flag.c_str(); } char const * GetFeatureType() const { return m_type.c_str(); } //@} bool IsSuggest() const; + bool HasPoint() const; /// Type of the result. ResultType GetResultType() const; @@ -59,15 +60,11 @@ public: FeatureID GetFeatureID() const; /// Center point of a feature. - /// @precondition GetResultType() != RESULT_SUGGESTION + /// @precondition HasPoint() == true m2::PointD GetFeatureCenter() const; - /// Distance from the current position or -1 if location is not detected. - /// @precondition GetResultType() != RESULT_SUGGESTION - double GetDistance() const; - /// String to write in the search box. - /// @precondition GetResultType() == RESULT_SUGGESTION + /// @precondition IsSuggest() == true char const * GetSuggestionString() const; bool operator== (Result const & r) const; @@ -81,9 +78,8 @@ public: private: FeatureID m_id; m2::PointD m_center; - string m_str, m_region, m_flag, m_type; + string m_str, m_region, m_type; uint32_t m_featureType; - double m_distance; string m_suggestionStr; buffer_vector<pair<uint16_t, uint16_t>, 4> m_hightlightRanges; }; @@ -154,7 +150,6 @@ struct AddressInfo void MakeFrom(search::Result const & res); - void SetPinName(string const & name); string GetPinName() const; // Caroline string GetPinType() const; // shop |