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

Method Add

generator/place_processor.cpp:273–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

271}
272
273void PlaceProcessor::Add(FeatureBuilder && fb)
274{
275 // Get name as key to find place clusters.
276 auto name = fb.GetName(localisation::kDefaultNameIndex);
277 auto const id = fb.GetMostGenericOsmId();
278
279 if (name.empty())
280 {
281 name = fb.GetName(localisation::kEnglishLanguageIndex);
282 if (name.empty())
283 {
284 LOG(LWARNING, (m_logTag, "Place with empty name", id));
285 return;
286 }
287 }
288
289 // Naive name->key implementation. Probably should also make simplification, lower-case, etc ...
290 std::string key(name);
291 while (true)
292 {
293 size_t i = key.find("St. ");
294 if (i == std::string::npos)
295 break;
296 key.replace(i, 4, "Saint ");
297 }
298
299 // Places are "equal candidates" if they have equal boundary index or equal name.
300 m_nameToPlaces[{m_boundariesHolder.GetIndex(id), std::move(key)}].push_back(CreatePlace(std::move(fb)));
301}
302
303} // namespace generator

Callers 1

CreatePlaceMethod · 0.45

Calls 6

GetMostGenericOsmIdMethod · 0.80
GetNameMethod · 0.45
emptyMethod · 0.45
findMethod · 0.45
push_backMethod · 0.45
GetIndexMethod · 0.45

Tested by

no test coverage detected