bool CountDataSize(osmscout::Progress& progress, const std::string& mapPath, double& dataSize) { std::string fileName; osmscout::FileOffset fileSize=0; std::vector<std::string> files; files.push_back("types.dat"); files.push_back("bounding.dat"); files.push_back("nodes.dat"); files.push_back("areas.dat"); files.push_back("ways.dat"); files.push_back("areasopt.dat"); files.push_back("waysopt.dat"); files.push_back("areanode.idx"); files.push_back("areaarea.idx"); files.push_back("areaway.idx"); files.push_back("location.idx"); files.push_back("water.idx"); files.push_back("intersections.dat"); files.push_back("intersections.idx"); files.push_back("routefoot.dat"); files.push_back("routefoot2.dat"); files.push_back("routefoot.idx"); files.push_back("routebicycle.dat"); files.push_back("routebicycle2.dat"); files.push_back("routebicycle.idx"); files.push_back("routecar.dat"); files.push_back("routecar2.dat"); files.push_back("routecar.idx"); dataSize=0; for (const auto& filename : files) { std::string filePath=osmscout::AppendFileToDir(mapPath, filename); if (!GetFileSize(filePath, fileSize)) { return false; } progress.Info(std::string("File ")+filename+": "+osmscout::ByteSizeToString(fileSize)); dataSize+=fileSize; } return true; }
bool CountDataSize(const osmscout::ImportParameter& parameter, osmscout::Progress& progress, double& dataSize) { std::string fileName; osmscout::FileOffset fileSize=0; std::vector<std::string> files; files.push_back("types.dat"); files.push_back("bounding.dat"); files.push_back("nodes.dat"); files.push_back("areas.dat"); files.push_back("ways.dat"); files.push_back("areasopt.dat"); files.push_back("waysopt.dat"); files.push_back("areanode.idx"); files.push_back("areaarea.idx"); files.push_back("areaway.idx"); files.push_back("location.idx"); files.push_back("water.idx"); if (!parameter.GetRouter().empty()) { files.push_back("intersections.dat"); files.push_back("intersections.idx"); for (const auto& router : parameter.GetRouter()) { files.push_back(router.GetDataFilename()); files.push_back(router.GetVariantFilename()); files.push_back(router.GetIndexFilename()); } } dataSize=0; for (const auto& filename : files) { std::string filePath=osmscout::AppendFileToDir(parameter.GetDestinationDirectory(), filename); if (!GetFileSize(filePath, fileSize)) { return false; } progress.Info(std::string("File ")+filename+": "+osmscout::ByteSizeToString(fileSize)); dataSize+=fileSize; } return true; }
bool DumpDataSize(const osmscout::ImportParameter& parameter, const osmscout::Importer& importer, osmscout::Progress& progress) { osmscout::FileOffset dataSize=0; progress.Info("Mandatory files:"); try { for (const auto& filename : importer.GetProvidedFiles()) { osmscout::FileOffset fileSize=0; std::string filePath=osmscout::AppendFileToDir(parameter.GetDestinationDirectory(), filename); fileSize=osmscout::GetFileSize(filePath); progress.Info(std::string("File ")+filename+": "+osmscout::ByteSizeToString(fileSize)); dataSize+=fileSize; } progress.Info(std::string("=> ")+osmscout::ByteSizeToString(dataSize)); progress.Info("Optional files:"); dataSize=0; for (const auto& filename : importer.GetProvidedOptionalFiles()) { osmscout::FileOffset fileSize=0; std::string filePath=osmscout::AppendFileToDir(parameter.GetDestinationDirectory(), filename); fileSize=osmscout::GetFileSize(filePath); progress.Info(std::string("File ")+filename+": "+osmscout::ByteSizeToString(fileSize)); dataSize+=fileSize; } progress.Info(std::string("=> ")+osmscout::ByteSizeToString(dataSize)); } catch (osmscout::IOException& e) { progress.Error(e.GetDescription()); return false; } return true; }