diff options
author | tatiana-yan <tatiana.kondakova@gmail.com> | 2019-03-12 18:51:44 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2019-03-18 22:38:39 +0300 |
commit | df46085bf5b3f66d194ea912c5792120bbba24eb (patch) | |
tree | 3466691d7426a51e639eff9b01db786192564fc8 /search | |
parent | f1c58fbfcc0fd0bbd98285734e9a2d9e4435a33d (diff) |
[map] Remove GetFeatureByID from Framework.
Diffstat (limited to 'search')
-rw-r--r-- | search/reverse_geocoder.cpp | 7 | ||||
-rw-r--r-- | search/reverse_geocoder.hpp | 1 | ||||
-rw-r--r-- | search/search_quality/assessment_tool/feature_info_dialog.cpp | 14 | ||||
-rw-r--r-- | search/search_quality/assessment_tool/feature_info_dialog.hpp | 7 | ||||
-rw-r--r-- | search/search_quality/assessment_tool/main_view.cpp | 8 |
5 files changed, 24 insertions, 13 deletions
diff --git a/search/reverse_geocoder.cpp b/search/reverse_geocoder.cpp index 88db2ef07e..a4c453fb8c 100644 --- a/search/reverse_geocoder.cpp +++ b/search/reverse_geocoder.cpp @@ -242,6 +242,13 @@ bool ReverseGeocoder::GetExactAddress(FeatureType & ft, Address & addr) const addr); } +bool ReverseGeocoder::GetExactAddress(FeatureID const & fid, Address & addr) const +{ + bool res; + m_dataSource.ReadFeature([&](FeatureType & ft) { res = GetExactAddress(ft, addr); }, fid); + return res; +} + bool ReverseGeocoder::GetNearbyAddress(HouseTable & table, Building const & bld, bool ignoreEdits, Address & addr) const { diff --git a/search/reverse_geocoder.hpp b/search/reverse_geocoder.hpp index 8f9d3001b1..97e79e7b65 100644 --- a/search/reverse_geocoder.hpp +++ b/search/reverse_geocoder.hpp @@ -124,6 +124,7 @@ public: /// @param addr (out) the exact address of a feature. /// @returns false if can't extruct address or ft have no house number. bool GetExactAddress(FeatureType & ft, Address & addr) const; + bool GetExactAddress(FeatureID const & fid, Address & addr) const; private: /// Helper class to incapsulate house 2 street table reloading. diff --git a/search/search_quality/assessment_tool/feature_info_dialog.cpp b/search/search_quality/assessment_tool/feature_info_dialog.cpp index be3a1ff1d5..47b09b532c 100644 --- a/search/search_quality/assessment_tool/feature_info_dialog.cpp +++ b/search/search_quality/assessment_tool/feature_info_dialog.cpp @@ -1,8 +1,7 @@ #include "search/search_quality/assessment_tool/feature_info_dialog.hpp" #include "indexer/classificator.hpp" -#include "indexer/feature.hpp" -#include "indexer/feature_algo.hpp" +#include "indexer/map_object.hpp" #include "coding/string_utf8_multilang.hpp" @@ -32,7 +31,7 @@ QLabel * MakeSelectableLabel(string const & s) } } // namespace -FeatureInfoDialog::FeatureInfoDialog(QWidget * parent, FeatureType & ft, +FeatureInfoDialog::FeatureInfoDialog(QWidget * parent, osm::MapObject const & mapObject, search::ReverseGeocoder::Address const & address, string const & locale) : QDialog(parent) @@ -40,7 +39,7 @@ FeatureInfoDialog::FeatureInfoDialog(QWidget * parent, FeatureType & ft, auto * layout = new QGridLayout(); { - auto const & id = ft.GetID(); + auto const & id = mapObject.GetID(); CHECK(id.IsValid(), ()); auto * label = new QLabel("id:"); @@ -51,7 +50,7 @@ FeatureInfoDialog::FeatureInfoDialog(QWidget * parent, FeatureType & ft, { auto * label = new QLabel("lat lon:"); - auto const ll = MercatorBounds::ToLatLon(feature::GetCenter(ft)); + auto const ll = mapObject.GetLatLon(); auto const ss = strings::to_string_dac(ll.lat, 5) + " " + strings::to_string_dac(ll.lon, 5); auto * content = MakeSelectableLabel(ss); @@ -70,7 +69,7 @@ FeatureInfoDialog::FeatureInfoDialog(QWidget * parent, FeatureType & ft, for (auto const & code : codes) { string name; - if (!ft.GetName(code, name)) + if (!mapObject.GetNameMultilang().GetString(code, name)) continue; auto const * lang = StringUtf8Multilang::GetLangByCode(code); @@ -86,7 +85,8 @@ FeatureInfoDialog::FeatureInfoDialog(QWidget * parent, FeatureType & ft, auto const & c = classif(); vector<string> types; - ft.ForEachType([&](uint32_t type) { types.push_back(c.GetReadableObjectName(type)); }); + for (auto type : mapObject.GetTypes()) + types.push_back(c.GetReadableObjectName(type)); if (!types.empty()) { diff --git a/search/search_quality/assessment_tool/feature_info_dialog.hpp b/search/search_quality/assessment_tool/feature_info_dialog.hpp index f1a875edc3..0c975b15d6 100644 --- a/search/search_quality/assessment_tool/feature_info_dialog.hpp +++ b/search/search_quality/assessment_tool/feature_info_dialog.hpp @@ -7,13 +7,16 @@ #include <QtWidgets/QDialog> #include <QtWidgets/QGridLayout> -class FeatureType; +namespace osm +{ +class MapObject; +} // namespace osm class FeatureInfoDialog : public QDialog { Q_OBJECT public: - FeatureInfoDialog(QWidget * parent, FeatureType & ft, + FeatureInfoDialog(QWidget * parent, osm::MapObject const & mapObject, search::ReverseGeocoder::Address const & address, std::string const & locale); private: diff --git a/search/search_quality/assessment_tool/main_view.cpp b/search/search_quality/assessment_tool/main_view.cpp index 267320c748..7fdf191268 100644 --- a/search/search_quality/assessment_tool/main_view.cpp +++ b/search/search_quality/assessment_tool/main_view.cpp @@ -61,12 +61,12 @@ MainView::MainView(Framework & framework) : m_framework(framework) return; } - auto ft = m_framework.GetFeatureByID(selectedFeature); - if (!ft) + auto mapObject = m_framework.GetMapObjectByID(selectedFeature); + if (!mapObject.GetID().IsValid()) return; - auto const address = m_framework.GetAddressAtPoint(feature::GetCenter(*ft)); - FeatureInfoDialog dialog(this /* parent */, *ft, address, m_sampleLocale); + auto const address = m_framework.GetAddressAtPoint(mapObject.GetMercator()); + FeatureInfoDialog dialog(this /* parent */, mapObject, address, m_sampleLocale); dialog.exec(); }, [this](bool /* switchFullScreenMode */) { m_selectedFeature = FeatureID(); }); |