Ejemplo n.º 1
0
void PreResult2::RegionInfo::GetRegion(storage::CountryInfoGetter const & infoGetter,
                                       storage::CountryInfo & info) const
{
  if (!m_file.empty())
    infoGetter.GetRegionInfo(m_file, info);
  else
    infoGetter.GetRegionInfo(m_point, info);
}
Ejemplo n.º 2
0
 shared_ptr<IRouter> CreatePedestrianRouter(Index & index,
                                            storage::CountryInfoGetter const & infoGetter)
 {
   auto countryFileGetter = [&infoGetter](m2::PointD const & pt)
   {
     return infoGetter.GetRegionFile(pt);
   };
   unique_ptr<IRouter> router = CreatePedestrianAStarBidirectionalRouter(index, countryFileGetter);
   return shared_ptr<IRouter>(move(router));
 }
Ejemplo n.º 3
0
 shared_ptr<OsrmRouter> CreateOsrmRouter(Index & index,
                                         storage::CountryInfoGetter const & infoGetter)
 {
   shared_ptr<OsrmRouter> osrmRouter(new OsrmRouter(
       &index, [&infoGetter](m2::PointD const & pt)
       {
         return infoGetter.GetRegionFile(pt);
       }
       ));
   return osrmRouter;
 }
Ejemplo n.º 4
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;
  }
Ejemplo n.º 5
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));
 }
Ejemplo n.º 6
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;
}