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

city_finder.cpp « search - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 18d388797601744c4d0feb322796a61ec20210fe (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
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "search/city_finder.hpp"

#include "indexer/feature_decl.hpp"

using namespace std;

namespace search
{
CityFinder::CityFinder(DataSource const & dataSource)
  : m_unusedBoundaries(dataSource)
  , m_unusedCache(m_cancellable)
  , m_finder(dataSource, m_unusedBoundaries, m_unusedCache)
{
}

string CityFinder::GetCityName(m2::PointD const & p, int8_t lang)
{
  string city;
  m_finder.GetLocality(
      p, [&](LocalityItem const & item) { item.GetSpecifiedOrDefaultName(lang, city); });
  return city;
}

string CityFinder::GetCityReadableName(m2::PointD const & p)
{
  string city;
  m_finder.GetLocality(p, [&](LocalityItem const & item) { item.GetReadableName(city); });
  return city;
}

FeatureID CityFinder::GetCityFeatureID(m2::PointD const & p)
{
  FeatureID id;
  m_finder.GetLocality(p, [&id](LocalityItem const & item) { id = item.m_id; });
  return id;
}
}  // namespace search