| 302 | } |
| 303 | |
| 304 | void FeatureBuilder::RemoveUselessNames() |
| 305 | { |
| 306 | if (!m_params.name.IsEmpty() && !IsCoastCell()) |
| 307 | { |
| 308 | // Remove names for boundary-administrative-* features. |
| 309 | // AFAIR, they were very messy in search because they contain places' names. |
| 310 | auto const typeRemover = [](uint32_t type) |
| 311 | { |
| 312 | static TypeSetChecker const checkBoundary({"boundary", "administrative"}); |
| 313 | return checkBoundary.IsEqual(type); |
| 314 | }; |
| 315 | |
| 316 | auto types = GetTypesHolder(); |
| 317 | if (types.RemoveIf(typeRemover)) |
| 318 | { |
| 319 | // Remove only if there are no other text-style types in feature (e.g. highway). |
| 320 | std::pair<int, int> const range = GetDrawableScaleRangeForRules(types, RULE_ANY_TEXT); |
| 321 | if (range.first == -1) |
| 322 | m_params.name.Clear(); |
| 323 | } |
| 324 | |
| 325 | // Skip the alt_name which is equal to the default name. |
| 326 | std::string_view name, altName; |
| 327 | if (m_params.name.GetString(localisation::kAlternativeNameIndex, altName) && |
| 328 | m_params.name.GetString(localisation::kDefaultNameIndex, name) && |
| 329 | search::NormalizeAndSimplifyString(altName) == search::NormalizeAndSimplifyString(name)) |
| 330 | { |
| 331 | m_params.name.RemoveString(localisation::kAlternativeNameIndex); |
| 332 | } |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | void FeatureBuilder::RemoveNameIfInvisible(int minS, int maxS) |
| 337 | { |