/
githubmirror
/
omim
Обзор
Документация
Войти
/
githubmirror
/
omim
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
android-release-9.1.7
generator/utils.cpp
57 строк
2 KB
tatiana-yan
[generator] Change feature id to osm id mapping type from uint32_t->vector<GeoObjectId> to uint32_t->GeoObjectId
22 апр 2019, 13:01
22 апр 2019, 13:01
0bda46a
Код
Авторство
О чём код?
#include "generator/utils.hpp" #include "platform/local_country_file.hpp" #include "platform/local_country_file_utils.hpp" #include "platform/platform.hpp" #include "base/assert.hpp" #include "base/logging.hpp" #include <vector> namespace generator { // SingleMwmDataSource ----------------------------------------------------------------------------- SingleMwmDataSource::SingleMwmDataSource(std::string const & mwmPath) { m_countryFile = platform::LocalCountryFile::MakeTemporary(mwmPath); m_countryFile.SyncWithDisk(); CHECK_EQUAL( m_countryFile.GetFiles(), MapOptions::MapWithCarRouting, ("No correct mwm corresponding to local country file:", m_countryFile, ". Path:", mwmPath)); auto const result = m_dataSource.Register(m_countryFile); CHECK_EQUAL(result.second, MwmSet::RegResult::Success, ()); CHECK(result.first.IsAlive(), ()); m_mwmId = result.first; } void LoadDataSource(DataSource & dataSource) { std::vector<platform::LocalCountryFile> localFiles; Platform & platform = GetPlatform(); platform::FindAllLocalMapsInDirectoryAndCleanup(platform.WritableDir(), 0 /* version */, -1 /* latestVersion */, localFiles); for (auto const & localFile : localFiles) { LOG(LINFO, ("Found mwm:", localFile)); try { dataSource.RegisterMap(localFile); } catch (RootException const & ex) { CHECK(false, (ex.Msg(), "Bad mwm file:", localFile)); } } } bool ParseFeatureIdToOsmIdMapping(std::string const & path, std::unordered_map<uint32_t, base::GeoObjectId> & mapping) { return ForEachOsmId2FeatureId(path, [&](base::GeoObjectId const & osmId, uint32_t const featureId) { CHECK(mapping.emplace(featureId, osmId).second, ("Several osm ids for feature", featureId, "in file", path)); }); } } // namespace generator