示例#1
0
  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
 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;
}