Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--map/framework.cpp8
-rw-r--r--storage/country_info_getter.cpp20
-rw-r--r--storage/country_info_getter.hpp19
-rw-r--r--storage/storage_tests/helpers.cpp4
4 files changed, 19 insertions, 32 deletions
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
@@ -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)