示例#1
0
pair<MwmSet::MwmId, MwmSet::RegResult> FeaturesFetcher::RegisterMap(
    LocalCountryFile const & localFile)
{
  try
  {
    auto result = m_multiIndex.RegisterMap(localFile);
    if (result.second != MwmSet::RegResult::Success)
    {
      LOG(LWARNING, ("Can't add map", localFile.GetCountryName(), "(", result.second, ").",
                     "Probably it's already added or has newer data version."));
    }
    else
    {
      MwmSet::MwmId const & id = result.first;
      ASSERT(id.IsAlive(), ());
      m_rect.Add(id.GetInfo()->m_limitRect);
    }

    return result;
  }
  catch (RootException const & ex)
  {
    LOG(LERROR, ("IO error while adding", localFile.GetCountryName(), "map.", ex.Msg()));
    return make_pair(MwmSet::MwmId(), MwmSet::RegResult::BadFile);
  }
}
示例#2
0
  void GenerateVersionSections(LocalCountryFile const & localFile)
  {
    FilesContainerW routingCont(localFile.GetPath(MapOptions::CarRouting));
    // Write version for routing file that is equal to correspondent mwm file.
    FilesContainerW mwmCont(localFile.GetPath(MapOptions::Map));

    FileWriter w1 = routingCont.GetWriter(VERSION_FILE_TAG);
    FileWriter w2 = mwmCont.GetWriter(VERSION_FILE_TAG);
    version::WriteVersion(w1, my::TodayAsYYMMDD());
    version::WriteVersion(w2, my::TodayAsYYMMDD());
  }
示例#3
0
  // static
  unique_ptr<FeaturesOffsetsTable> FeaturesOffsetsTable::CreateIfNotExistsAndLoad(
      LocalCountryFile const & localFile)
  {
    string const offsetsFilePath = CountryIndexes::GetPath(localFile, CountryIndexes::Index::Offsets);

    if (Platform::IsFileExistsByFullPath(offsetsFilePath))
      return LoadImpl(offsetsFilePath);

    return CreateImpl(localFile, FilesContainerR(localFile.GetPath(MapOptions::Map)), offsetsFilePath);
  }
示例#4
0
void DeleteFromDiskWithIndexes(LocalCountryFile const & localFile, MapOptions options)
{
  DeleteCountryIndexes(localFile);
  localFile.DeleteFromDisk(options);
}