MCPcopy Create free account
hub / github.com/comaps/comaps / FillInfoFromFeatureType

Method FillInfoFromFeatureType

libs/map/framework.cpp:751–784  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

749}
750
751void Framework::FillInfoFromFeatureType(FeatureType & ft, place_page::Info & info) const
752{
753 auto const featureStatus = osm::Editor::Instance().GetFeatureStatus(ft.GetID());
754 ASSERT_NOT_EQUAL(featureStatus, FeatureStatus::Deleted, ("Deleted features cannot be selected from UI."));
755 info.SetFeatureStatus(featureStatus);
756
757 if (ftypes::IsAddressObjectChecker::Instance()(ft))
758 info.SetAddress(GetAddressAtPoint(feature::GetCenter(ft)).FormatAddress());
759
760 info.SetFromFeatureType(ft);
761
762 FillDescriptions(ft, info);
763
764 auto const mwmInfo = ft.GetID().m_mwmId.GetInfo();
765 bool const isMapVersionEditable = CanEditMapForPosition(info.GetMercator());
766 bool const canEditOrAdd = featureStatus != FeatureStatus::Obsolete && isMapVersionEditable;
767 info.SetCanEditOrAdd(canEditOrAdd);
768
769 // Fill countryId for place page info
770 auto const & types = info.GetTypes();
771 bool const isState = ftypes::IsStateChecker::Instance()(types);
772 if (isState || ftypes::IsCountryChecker::Instance()(types))
773 {
774 size_t const level = isState ? 1 : 0;
775 CountriesVec countries;
776 CountryId countryId = m_infoGetter->GetRegionCountryId(info.GetMercator());
777 GetStorage().GetTopmostNodesFor(countryId, countries, level);
778 if (countries.size() == 1)
779 countryId = countries.front();
780
781 info.SetCountryId(countryId);
782 info.SetTopmostCountryIds(std::move(countries));
783 }
784}
785
786void Framework::FillApiMarkInfo(ApiMarkPoint const & api, place_page::Info & info) const
787{

Callers

nothing calls this directly

Calls 15

GetCenterFunction · 0.85
SetFeatureStatusMethod · 0.80
FormatAddressMethod · 0.80
SetCanEditOrAddMethod · 0.80
GetRegionCountryIdMethod · 0.80
GetTopmostNodesForMethod · 0.80
frontMethod · 0.80
SetCountryIdMethod · 0.80
SetTopmostCountryIdsMethod · 0.80
GetFeatureStatusMethod · 0.45
GetIDMethod · 0.45
SetAddressMethod · 0.45

Tested by

no test coverage detected