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

Function GetNameAndType

generator/osm2type.cpp:1395–1581  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1393} // namespace
1394
1395void GetNameAndType(OsmElement * p, FeatureBuilderParams & params, TypesFilterFnT const & filterType,
1396 CalculateOriginFnT const & calcOrg)
1397{
1398 // At this point, some preprocessing could've been done to the tags already
1399 // in TranslatorInterface::Preprocess(), e.g. converting tags according to replaced_tags.txt.
1400
1401 // Stage1: Preprocess tags.
1402 PreprocessElement(p, calcOrg);
1403
1404 // Stage2: Process feature name on all languages.
1405 NamesExtractor namesExtractor(params);
1406 ForEachTag(p, namesExtractor);
1407 namesExtractor.Finish();
1408
1409 // Stage3: Process base feature tags.
1410 std::string houseName, houseNumber, conscriptionHN, streetHN, addrPostcode;
1411 std::string addrCity, addrSuburb;
1412 feature::AddressData addr;
1413 TagProcessor(p).ApplyRules<void(string &, string &)>({
1414 {"addr:housenumber", "*", [&houseNumber](string & k, string & v) { houseNumber = std::move(v); }},
1415 {"addr:conscriptionnumber", "*", [&conscriptionHN](string & k, string & v) { conscriptionHN = std::move(v); }},
1416 {"addr:provisionalnumber", "*", [&conscriptionHN](string & k, string & v) { conscriptionHN = std::move(v); }},
1417 {"addr:streetnumber", "*", [&streetHN](string & k, string & v) { streetHN = std::move(v); }},
1418 {"contact:housenumber", "*",
1419 [&houseNumber](string & k, string & v)
1420 {
1421 if (houseNumber.empty())
1422 houseNumber = std::move(v);
1423 }},
1424 {"addr:housename", "*", [&houseName](string & k, string & v) { houseName = std::move(v); }},
1425 {"addr:street", "*",
1426 [&addr](string & k, string & v) { addr.Set(feature::AddressData::Type::Street, std::move(v)); }},
1427 {"contact:street", "*",
1428 [&addr](string & k, string & v) { addr.SetIfAbsent(feature::AddressData::Type::Street, std::move(v)); }},
1429 {"addr:place", "*",
1430 [&addr](string & k, string & v) { addr.Set(feature::AddressData::Type::Place, std::move(v)); }},
1431 {"addr:city", "*", [&addrCity](string & k, string & v) { addrCity = std::move(v); }},
1432 {"addr:suburb", "*", [&addrSuburb](string & k, string & v) { addrSuburb = std::move(v); }},
1433 {"addr:postcode", "*", [&addrPostcode](string & k, string & v) { addrPostcode = std::move(v); }},
1434 {"postal_code", "*", [&addrPostcode](string & k, string & v) { addrPostcode = std::move(v); }},
1435 {"contact:postcode", "*",
1436 [&addrPostcode](string & k, string & v)
1437 {
1438 if (addrPostcode.empty())
1439 addrPostcode = std::move(v);
1440 }},
1441 {"population", "*",
1442 [&params](string & k, string & v)
1443 {
1444 // Get population rank.
1445 uint64_t const population = generator::osm_element::GetPopulation(v);
1446 if (population != 0)
1447 {
1448 params.rank = feature::PopulationToRank(population);
1449 // Store raw value as metadata for display on the place page.
1450 // Must be done here because TagProcessor::Call() clears the tag after this
1451 // lambda returns, so it never reaches MetadataTagProcessor (Stage 6).
1452 /// @todo(pastk): don't store unparseable numbers

Callers 13

AddFakeNodesMethod · 0.85
ParseParamsMethod · 0.85
MakeFbForTestFunction · 0.85
MakeAreaFeatureBuilderFunction · 0.85
MakeNodeFeatureBuilderFunction · 0.85
TestSurfaceTypesFunction · 0.85
GetFeatureBuilderParamsFunction · 0.85
UNIT_CLASS_TESTFunction · 0.85
MakeFbForTestFunction · 0.85
AddWayMethod · 0.85
AddNodeMethod · 0.85

Calls 15

PreprocessElementFunction · 0.85
ForEachTagFunction · 0.85
TagProcessorClass · 0.85
PopulationToRankFunction · 0.85
ClampFunction · 0.85
DebugPrintIDFunction · 0.85
MatchTypesFunction · 0.85
PostprocessElementFunction · 0.85
SetIfAbsentMethod · 0.80
IsInsideMethod · 0.80

Tested by 11

MakeFbForTestFunction · 0.68
MakeAreaFeatureBuilderFunction · 0.68
MakeNodeFeatureBuilderFunction · 0.68
TestSurfaceTypesFunction · 0.68
GetFeatureBuilderParamsFunction · 0.68
UNIT_CLASS_TESTFunction · 0.68
MakeFbForTestFunction · 0.68
AddWayMethod · 0.68
AddNodeMethod · 0.68
MakeFeatureMethod · 0.68