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

Function GetTypeForFeature

libs/editor/changeset_wrapper.cpp:44–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42 "place", "entrance", "man_made", "healthcare", "attraction"};
43
44std::string GetTypeForFeature(editor::XMLFeature const & node)
45{
46 for (std::string_view const key : kMainTags)
47 {
48 if (node.HasTag(key))
49 {
50 // Non-const for RVO.
51 std::string value = node.GetTagValue(key);
52 if (value == "yes")
53 return std::string{key};
54 else if (key == "shop" || key == "office" || key == "entrance" || key == "attraction")
55 return value.append(" ").append(key); // "convenience shop"
56 else if (!value.empty() && value.back() == 's')
57 // Remove 's' from the tail: "toilets" -> "toilet".
58 return value.erase(value.size() - 1);
59 else if (key == "healthcare" && value == "alternative")
60 return "alternative medicine";
61 return value;
62 }
63 }
64
65 if (node.HasTag("disused:shop") || node.HasTag("disused:amenity"))
66 return "vacant business";
67
68 if (node.HasTag("building"))
69 {
70 std::string value = node.GetTagValue("building");
71 return value == "yes" ? "building" : value.append(" building");
72 }
73
74 if (node.HasTag("addr:housenumber") || node.HasTag("addr:street") || node.HasTag("addr:postcode"))
75 return "address";
76
77 // Did not find any known tags.
78 return node.HasAnyTags() ? "unknown object" : "empty object";
79}
80
81std::vector<m2::PointD> NaiveSample(std::vector<m2::PointD> const & source, size_t count)
82{

Callers 3

CreateMethod · 0.85
ModifyMethod · 0.85
DeleteMethod · 0.85

Calls 8

backMethod · 0.80
HasAnyTagsMethod · 0.80
HasTagMethod · 0.45
GetTagValueMethod · 0.45
appendMethod · 0.45
emptyMethod · 0.45
eraseMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected