diff options
author | Daria Volvenkova <d.volvenkova@corp.mail.ru> | 2019-07-30 14:32:27 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2019-08-02 14:54:56 +0300 |
commit | de13e784c1f709c7f4731203b1e1973e90d6c915 (patch) | |
tree | 93d40ab9fca7f40d31a7b53ef7338d526b4f8e49 /search/reverse_geocoder.hpp | |
parent | dab80418567b61cffec24225a2179660ab5f17d8 (diff) |
[bookmarks][geocoder] Review fixes.
Diffstat (limited to 'search/reverse_geocoder.hpp')
-rw-r--r-- | search/reverse_geocoder.hpp | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/search/reverse_geocoder.hpp b/search/reverse_geocoder.hpp index 365bd057a0..f746ef72a6 100644 --- a/search/reverse_geocoder.hpp +++ b/search/reverse_geocoder.hpp @@ -57,7 +57,7 @@ public: /// All "Nearby" functions work in this lookup radius. static int constexpr kLookupRadiusM = 500; - ReverseGeocoder(DataSource const & dataSource); + explicit ReverseGeocoder(DataSource const & dataSource); struct Street : public Object { @@ -102,30 +102,16 @@ public: struct RegionAddress { + // CountryId is set in case when FeatureID is not found or belongs to World.wmw + // and we can't get country name from it. storage::CountryId m_countryId; FeatureID m_featureId; - bool operator==(RegionAddress const & rhs) const - { - return m_countryId == rhs.m_countryId && m_featureId == rhs.m_featureId; - } - - bool operator!=(RegionAddress const & rhs) const { return !(*this == rhs); } - bool operator<(RegionAddress const & rhs) const - { - if (m_countryId == rhs.m_countryId) - return m_featureId < rhs.m_featureId; - return m_countryId < rhs.m_countryId; - } - - bool IsValid() const { return storage::IsCountryIdValid(m_countryId) || m_featureId.IsValid(); } - - std::string GetCountryName() const - { - if (m_featureId.IsValid() && m_featureId.m_mwmId.GetInfo()->GetType() != MwmInfo::WORLD) - return m_featureId.m_mwmId.GetInfo()->GetCountryName(); - return m_countryId; - } + bool IsValid() const; + std::string GetCountryName() const; + bool operator==(RegionAddress const & rhs) const; + bool operator!=(RegionAddress const & rhs) const; + bool operator<(RegionAddress const & rhs) const; }; friend std::string DebugPrint(Address const & addr); @@ -163,10 +149,12 @@ public: bool GetExactAddress(FeatureType & ft, Address & addr) const; bool GetExactAddress(FeatureID const & fid, Address & addr) const; - /// @return The nearest region address where mwm or exact city known. - static RegionAddress GetNearbyRegionAddress(m2::PointD const & center, storage::CountryInfoGetter const & infoGetter, + /// Returns the nearest region address where mwm or exact city is known. + static RegionAddress GetNearbyRegionAddress(m2::PointD const & center, + storage::CountryInfoGetter const & infoGetter, CityFinder & cityFinder); - std::string GetLocalizedRegionAdress(RegionAddress const & addr, RegionInfoGetter const & nameGetter) const; + std::string GetLocalizedRegionAddress(RegionAddress const & addr, + RegionInfoGetter const & nameGetter) const; private: /// Helper class to incapsulate house 2 street table reloading. |