blob: aa982055df25e0bc12de7d20a8f4e3e98cc11c7c (
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
42
43
44
|
#include "search/editor_delegate.hpp"
#include "search/reverse_geocoder.hpp"
#include "indexer/feature_decl.hpp"
#include "indexer/index.hpp"
#include "indexer/index.hpp"
#include "indexer/index_helpers.hpp"
namespace search
{
EditorDelegate::EditorDelegate(Index const & index) : m_index(index) {}
MwmSet::MwmId EditorDelegate::GetMwmIdByMapName(string const & name) const
{
return m_index.GetMwmIdByCountryFile(platform::CountryFile(name));
}
unique_ptr<FeatureType> EditorDelegate::GetOriginalFeature(FeatureID const & fid) const
{
auto feature = make_unique<FeatureType>();
Index::FeaturesLoaderGuard const guard(m_index, fid.m_mwmId);
if (!guard.GetOriginalFeatureByIndex(fid.m_index, *feature))
return unique_ptr<FeatureType>();
feature->ParseEverything();
return feature;
}
string EditorDelegate::GetOriginalFeatureStreet(FeatureType & ft) const
{
search::ReverseGeocoder const coder(m_index);
auto const streets = coder.GetNearbyFeatureStreets(ft);
if (streets.second < streets.first.size())
return streets.first[streets.second].m_name;
return {};
}
void EditorDelegate::ForEachFeatureAtPoint(osm::Editor::TFeatureTypeFn && fn,
m2::PointD const & point) const
{
auto const kToleranceMeters = 1e-2;
indexer::ForEachFeatureAtPoint(m_index, move(fn), point, kToleranceMeters);
}
} // namespace search
|