Added coordinates as subtitle to unknown place (#6791)

* Added coordinates as subtitle to unknown place

* Review fixes
This commit is contained in:
Roman Kuznetsov 2017-08-04 13:48:33 +03:00 committed by Vlad Mihaylenko
parent b7b8c886ac
commit 020f362572
3 changed files with 22 additions and 3 deletions

View file

@ -879,9 +879,10 @@ void Framework::FillPointInfo(m2::PointD const & mercator, string const & custom
}
else
{
auto const customName =
customTitle.empty() ? m_stringsBundle.GetString("placepage_unknown_place") : customTitle;
info.SetCustomName(customName);
if (customTitle.empty())
info.SetCustomNameWithCoordinates(mercator, m_stringsBundle.GetString("placepage_unknown_place"));
else
info.SetCustomName(customTitle);
info.SetCanEditOrAdd(CanEditMap());
}

View file

@ -143,6 +143,23 @@ void Info::SetCustomName(std::string const & name)
m_customName = name;
}
void Info::SetCustomNameWithCoordinates(m2::PointD const & mercator, std::string const & name)
{
if (IsBookmark())
{
m_uiTitle = GetBookmarkData().GetName();
m_uiSubtitle = m_bookmarkCategoryName;
}
else
{
m_uiTitle = name;
m_uiSubtitle = measurement_utils::FormatLatLon(MercatorBounds::YToLat(mercator.y),
MercatorBounds::XToLon(mercator.x),
true /* withSemicolon */);
}
m_customName = name;
}
void Info::SetBac(BookmarkAndCategory const & bac)
{
m_bac = bac;

View file

@ -98,6 +98,7 @@ public:
/// UI setters
void SetCustomName(std::string const & name);
void SetCustomNameWithCoordinates(m2::PointD const & mercator, std::string const & name);
void SetAddress(std::string const & address) { m_address = address; }
void SetIsMyPosition() { m_isMyPosition = true; }
void SetCanEditOrAdd(bool canEditOrAdd) { m_canEditOrAdd = canEditOrAdd; }