コード例 #1
0
ファイル: routing_test_tools.cpp プロジェクト: Mapotempo/omim
  unique_ptr<CarRouter> CreateCarRouter(Index & index,
                                        storage::CountryInfoGetter const & infoGetter,
                                        traffic::TrafficCache const & trafficCache)
  {
    auto const countryFileGetter = [&infoGetter](m2::PointD const & pt) {
      return infoGetter.GetRegionCountryId(pt);
    };

    auto carRouter = make_unique<CarRouter>(index, countryFileGetter,
                                            SingleMwmRouter::CreateCarRouter(index, trafficCache));
    return carRouter;
  }
コード例 #2
0
ファイル: routing_test_tools.cpp プロジェクト: Mapotempo/omim
 unique_ptr<IRouter> CreateAStarRouter(Index & index,
                                       storage::CountryInfoGetter const & infoGetter,
                                       TRouterFactory const & routerFactory)
 {
   // |infoGetter| should be a reference to an object which exists while the
   // result of the function is used.
   auto countryFileGetter = [&infoGetter](m2::PointD const & pt)
   {
     return infoGetter.GetRegionCountryId(pt);
   };
   unique_ptr<IRouter> router = routerFactory(index, countryFileGetter);
   return unique_ptr<IRouter>(move(router));
 }
コード例 #3
0
// RankerResult::RegionInfo ------------------------------------------------------------------------
bool RankerResult::RegionInfo::GetCountryId(storage::CountryInfoGetter const & infoGetter,
                                            storage::CountryId & countryId) const
{
  if (!m_countryId.empty())
  {
    countryId = m_countryId;
    return true;
  }

  auto const id = infoGetter.GetRegionCountryId(m_point);
  if (id != storage::kInvalidCountryId)
  {
    countryId = id;
    return true;
  }

  return false;
}