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

Function DeterminePathGrade

generator/osm2type.cpp:818–844  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

816}
817
818string DeterminePathGrade(OsmElement * p)
819{
820 if (!p->HasTag("highway", "path"))
821 return {};
822
823 string scale = p->GetTag("sac_scale");
824 string visibility = p->GetTag("trail_visibility");
825
826 if (scale.empty() && visibility.empty())
827 return {};
828
829 static base::StringIL expertScales = {"alpine_hiking", "demanding_alpine_hiking", "difficult_alpine_hiking"};
830 static base::StringIL difficultVisibilities = {
831 "bad", "poor" // poor is not official
832 };
833 static base::StringIL expertVisibilities = {
834 "horrible", "no", "very_bad" // very_bad is not official
835 };
836
837 if (base::IsExist(expertScales, scale) || base::IsExist(expertVisibilities, visibility))
838 return "expert";
839 else if (scale == "demanding_mountain_hiking" || base::IsExist(difficultVisibilities, visibility))
840 return "difficult";
841
842 // hiking & mountain_hiking scales, excellent, good, intermediate & unknown visibilities means "no grade"
843 return {};
844}
845
846void PreprocessElement(OsmElement * p, CalculateOriginFnT const & calcOrg)
847{

Callers 1

PreprocessElementFunction · 0.85

Calls 4

IsExistFunction · 0.85
GetTagMethod · 0.80
HasTagMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected