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

Function PostprocessElement

generator/osm2type.cpp:1080–1392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1078}
1079
1080void PostprocessElement(OsmElement * p, FeatureBuilderParams & params)
1081{
1082 static CachedTypes const types;
1083
1084 auto const AddParam = [&params](ftype::CachedTypes::Type type) { params.AddType(types.Get(type)); };
1085
1086 if (!params.house.IsEmpty())
1087 {
1088 // Add "building-address" type if we have house number, but no "suitable" (building, POI, etc) types.
1089 // A lot in Czech, Italy or others, with individual address points (house numbers).
1090 bool hasSuitableType = false;
1091 for (uint32_t t : params.m_types)
1092 {
1093 /// @todo Make a function like HaveAddressLikeType ?
1094 ftype::TruncValue(t, 1);
1095 if (t != types.Get(CachedTypes::WheelchairAny) && t != types.Get(CachedTypes::InternetAny))
1096 {
1097 hasSuitableType = true;
1098 break;
1099 }
1100 }
1101
1102 if (!hasSuitableType)
1103 {
1104 AddParam(CachedTypes::Address);
1105
1106 // https://github.com/organicmaps/organicmaps/issues/5803
1107 std::string_view const disusedPrefix[] = {"disused:", "abandoned:", "was:"};
1108 for (auto const & tag : p->Tags())
1109 {
1110 for (auto const & prefix : disusedPrefix)
1111 {
1112 if (tag.m_key.starts_with(prefix))
1113 {
1114 params.ClearPOIAttribs();
1115 goto exit;
1116 }
1117 }
1118 }
1119 exit:;
1120 }
1121 }
1122
1123 // Clear POI attributes for disused businesses (e.g. disused:shop)
1124 for (uint32_t t : params.m_types)
1125 {
1126 if (t == types.Get(CachedTypes::DisusedBusiness))
1127 {
1128 // Avoid removing attributes in cases where e.g. shop AND disused:shop are present
1129 bool hasPoiType = false;
1130 for (uint32_t type : params.m_types)
1131 {
1132 ftype::TruncValue(type, 1);
1133 if (type != types.Get(CachedTypes::WheelchairAny) && type != types.Get(CachedTypes::InternetAny) &&
1134 type != types.Get(CachedTypes::DisusedBusiness) && type != types.Get(CachedTypes::Building))
1135 {
1136 hasPoiType = true;
1137 break;

Callers 1

GetNameAndTypeFunction · 0.85

Calls 15

TruncValueFunction · 0.85
TagProcessorClass · 0.85
IsCarDesignatedHighwayFunction · 0.85
TagsMethod · 0.80
ApplyRulesMethod · 0.80
IsHighwayMethod · 0.80
SetReversedGeometryMethod · 0.80
IsTransporterMethod · 0.80
IsSubwayStationMethod · 0.80
SetRwSubwayTypeMethod · 0.80

Tested by

no test coverage detected