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

routing_helpers.cpp « storage - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5abde81ba8c150b541354af7d5835a53f5ef0ca3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "storage/routing_helpers.hpp"

#include <memory>

std::unique_ptr<m4::Tree<routing::NumMwmId>> MakeNumMwmTree(
    routing::NumMwmIds const & numMwmIds, storage::CountryInfoGetter const & countryInfoGetter)
{
  auto tree = std::make_unique<m4::Tree<routing::NumMwmId>>();

  numMwmIds.ForEachId([&](routing::NumMwmId numMwmId) {
    auto const & countryName = numMwmIds.GetFile(numMwmId).GetName();
    tree->Add(numMwmId, countryInfoGetter.GetLimitRectForLeaf(countryName));
  });

  return tree;
}

std::shared_ptr<routing::NumMwmIds> CreateNumMwmIds(storage::Storage const & storage)
{
  auto numMwmIds = std::make_shared<routing::NumMwmIds>();
  storage.ForEachCountryFile(
      [&](platform::CountryFile const & file) { numMwmIds->RegisterFile(file); });
  return numMwmIds;
}