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

Method DeleteFeature

libs/editor/osm_editor.cpp:296–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294}
295
296void Editor::DeleteFeature(FeatureID const & fid)
297{
298 CHECK_THREAD_CHECKER(MainThreadChecker, (""));
299
300 auto const features = m_features.Get();
301 auto editableFeatures = make_shared<FeaturesContainer>(*features);
302
303 auto const mwm = editableFeatures->find(fid.m_mwmId);
304
305 if (mwm != editableFeatures->end())
306 {
307 auto const f = mwm->second.find(fid.m_index);
308 // Created feature is deleted by removing all traces of it.
309 if (f != mwm->second.end() && f->second.m_status == FeatureStatus::Created)
310 {
311 mwm->second.erase(f);
312 SaveTransaction(editableFeatures);
313 return;
314 }
315 }
316
317 MarkFeatureWithStatus(*editableFeatures, fid, FeatureStatus::Deleted);
318 SaveTransaction(editableFeatures);
319 Invalidate();
320}
321
322bool Editor::IsCreatedFeature(FeatureID const & fid)
323{

Callers 6

GetFeatureStatusTestMethod · 0.45
DeleteFeatureTestMethod · 0.45
LoadMapEditsTestMethod · 0.45
SaveTransactionTestMethod · 0.45

Calls 4

GetMethod · 0.45
findMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by 6

GetFeatureStatusTestMethod · 0.36
DeleteFeatureTestMethod · 0.36
LoadMapEditsTestMethod · 0.36
SaveTransactionTestMethod · 0.36