diff options
author | Alex Zolotarev <alex@maps.me> | 2016-03-17 19:37:00 +0300 |
---|---|---|
committer | Sergey Yershov <yershov@corp.mail.ru> | 2016-03-23 16:56:55 +0300 |
commit | b98d56399c26603917244a137f87683e596ed208 (patch) | |
tree | a8148fde5b1c2e7f5e7e39ff05ea1fce28861451 | |
parent | 88fddc38b762e4493eab69014a7045e3660ca048 (diff) |
Get unformatted elevation for editor.
-rw-r--r-- | indexer/map_object.cpp | 5 | ||||
-rw-r--r-- | indexer/map_object.hpp | 1 | ||||
-rw-r--r-- | qt/editor_dialog.cpp | 8 |
3 files changed, 13 insertions, 1 deletions
diff --git a/indexer/map_object.cpp b/indexer/map_object.cpp index 5909d40c49..17891111f3 100644 --- a/indexer/map_object.cpp +++ b/indexer/map_object.cpp @@ -173,6 +173,11 @@ string MapObject::GetElevationFormatted() const return {}; } +bool MapObject::GetElevation(double & outElevationInMeters) const +{ + return strings::to_double(m_metadata.Get(feature::Metadata::FMD_ELE), outElevationInMeters); +} + string MapObject::GetWikipediaLink() const { return m_metadata.GetWikiURL(); } string MapObject::GetFlats() const { return m_metadata.Get(feature::Metadata::FMD_FLATS); } diff --git a/indexer/map_object.hpp b/indexer/map_object.hpp index d245bb52b1..eeef2421c2 100644 --- a/indexer/map_object.hpp +++ b/indexer/map_object.hpp @@ -83,6 +83,7 @@ public: int GetStars() const; /// @returns formatted elevation in feet or meters, or empty string. string GetElevationFormatted() const; + bool GetElevation(double & outElevationInMeters) const; /// @returns URL to Wikipedia or empty string. string GetWikipediaLink() const; string GetFlats() const; diff --git a/qt/editor_dialog.cpp b/qt/editor_dialog.cpp index 0db4ffb15e..846a85e165 100644 --- a/qt/editor_dialog.cpp +++ b/qt/editor_dialog.cpp @@ -135,7 +135,13 @@ EditorDialog::EditorDialog(QWidget * parent, osm::EditableMapObject & emo) case osm::Props::OpeningHours: v = emo.GetOpeningHours(); break; case osm::Props::Stars: v = strings::to_string(emo.GetStars()); break; case osm::Props::Operator: v = emo.GetOperator(); break; - case osm::Props::Elevation: v = emo.GetElevationFormatted(); break; + case osm::Props::Elevation: + { + double ele; + if (emo.GetElevation(ele)) + v = strings::to_string_dac(ele, 2); + } + break; case osm::Props::Wikipedia: v = emo.GetWikipedia(); break; case osm::Props::Flats: v = emo.GetFlats(); break; case osm::Props::BuildingLevels: v = emo.GetBuildingLevels(); break; |