diff options
author | tatiana-yan <tatiana.kondakova@gmail.com> | 2019-02-20 21:09:43 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2019-02-20 22:41:13 +0300 |
commit | e2f8c8b96dcde16008b3cc1c8c90fc0c9bf12ea9 (patch) | |
tree | 2a5bf30aef994f5e1612d38b4be078c0ba41440e /editor | |
parent | 73689767690e66912f7a4a0da4b70a3e6380e056 (diff) |
[editor] Minor refactoring: do not copy FeatureType to save FeatureID.
Diffstat (limited to 'editor')
-rw-r--r-- | editor/edits_migration.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/editor/edits_migration.cpp b/editor/edits_migration.cpp index fb1911888a..a6631da2ab 100644 --- a/editor/edits_migration.cpp +++ b/editor/edits_migration.cpp @@ -20,30 +20,31 @@ FeatureID MigrateNodeFeatureIndex(osm::Editor::ForEachFeaturesNearByFn & forEach FeatureStatus const featureStatus, TGenerateIDFn const & generateID) { - unique_ptr<FeatureType> feature; + if (featureStatus == FeatureStatus::Created) + return generateID(); + + FeatureID fid; auto count = 0; forEach( - [&feature, &count](FeatureType const & ft) - { + [&fid, &count](FeatureType const & ft) { if (ft.GetFeatureType() != feature::GEOM_POINT) return; // TODO(mgsergio): Check that ft and xml correspond to the same feature. - feature = make_unique<FeatureType>(ft); + fid = ft.GetID(); ++count; }, MercatorBounds::FromLatLon(xml.GetCenter())); - if (!feature && featureStatus != FeatureStatus::Created) + if (count == 0) MYTHROW(MigrationError, ("No pointed features returned.")); - if (featureStatus == FeatureStatus::Created) - return generateID(); if (count > 1) { LOG(LWARNING, (count, "features returned for point", MercatorBounds::FromLatLon(xml.GetCenter()))); } - return feature->GetID(); + + return fid; } FeatureID MigrateWayOrRelatonFeatureIndex( |