| 294 | } |
| 295 | |
| 296 | void 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 | |
| 322 | bool Editor::IsCreatedFeature(FeatureID const & fid) |
| 323 | { |