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

Function MatchTypes

generator/osm2type.cpp:425–458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

423}
424
425void MatchTypes(OsmElement * p, FeatureBuilderParams & params, TypesFilterFnT const & filterType)
426{
427 auto static const rules = generator::ParseMapCSS(GetPlatform().GetReader(MAPCSS_MAPPING_FILE));
428
429 std::vector<generator::TypeStrings> matchedTypes;
430 for (auto const & [typeString, rule] : rules)
431 if (rule.Matches(p->m_tags))
432 matchedTypes.push_back(typeString);
433
434 LeaveLongestTypes(matchedTypes);
435
436 auto const & cl = classif();
437
438 bool buswayAdded = false;
439 for (size_t i = 0; i < matchedTypes.size(); ++i)
440 {
441 auto const & path = matchedTypes[i];
442 uint32_t const type = cl.GetTypeByPath(path);
443 if (!filterType(type))
444 continue;
445
446 // "busway" and "service" can be matched together, keep busway only.
447 if (path[0] == "highway")
448 {
449 // busway goes before service, see LeaveLongestTypes.isBetter
450 if (path[1] == "busway")
451 buswayAdded = true;
452 else if (buswayAdded && path[1] == "service")
453 continue;
454 }
455
456 params.AddType(type);
457 }
458}
459
460string MatchCity(ms::LatLon const & ll)
461{

Callers 1

GetNameAndTypeFunction · 0.85

Calls 8

ParseMapCSSFunction · 0.85
LeaveLongestTypesFunction · 0.85
GetTypeByPathMethod · 0.80
GetReaderMethod · 0.45
MatchesMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45
AddTypeMethod · 0.45

Tested by

no test coverage detected