| 271 | } |
| 272 | |
| 273 | void 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 |
no test coverage detected