forked from organicmaps/organicmaps-tmp
add local_ref to transport stop titles
(better localisation in future pr) Signed-off-by: Harry Bond <hrbond@pm.me>
This commit is contained in:
parent
6653955bf1
commit
37bfc0b65b
4 changed files with 39 additions and 7 deletions
|
@ -225,5 +225,6 @@ ftraits::WheelchairAvailability MapObject::GetWheelchairType() const
|
|||
|
||||
bool MapObject::IsPointType() const { return m_geomType == feature::GeomType::Point; }
|
||||
bool MapObject::IsBuilding() const { return ftypes::IsBuildingChecker::Instance()(m_types); }
|
||||
bool MapObject::IsPublicTransportStop() const { return ftypes::IsPublicTransportStopChecker::Instance()(m_types); }
|
||||
|
||||
} // namespace osm
|
||||
|
|
|
@ -119,6 +119,9 @@ public:
|
|||
/// @returns true if object is of building type.
|
||||
bool IsBuilding() const;
|
||||
|
||||
/// @returns true if object is a public transport stop type.
|
||||
bool IsPublicTransportStop() const;
|
||||
|
||||
void AssignMetadata(feature::Metadata & dest) const { dest = m_metadata; }
|
||||
|
||||
protected:
|
||||
|
|
|
@ -67,12 +67,25 @@ void Info::SetFromFeatureType(FeatureType & ft)
|
|||
m_uiSubtitle = FormatSubtitle(true /* withType */);
|
||||
m_uiAddress = m_address;
|
||||
}
|
||||
else if (!m_primaryFeatureName.empty())
|
||||
else if (IsPublicTransportStop())
|
||||
{
|
||||
m_uiTitle = m_primaryFeatureName;
|
||||
m_uiSecondaryTitle = out.secondary;
|
||||
m_uiSubtitle = FormatSubtitle(true /* withType */);
|
||||
m_uiAddress = m_address;
|
||||
const std::string local_ref = std::string(GetMetadata(feature::Metadata::FMD_LOCAL_REF));
|
||||
|
||||
if (!local_ref.empty()) // has local ref
|
||||
{
|
||||
if (!m_primaryFeatureName.empty()) // has name and local_ref
|
||||
{
|
||||
m_uiTitle = m_primaryFeatureName + " (" + local_ref + ")";
|
||||
m_uiSubtitle = FormatSubtitle(true /* withType */);
|
||||
}
|
||||
else // no name but has local_ref
|
||||
{
|
||||
m_uiTitle = GetLocalizedType() + " (" + local_ref + ")";
|
||||
m_uiSubtitle = FormatSubtitle(false /* withType */);
|
||||
}
|
||||
}
|
||||
else
|
||||
SetStandardValues(out);
|
||||
}
|
||||
else if (IsBuilding())
|
||||
{
|
||||
|
@ -80,14 +93,28 @@ void Info::SetFromFeatureType(FeatureType & ft)
|
|||
m_uiTitle = isAddressEmpty ? GetLocalizedType() : m_address;
|
||||
m_uiSubtitle = FormatSubtitle(!isAddressEmpty /* withType */);
|
||||
}
|
||||
else
|
||||
SetStandardValues(out);
|
||||
|
||||
// apply to all types after checks
|
||||
m_hotelType = ftypes::IsHotelChecker::Instance().GetHotelType(ft);
|
||||
}
|
||||
|
||||
void Info::SetStandardValues(feature::NameParamsOut out)
|
||||
{
|
||||
if (!m_primaryFeatureName.empty())
|
||||
{
|
||||
m_uiTitle = m_primaryFeatureName;
|
||||
m_uiSecondaryTitle = out.secondary;
|
||||
m_uiSubtitle = FormatSubtitle(true /* withType */);
|
||||
m_uiAddress = m_address;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_uiTitle = GetLocalizedType();
|
||||
m_uiSubtitle = FormatSubtitle(false /* withType */);
|
||||
m_uiAddress = m_address;
|
||||
}
|
||||
|
||||
m_hotelType = ftypes::IsHotelChecker::Instance().GetHotelType(ft);
|
||||
}
|
||||
|
||||
void Info::SetMercator(m2::PointD const & mercator)
|
||||
|
|
|
@ -209,6 +209,7 @@ public:
|
|||
void SetWikiDescription(std::string && description) { m_description = std::move(description); }
|
||||
|
||||
void SetMercator(m2::PointD const & mercator);
|
||||
void SetStandardValues(feature::NameParamsOut out);
|
||||
std::vector<std::string> GetRawTypes() const { return m_types.ToObjectNames(); }
|
||||
|
||||
std::optional<ftypes::IsHotelChecker::Type> GetHotelType() const { return m_hotelType; }
|
||||
|
|
Loading…
Add table
Reference in a new issue