| 195 | void operator()(FeatureType & f, map<uint32_t, base::GeoObjectId> const & ft2osm) { Process(f, ft2osm); } |
| 196 | |
| 197 | void Process(FeatureType & f, map<uint32_t, base::GeoObjectId> const & ft2osm) |
| 198 | { |
| 199 | f.ParseAllBeforeGeometry(); |
| 200 | |
| 201 | string const & category = GetReadableType(f); |
| 202 | auto const & meta = f.GetMetadata(); |
| 203 | |
| 204 | auto const metaOperator = meta.Get(feature::Metadata::FMD_OPERATOR); |
| 205 | auto const & osmIt = ft2osm.find(f.GetID().m_index); |
| 206 | if ((!f.HasName() && metaOperator.empty()) || |
| 207 | (f.GetGeomType() == feature::GeomType::Line && category != "highway-pedestrian") || category.empty()) |
| 208 | { |
| 209 | return; |
| 210 | } |
| 211 | m2::PointD const & center = FindCenter(f); |
| 212 | ms::LatLon const & ll = mercator::ToLatLon(center); |
| 213 | osm::MapObject obj; |
| 214 | obj.SetFromFeatureType(f); |
| 215 | |
| 216 | string_view city; |
| 217 | m_finder.GetLocality(center, [&city](search::LocalityItem const & item) |
| 218 | { item.GetSpecifiedOrDefaultName(localisation::kDefaultNameIndex, city); }); |
| 219 | |
| 220 | string const & mwmName = f.GetID().GetMwmName(); |
| 221 | |
| 222 | string name(f.GetName(localisation::kDefaultNameIndex)); |
| 223 | if (name.empty()) |
| 224 | { |
| 225 | std::optional<std::string> const n = f.GetTranslatedName().m_primary; |
| 226 | if (n.has_value() && !n.value().empty()) |
| 227 | name = n.value(); |
| 228 | else |
| 229 | name = metaOperator; |
| 230 | } |
| 231 | |
| 232 | string osmId = osmIt != ft2osm.cend() ? to_string(osmIt->second.GetEncodedId()) : ""; |
| 233 | string const & uid = BuildUniqueId(ll, name); |
| 234 | string const & lat = strings::to_string_dac(ll.m_lat, 6); |
| 235 | string const & lon = strings::to_string_dac(ll.m_lon, 6); |
| 236 | search::ReverseGeocoder::Address addr; |
| 237 | string addrStreet = ""; |
| 238 | string addrHouse = ""; |
| 239 | double constexpr kDistanceThresholdMeters = 0.5; |
| 240 | if (m_geocoder.GetExactAddress(f, addr)) |
| 241 | { |
| 242 | addrStreet = addr.GetStreetName(); |
| 243 | addrHouse = addr.GetHouseNumber(); |
| 244 | } |
| 245 | else |
| 246 | { |
| 247 | m_geocoder.GetNearbyAddress(center, addr); |
| 248 | if (addr.GetDistance() < kDistanceThresholdMeters) |
| 249 | { |
| 250 | addrStreet = addr.GetStreetName(); |
| 251 | addrHouse = addr.GetHouseNumber(); |
| 252 | } |
| 253 | } |
| 254 | string const phone(meta.Get(feature::Metadata::FMD_PHONE_NUMBER)); |
no test coverage detected