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

Function MigrateNodeFeatureIndex

libs/editor/edits_migration.cpp:21–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19namespace editor
20{
21FeatureID 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
47FeatureID MigrateWayOrRelatonFeatureIndex(
48 osm::Editor::ForEachFeaturesNearByFn & forEach, XMLFeature const & xml,

Callers 1

MigrateFeatureIndexFunction · 0.85

Calls 4

FromLatLonFunction · 0.50
GetGeomTypeMethod · 0.45
GetIDMethod · 0.45
GetCenterMethod · 0.45

Tested by

no test coverage detected