diff options
author | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2017-12-20 15:34:12 +0300 |
---|---|---|
committer | Yuri Gorshenin <mipt.vi002@gmail.com> | 2017-12-20 17:48:02 +0300 |
commit | 5f5bafe1a89145576b0e451e39247fd537bce290 (patch) | |
tree | f0c92adda99887a0cf608c80c0ec397b790cf3a2 /storage | |
parent | 45ee77dea5776e55c738804486fcf9a510c3d26f (diff) |
CreateCountyInfoReader() function refactoring.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/country_info_getter.cpp | 20 | ||||
-rw-r--r-- | storage/country_info_getter.hpp | 19 | ||||
-rw-r--r-- | storage/storage_tests/helpers.cpp | 4 |
3 files changed, 13 insertions, 30 deletions
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 @@ -212,19 +212,10 @@ void CountryInfoGetter::ForEachCountry(string const & prefix, ToDo && toDo) cons // static unique_ptr<CountryInfoGetter> CountryInfoReader::CreateCountryInfoReader(Platform const & platform) { - if (platform::migrate::NeedMigrate()) - return CreateCountryInfoReaderTwoComponentMwms(platform); - return CreateCountryInfoReaderOneComponentMwms(platform); -} - -// static -unique_ptr<CountryInfoGetter> 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<CountryInfoReader>(result); } catch (RootException const & e) @@ -235,14 +226,13 @@ unique_ptr<CountryInfoGetter> CountryInfoReader::CreateCountryInfoReaderTwoCompo } // static -unique_ptr<CountryInfoGetter> CountryInfoReader::CreateCountryInfoReaderOneComponentMwms( +unique_ptr<CountryInfoGetter> 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<CountryInfoReader>(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<CountryInfoGetter> 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<CountryInfoGetter> 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<CountryInfoGetter> 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<CountryInfoGetter> 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<CountryInfoGetter> CreateCountryInfoGetter() { - return CountryInfoReader::CreateCountryInfoReaderTwoComponentMwms(GetPlatform()); + return CountryInfoReader::CreateCountryInfoReaderObsolete(GetPlatform()); } unique_ptr<storage::CountryInfoGetter> CreateCountryInfoGetterMigrate() { - return CountryInfoReader::CreateCountryInfoReaderOneComponentMwms(GetPlatform()); + return CountryInfoReader::CreateCountryInfoReader(GetPlatform()); } bool AlmostEqualRectsAbs(const m2::RectD & r1, const m2::RectD & r2) |