| 375 | } |
| 376 | |
| 377 | int main(int argc, char ** argv) |
| 378 | { |
| 379 | platform::tests_support::ChangeMaxNumberOfOpenFiles(search::search_quality::kMaxOpenFiles); |
| 380 | if (argc <= 1) |
| 381 | { |
| 382 | LOG(LERROR, ("Usage:", argc == 1 ? argv[0] : "feature_list", "<mwm_path> [<data_path>] [<mwm_prefix>]")); |
| 383 | return 1; |
| 384 | } |
| 385 | |
| 386 | Platform & pl = GetPlatform(); |
| 387 | pl.SetWritableDirForTests(argv[1]); |
| 388 | |
| 389 | string countriesFile = COUNTRIES_FILE; |
| 390 | if (argc > 2) |
| 391 | { |
| 392 | pl.SetResourceDir(argv[2]); |
| 393 | countriesFile = base::JoinPath(argv[2], COUNTRIES_FILE); |
| 394 | } |
| 395 | |
| 396 | storage::Storage storage(countriesFile, argv[1]); |
| 397 | storage.Init(&DidDownload, &WillDelete); |
| 398 | auto infoGetter = storage::CountryInfoReader::CreateCountryInfoGetter(pl); |
| 399 | infoGetter->SetAffiliations(storage.GetAffiliations()); |
| 400 | |
| 401 | GetStyleReader().SetCurrentStyle(MapStyleMerged); |
| 402 | classificator::Load(); |
| 403 | |
| 404 | FrozenDataSource dataSource; |
| 405 | vector<platform::LocalCountryFile> mwms; |
| 406 | platform::FindAllLocalMapsAndCleanup(numeric_limits<int64_t>::max() /* the latest version */, mwms); |
| 407 | for (auto & mwm : mwms) |
| 408 | { |
| 409 | mwm.SyncWithDisk(); |
| 410 | auto const & p = dataSource.RegisterMap(mwm); |
| 411 | CHECK_EQUAL(MwmSet::RegResult::Success, p.second, ("Could not register map", mwm)); |
| 412 | MwmSet::MwmId const & id = p.first; |
| 413 | CHECK(id.IsAlive(), ("Mwm is not alive?", mwm)); |
| 414 | } |
| 415 | |
| 416 | Processor doProcess(dataSource); |
| 417 | PrintHeader(); |
| 418 | vector<shared_ptr<MwmInfo>> mwmInfos; |
| 419 | dataSource.GetMwmsInfo(mwmInfos); |
| 420 | for (auto const & mwmInfo : mwmInfos) |
| 421 | { |
| 422 | if (mwmInfo->GetType() != MwmInfo::COUNTRY) |
| 423 | continue; |
| 424 | if (argc > 3 && !(mwmInfo->GetCountryName() + DATA_FILE_EXTENSION).starts_with(argv[3])) |
| 425 | continue; |
| 426 | LOG(LINFO, ("Processing", mwmInfo->GetCountryName())); |
| 427 | string osmToFeatureFile = |
| 428 | base::JoinPath(argv[1], mwmInfo->GetCountryName() + DATA_FILE_EXTENSION + OSM2FEATURE_FILE_EXTENSION); |
| 429 | map<uint32_t, base::GeoObjectId> featureIdToOsmId; |
| 430 | ParseFeatureIdToOsmIdMapping(osmToFeatureFile, featureIdToOsmId); |
| 431 | MwmSet::MwmId mwmId(mwmInfo); |
| 432 | FeaturesLoaderGuard loader(dataSource, mwmId); |
| 433 | for (uint32_t ftIndex = 0; ftIndex < loader.GetNumFeatures(); ftIndex++) |
| 434 | if (auto ft = loader.GetFeatureByIndex(static_cast<uint32_t>(ftIndex))) |
nothing calls this directly
no test coverage detected