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

editor_delegate.cpp « search - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ace89a9ca49dbaa4fd44cf7ab77b9098f6860e74 (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
38
39
40
41
#include "search/editor_delegate.hpp"

#include "search/reverse_geocoder.hpp"

#include "editor/editable_data_source.hpp"

#include "indexer/data_source_helpers.hpp"
#include "indexer/feature_decl.hpp"

namespace search
{
EditorDelegate::EditorDelegate(DataSource const & dataSource) : m_dataSource(dataSource) {}

MwmSet::MwmId EditorDelegate::GetMwmIdByMapName(string const & name) const
{
  return m_dataSource.GetMwmIdByCountryFile(platform::CountryFile(name));
}

unique_ptr<FeatureType> EditorDelegate::GetOriginalFeature(FeatureID const & fid) const
{
  FeaturesLoaderGuard guard(m_dataSource, fid.m_mwmId);
  auto feature = guard.GetOriginalFeatureByIndex(fid.m_index);
  if (feature)
    feature->ParseEverything();

  return feature;
}

string EditorDelegate::GetOriginalFeatureStreet(FeatureType & ft) const
{
  search::ReverseGeocoder const coder(m_dataSource);
  return coder.GetOriginalFeatureStreetName(ft);
}

void EditorDelegate::ForEachFeatureAtPoint(osm::Editor::FeatureTypeFn && fn,
                                           m2::PointD const & point) const
{
  auto const kToleranceMeters = 1e-2;
  indexer::ForEachFeatureAtPoint(m_dataSource, move(fn), point, kToleranceMeters);
}
}  // namespace search