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

Method RemoveUselessNames

generator/feature_builder.cpp:304–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302}
303
304void 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
336void FeatureBuilder::RemoveNameIfInvisible(int minS, int maxS)
337{

Callers 1

UNIT_CLASS_TESTFunction · 0.80

Calls 8

RemoveIfMethod · 0.80
IsEmptyMethod · 0.45
IsEqualMethod · 0.45
ClearMethod · 0.45
GetStringMethod · 0.45
RemoveStringMethod · 0.45

Tested by 1

UNIT_CLASS_TESTFunction · 0.64