forked from organicmaps/organicmaps
Merge pull request #2919 from mgsergio/feature-upload-status
[Editor] RollBackChanges; Get upload status.
This commit is contained in:
commit
ae6f483efd
2 changed files with 24 additions and 1 deletions
|
@ -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,
|
||||
|
|
|
@ -74,9 +74,14 @@ public:
|
|||
m2::RectD const & rect,
|
||||
uint32_t scale);
|
||||
|
||||
/// Easy way to check if feature was deleted, modified, created or not changed at all.
|
||||
// TODO(mgsergio): Unify feature functions signatures.
|
||||
|
||||
/// Easy way to check if a feature was deleted, modified, created or not changed at all.
|
||||
FeatureStatus GetFeatureStatus(MwmSet::MwmId const & mwmId, uint32_t index) const;
|
||||
|
||||
/// @returns true if a feature was uploaded to osm.
|
||||
bool IsFeatureUploaded(MwmSet::MwmId const & mwmId, uint32_t index) const;
|
||||
|
||||
/// Marks feature as "deleted" from MwM file.
|
||||
void DeleteFeature(FeatureType const & feature);
|
||||
|
||||
|
@ -101,6 +106,10 @@ public:
|
|||
/// Editor checks internally if any feature params were actually edited.
|
||||
SaveResult SaveEditedFeature(EditableMapObject const & emo);
|
||||
|
||||
/// Removes changes from editor.
|
||||
/// @returns false if a feature was uploaded.
|
||||
bool RollBackChanges(FeatureID const & fid);
|
||||
|
||||
EditableProperties GetEditableProperties(FeatureType const & feature) const;
|
||||
|
||||
bool HaveMapEditsOrNotesToUpload() const;
|
||||
|
|
Loading…
Add table
Reference in a new issue