diff options
author | Daria Volvenkova <d.volvenkova@corp.mail.ru> | 2019-05-14 14:03:44 +0300 |
---|---|---|
committer | Daria Volvenkova <d.volvenkova@corp.mail.ru> | 2019-05-17 18:45:59 +0300 |
commit | 92b26bb017a96561a8a2c92d72966b5578b9a21c (patch) | |
tree | 4ffc606766dba19c15ac32aef77c39d5565a54d9 /map | |
parent | 82d2324956b96ce4ea2bc0430f62f5867a9b8bf7 (diff) |
Fixed PP for road type mark in case of invalid featureId.
Diffstat (limited to 'map')
-rw-r--r-- | map/framework.cpp | 29 | ||||
-rw-r--r-- | map/place_page_info.cpp | 7 | ||||
-rw-r--r-- | map/place_page_info.hpp | 1 |
3 files changed, 26 insertions, 11 deletions
diff --git a/map/framework.cpp b/map/framework.cpp index 201315e112..b9acb9de17 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -1053,20 +1053,27 @@ void Framework::FillRouteMarkInfo(RouteMarkPoint const & rmp, place_page::Info & void Framework::FillRoadTypeMarkInfo(RoadWarningMark const & roadTypeMark, place_page::Info & info) const { - CHECK(roadTypeMark.GetFeatureID().IsValid(), ()); - - FeaturesLoaderGuard const guard(m_model.GetDataSource(), roadTypeMark.GetFeatureID().m_mwmId); - auto ft = guard.GetFeatureByIndex(roadTypeMark.GetFeatureID().m_index); - if (!ft) + if (roadTypeMark.GetFeatureID().IsValid()) { - LOG(LERROR, ("Feature can't be loaded:", roadTypeMark.GetFeatureID())); - return; - } - FillInfoFromFeatureType(*ft, info); + FeaturesLoaderGuard const guard(m_model.GetDataSource(), roadTypeMark.GetFeatureID().m_mwmId); + auto ft = guard.GetFeatureByIndex(roadTypeMark.GetFeatureID().m_index); + if (ft) + { + FillInfoFromFeatureType(*ft, info); + info.SetRoadType(*ft, roadTypeMark.GetRoadWarningType(), + RoadWarningMark::GetLocalizedRoadWarningType(roadTypeMark.GetRoadWarningType()), + roadTypeMark.GetDistance()); + info.SetMercator(roadTypeMark.GetPivot()); + return; + } + else + { + LOG(LERROR, ("Feature can't be loaded:", roadTypeMark.GetFeatureID())); + } + } - info.SetRoadType(*ft, - roadTypeMark.GetRoadWarningType(), + info.SetRoadType(roadTypeMark.GetRoadWarningType(), RoadWarningMark::GetLocalizedRoadWarningType(roadTypeMark.GetRoadWarningType()), roadTypeMark.GetDistance()); info.SetMercator(roadTypeMark.GetPivot()); diff --git a/map/place_page_info.cpp b/map/place_page_info.cpp index 5c4849984b..8ef05c1f24 100644 --- a/map/place_page_info.cpp +++ b/map/place_page_info.cpp @@ -332,6 +332,13 @@ void Info::SetPartnerIndex(int index) m_partnerName = GetPartnerByIndex(m_partnerIndex).m_name; } +void Info::SetRoadType(RoadWarningMarkType type, std::string const & localizedType, std::string const & distance) +{ + m_roadType = type; + m_uiTitle = localizedType; + m_uiSubtitle = distance; +} + void Info::SetRoadType(FeatureType & ft, RoadWarningMarkType type, std::string const & localizedType, std::string const & distance) { diff --git a/map/place_page_info.hpp b/map/place_page_info.hpp index 04268f9763..b747b0a605 100644 --- a/map/place_page_info.hpp +++ b/map/place_page_info.hpp @@ -212,6 +212,7 @@ public: /// Road type void SetRoadType(FeatureType & ft, RoadWarningMarkType type, std::string const & localizedType, std::string const & distance); + void SetRoadType(RoadWarningMarkType type, std::string const & localizedType, std::string const & distance); RoadWarningMarkType GetRoadType() const { return m_roadType; } /// CountryId |