Fixed PP for road type mark in case of invalid featureId.

This commit is contained in:
Daria Volvenkova 2019-05-14 14:03:44 +03:00
parent 82d2324956
commit 92b26bb017
4 changed files with 27 additions and 12 deletions

View file

@ -871,7 +871,7 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message)
{
m_transitSchemeRenderer->ClearContextDependentResources(make_ref(m_overlayTree));
break;
}
}
case Message::Type::EnableTraffic:
{

View file

@ -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;
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()));
}
}
FillInfoFromFeatureType(*ft, info);
info.SetRoadType(*ft,
roadTypeMark.GetRoadWarningType(),
info.SetRoadType(roadTypeMark.GetRoadWarningType(),
RoadWarningMark::GetLocalizedRoadWarningType(roadTypeMark.GetRoadWarningType()),
roadTypeMark.GetDistance());
info.SetMercator(roadTypeMark.GetPivot());

View file

@ -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)
{

View file

@ -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