| 19 | namespace editor |
| 20 | { |
| 21 | FeatureID MigrateNodeFeatureIndex(osm::Editor::ForEachFeaturesNearByFn & forEach, XMLFeature const & xml, |
| 22 | FeatureStatus const featureStatus, GenerateIDFn const & generateID) |
| 23 | { |
| 24 | if (featureStatus == FeatureStatus::Created) |
| 25 | return generateID(); |
| 26 | |
| 27 | FeatureID fid; |
| 28 | auto count = 0; |
| 29 | forEach([&fid, &count](FeatureType const & ft) |
| 30 | { |
| 31 | if (ft.GetGeomType() != feature::GeomType::Point) |
| 32 | return; |
| 33 | // TODO(mgsergio): Check that ft and xml correspond to the same feature. |
| 34 | fid = ft.GetID(); |
| 35 | ++count; |
| 36 | }, mercator::FromLatLon(xml.GetCenter())); |
| 37 | |
| 38 | if (count == 0) |
| 39 | MYTHROW(MigrationError, ("No pointed features returned.")); |
| 40 | |
| 41 | if (count > 1) |
| 42 | LOG(LWARNING, (count, "features returned for point", mercator::FromLatLon(xml.GetCenter()))); |
| 43 | |
| 44 | return fid; |
| 45 | } |
| 46 | |
| 47 | FeatureID MigrateWayOrRelatonFeatureIndex( |
| 48 | osm::Editor::ForEachFeaturesNearByFn & forEach, XMLFeature const & xml, |
no test coverage detected