Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Magidovich <mgsergio@mapswithme.com>2016-04-19 14:47:41 +0300
committerSergey Magidovich <mgsergio@mapswithme.com>2016-04-26 10:50:42 +0300
commita91145f3c65f0dd8731df34116fee470f9c7b374 (patch)
treea48d837f9b368bbb7541f6d27796ffce04bf54a0 /indexer/osm_editor.cpp
parent11e169efc98d5fd393122df1ce34ed26b77aa949 (diff)
Add a function to find out if a feature is uploaded and one to roll
changes back if it wasn't.
Diffstat (limited to 'indexer/osm_editor.cpp')
-rw-r--r--indexer/osm_editor.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/indexer/osm_editor.cpp b/indexer/osm_editor.cpp
index 47962ea4d7..2fb1576564 100644
--- a/indexer/osm_editor.cpp
+++ b/indexer/osm_editor.cpp
@@ -329,6 +329,11 @@ Editor::FeatureStatus Editor::GetFeatureStatus(MwmSet::MwmId const & mwmId, uint
return featureInfo->m_status;
}
+bool Editor::IsFeatureUploaded(MwmSet::MwmId const & mwmId, uint32_t index) const
+{
+ return GetFeatureTypeInfo(mwmId, index)->m_uploadStatus == kUploaded;
+}
+
void Editor::DeleteFeature(FeatureType const & feature)
{
FeatureID const & fid = feature.GetID();
@@ -456,6 +461,15 @@ Editor::SaveResult Editor::SaveEditedFeature(EditableMapObject const & emo)
return savedSuccessfully ? SavedSuccessfully : NoFreeSpaceError;
}
+bool Editor::RollBackChanges(FeatureID const & fid)
+{
+ if (IsFeatureUploaded(fid.m_mwmId, fid.m_index))
+ return false;
+
+ RemoveFeatureFromStorageIfExists(fid.m_mwmId, fid.m_index);
+ return true;
+}
+
void Editor::ForEachFeatureInMwmRectAndScale(MwmSet::MwmId const & id,
TFeatureIDFunctor const & f,
m2::RectD const & rect,