diff --git a/map/framework.cpp b/map/framework.cpp index 828010e86a..bcf791a541 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -301,7 +301,7 @@ TCountryId Framework::PreMigrate(ms::LatLon const & position, GetStorage().PrefetchMigrateData(); auto const infoGetter = - CountryInfoReader::CreateCountryInfoReaderOneComponentMwms(GetPlatform()); + CountryInfoReader::CreateCountryInfoReader(GetPlatform()); TCountryId currentCountryId = infoGetter->GetRegionCountryId(MercatorBounds::FromLatLon(position)); @@ -1354,7 +1354,11 @@ void Framework::InitCountryInfoGetter() { ASSERT(!m_infoGetter.get(), ("InitCountryInfoGetter() must be called only once.")); - m_infoGetter = CountryInfoReader::CreateCountryInfoReader(GetPlatform()); + auto const & platform = GetPlatform(); + if (platform::migrate::NeedMigrate()) + m_infoGetter = CountryInfoReader::CreateCountryInfoReaderObsolete(platform); + else + m_infoGetter = CountryInfoReader::CreateCountryInfoReader(platform); m_infoGetter->InitAffiliationsInfo(&m_storage.GetAffiliations()); } diff --git a/storage/country_info_getter.cpp b/storage/country_info_getter.cpp index 314430e683..12d74f6845 100644 --- a/storage/country_info_getter.cpp +++ b/storage/country_info_getter.cpp @@ -211,20 +211,11 @@ void CountryInfoGetter::ForEachCountry(string const & prefix, ToDo && toDo) cons // CountryInfoReader ------------------------------------------------------------------------------- // static unique_ptr CountryInfoReader::CreateCountryInfoReader(Platform const & platform) -{ - if (platform::migrate::NeedMigrate()) - return CreateCountryInfoReaderTwoComponentMwms(platform); - return CreateCountryInfoReaderOneComponentMwms(platform); -} - -// static -unique_ptr CountryInfoReader::CreateCountryInfoReaderTwoComponentMwms( - Platform const & platform) { try { - CountryInfoReader * result = new CountryInfoReader(platform.GetReader(PACKED_POLYGONS_OBSOLETE_FILE), - platform.GetReader(COUNTRIES_OBSOLETE_FILE)); + CountryInfoReader * result = new CountryInfoReader(platform.GetReader(PACKED_POLYGONS_FILE), + platform.GetReader(COUNTRIES_FILE)); return unique_ptr(result); } catch (RootException const & e) @@ -235,14 +226,13 @@ unique_ptr CountryInfoReader::CreateCountryInfoReaderTwoCompo } // static -unique_ptr CountryInfoReader::CreateCountryInfoReaderOneComponentMwms( +unique_ptr CountryInfoReader::CreateCountryInfoReaderObsolete( Platform const & platform) { try { - CountryInfoReader * result = - new CountryInfoReader(platform.GetReader(PACKED_POLYGONS_FILE), - platform.GetReader(COUNTRIES_FILE)); + CountryInfoReader * result = new CountryInfoReader(platform.GetReader(PACKED_POLYGONS_OBSOLETE_FILE), + platform.GetReader(COUNTRIES_OBSOLETE_FILE)); return unique_ptr(result); } catch (RootException const & e) diff --git a/storage/country_info_getter.hpp b/storage/country_info_getter.hpp index 02680ed0fe..b3584d5086 100644 --- a/storage/country_info_getter.hpp +++ b/storage/country_info_getter.hpp @@ -130,21 +130,14 @@ protected: class CountryInfoReader : public CountryInfoGetter { public: - // This is the proper way to obtain a CountryInfoReader because - // it accounts for migration and such. + /// \brief The newer version. Use this one after the migration to single-component + /// mwm files has been carried out. static unique_ptr CreateCountryInfoReader(Platform const & platform); - // The older version. The polygons are read from a file that was - // used at the time when routing and map data were in different files. - // This is a legacy method and it is extremely unlikely that you need it in your code. - static unique_ptr CreateCountryInfoReaderTwoComponentMwms( - Platform const & platform); - - // The newer version. Use this one after the migration to single-component - // mwm files has been carried out. - // This is a legacy method and it is extremely unlikely that you need it in your code. - static unique_ptr CreateCountryInfoReaderOneComponentMwms( - Platform const & platform); + /// \brief The older version. The polygons are read from a file that was + /// used at the time when routing and map data were in different files. + /// \note This method should be used for test on migration. + static unique_ptr CreateCountryInfoReaderObsolete(Platform const & platform); protected: CountryInfoReader(ModelReaderPtr polyR, ModelReaderPtr countryR); diff --git a/storage/storage_tests/helpers.cpp b/storage/storage_tests/helpers.cpp index 9efdcdd157..f53d424923 100644 --- a/storage/storage_tests/helpers.cpp +++ b/storage/storage_tests/helpers.cpp @@ -10,12 +10,12 @@ namespace storage { unique_ptr CreateCountryInfoGetter() { - return CountryInfoReader::CreateCountryInfoReaderTwoComponentMwms(GetPlatform()); + return CountryInfoReader::CreateCountryInfoReaderObsolete(GetPlatform()); } unique_ptr CreateCountryInfoGetterMigrate() { - return CountryInfoReader::CreateCountryInfoReaderOneComponentMwms(GetPlatform()); + return CountryInfoReader::CreateCountryInfoReader(GetPlatform()); } bool AlmostEqualRectsAbs(const m2::RectD & r1, const m2::RectD & r2)