mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 04:53:36 +00:00
Compare commits
1 Commits
8cffa508f3
...
map-per-di
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c084a8d94 |
@@ -948,7 +948,7 @@ public class EditorFragment extends BaseMwmFragment implements View.OnClickListe
|
||||
|
||||
mDisused.setVisibility(Editor.nativeCanMarkPlaceAsDisused() ? View.VISIBLE : View.GONE);
|
||||
|
||||
if (Editor.nativeIsMapObjectUploaded())
|
||||
if (Editor.nativeAreSomeFeatureChangesUploaded())
|
||||
{
|
||||
mReset.setText(R.string.editor_place_doesnt_exist);
|
||||
return;
|
||||
@@ -966,7 +966,7 @@ public class EditorFragment extends BaseMwmFragment implements View.OnClickListe
|
||||
|
||||
private void reset()
|
||||
{
|
||||
if (Editor.nativeIsMapObjectUploaded())
|
||||
if (Editor.nativeAreSomeFeatureChangesUploaded())
|
||||
{
|
||||
placeDoesntExist();
|
||||
return;
|
||||
|
||||
@@ -580,10 +580,10 @@ JNIEXPORT jint JNICALL Java_app_organicmaps_sdk_editor_Editor_nativeGetMapObject
|
||||
return static_cast<jint>(osm::Editor::Instance().GetFeatureStatus(g_editableMapObject.GetID()));
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL Java_app_organicmaps_sdk_editor_Editor_nativeIsMapObjectUploaded(JNIEnv * env, jclass clazz)
|
||||
JNIEXPORT jboolean JNICALL Java_app_organicmaps_sdk_editor_Editor_nativeAreSomeFeatureChangesUploaded(JNIEnv * env, jclass clazz)
|
||||
{
|
||||
return osm::Editor::Instance().IsFeatureUploaded(g_editableMapObject.GetID().m_mwmId,
|
||||
g_editableMapObject.GetID().m_index);
|
||||
return osm::Editor::Instance().AreSomeFeatureChangesUploaded(g_editableMapObject.GetID().m_mwmId,
|
||||
g_editableMapObject.GetID().m_index);
|
||||
}
|
||||
|
||||
// static nativeMakeLocalizedName(String langCode, String name);
|
||||
|
||||
@@ -190,5 +190,5 @@ public final class Editor
|
||||
|
||||
@FeatureStatus
|
||||
public static native int nativeGetMapObjectStatus();
|
||||
public static native boolean nativeIsMapObjectUploaded();
|
||||
public static native boolean nativeAreSomeFeatureChangesUploaded();
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ void registerCellsForTableView(std::vector<MWMEditorCellID> const & cells, UITab
|
||||
[self configNavBar];
|
||||
auto const & fid = m_mapObject.GetID();
|
||||
self.featureStatus = osm::Editor::Instance().GetFeatureStatus(fid.m_mwmId, fid.m_index);
|
||||
self.isFeatureUploaded = osm::Editor::Instance().IsFeatureUploaded(fid.m_mwmId, fid.m_index);
|
||||
self.isFeatureUploaded = osm::Editor::Instance().AreSomeFeatureChangesUploaded(fid.m_mwmId, fid.m_index);
|
||||
m_newAdditionalLanguages.clear();
|
||||
if (self.isCreating)
|
||||
{
|
||||
@@ -1089,7 +1089,7 @@ void registerCellsForTableView(std::vector<MWMEditorCellID> const & cells, UITab
|
||||
- (void)tapOnButtonCell:(UITableViewCell *)cell
|
||||
{
|
||||
auto const & fid = m_mapObject.GetID();
|
||||
self.isFeatureUploaded = osm::Editor::Instance().IsFeatureUploaded(fid.m_mwmId, fid.m_index);
|
||||
self.isFeatureUploaded = osm::Editor::Instance().AreSomeFeatureChangesUploaded(fid.m_mwmId, fid.m_index);
|
||||
NSIndexPath * ip = [self.tableView indexPathForCell:cell];
|
||||
[self.tableView reloadRowsAtIndexPaths:@[ ip ] withRowAnimation:UITableViewRowAnimationFade];
|
||||
|
||||
|
||||
@@ -406,7 +406,7 @@ void EditorTest::GetFeatureStatusTest()
|
||||
TEST_EQUAL(editor.GetFeatureStatus(emo.GetID()), FeatureStatus::Created, ());
|
||||
}
|
||||
|
||||
void EditorTest::IsFeatureUploadedTest()
|
||||
void EditorTest::AreSomeFeatureChangesUploadedTest()
|
||||
{
|
||||
auto & editor = osm::Editor::Instance();
|
||||
|
||||
@@ -419,19 +419,25 @@ void EditorTest::IsFeatureUploadedTest()
|
||||
});
|
||||
|
||||
ForEachCafeAtPoint(m_dataSource, m2::PointD(1.0, 1.0), [&editor](FeatureType & ft)
|
||||
{ TEST(!editor.IsFeatureUploaded(ft.GetID().m_mwmId, ft.GetID().m_index), ()); });
|
||||
{ TEST(!editor.AreSomeFeatureChangesUploaded(ft.GetID().m_mwmId, ft.GetID().m_index), ()); });
|
||||
|
||||
osm::EditableMapObject emo;
|
||||
CreateCafeAtPoint({3.0, 3.0}, mwmId, emo);
|
||||
|
||||
TEST(!editor.IsFeatureUploaded(emo.GetID().m_mwmId, emo.GetID().m_index), ());
|
||||
TEST(!editor.AreSomeFeatureChangesUploaded(emo.GetID().m_mwmId, emo.GetID().m_index), ());
|
||||
|
||||
// generate journal with uploaded changes
|
||||
osm::EditJournal journal;
|
||||
journal.AddTagChange("addr:housenumber", "", "42");
|
||||
journal.Clear();
|
||||
emo.SetJournal(std::move(journal));
|
||||
|
||||
pugi::xml_document doc;
|
||||
GenerateUploadedFeature(mwmId, emo, doc);
|
||||
editor.m_storage->Save(doc);
|
||||
editor.LoadEdits();
|
||||
|
||||
TEST(editor.IsFeatureUploaded(emo.GetID().m_mwmId, emo.GetID().m_index), ());
|
||||
TEST(editor.AreSomeFeatureChangesUploaded(emo.GetID().m_mwmId, emo.GetID().m_index), ());
|
||||
}
|
||||
|
||||
void EditorTest::DeleteFeatureTest()
|
||||
@@ -1309,9 +1315,9 @@ UNIT_CLASS_TEST(EditorTest, GetFeatureStatusTest)
|
||||
EditorTest::GetFeatureStatusTest();
|
||||
}
|
||||
|
||||
UNIT_CLASS_TEST(EditorTest, IsFeatureUploadedTest)
|
||||
UNIT_CLASS_TEST(EditorTest, AreSomeFeatureChangesUploadedTest)
|
||||
{
|
||||
EditorTest::IsFeatureUploadedTest();
|
||||
EditorTest::AreSomeFeatureChangesUploadedTest();
|
||||
}
|
||||
|
||||
UNIT_CLASS_TEST(EditorTest, DeleteFeatureTest)
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
void SetIndexTest();
|
||||
void GetEditedFeatureStreetTest();
|
||||
void GetFeatureStatusTest();
|
||||
void IsFeatureUploadedTest();
|
||||
void AreSomeFeatureChangesUploadedTest();
|
||||
void DeleteFeatureTest();
|
||||
void ClearAllLocalEditsTest();
|
||||
void GetFeaturesByStatusTest();
|
||||
|
||||
@@ -279,10 +279,10 @@ FeatureStatus Editor::GetFeatureStatus(FeatureID const & fid) const
|
||||
return GetFeatureStatusImpl(*features, fid.m_mwmId, fid.m_index);
|
||||
}
|
||||
|
||||
bool Editor::IsFeatureUploaded(MwmId const & mwmId, uint32_t index) const
|
||||
bool Editor::AreSomeFeatureChangesUploaded(MwmId const & mwmId, uint32_t index) const
|
||||
{
|
||||
auto const features = m_features.Get();
|
||||
return IsFeatureUploadedImpl(*features, mwmId, index);
|
||||
return AreSomeFeatureChangesUploadedImpl(*features, mwmId, index);
|
||||
}
|
||||
|
||||
void Editor::DeleteFeature(FeatureID const & fid)
|
||||
@@ -425,7 +425,7 @@ bool Editor::RollBackChanges(FeatureID const & fid)
|
||||
{
|
||||
CHECK_THREAD_CHECKER(MainThreadChecker, (""));
|
||||
|
||||
if (IsFeatureUploaded(fid.m_mwmId, fid.m_index))
|
||||
if (AreSomeFeatureChangesUploaded(fid.m_mwmId, fid.m_index))
|
||||
return false;
|
||||
|
||||
return RemoveFeature(fid);
|
||||
@@ -982,7 +982,7 @@ void Editor::CreateNote(ms::LatLon const & latLon, FeatureID const & fid, featur
|
||||
"but was not found on the ground.\n";
|
||||
auto const features = m_features.Get();
|
||||
auto const isCreated = GetFeatureStatusImpl(*features, fid.m_mwmId, fid.m_index) == FeatureStatus::Created;
|
||||
auto const createdAndUploaded = (isCreated && IsFeatureUploadedImpl(*features, fid.m_mwmId, fid.m_index));
|
||||
auto const createdAndUploaded = (isCreated && AreSomeFeatureChangesUploadedImpl(*features, fid.m_mwmId, fid.m_index));
|
||||
CHECK(!isCreated || createdAndUploaded, ());
|
||||
|
||||
if (createdAndUploaded)
|
||||
@@ -1177,10 +1177,10 @@ FeatureStatus Editor::GetFeatureStatusImpl(FeaturesContainer const & features, M
|
||||
return featureInfo->m_status;
|
||||
}
|
||||
|
||||
bool Editor::IsFeatureUploadedImpl(FeaturesContainer const & features, MwmId const & mwmId, uint32_t index)
|
||||
bool Editor::AreSomeFeatureChangesUploadedImpl(FeaturesContainer const & features, MwmId const & mwmId, uint32_t index)
|
||||
{
|
||||
auto const * info = GetFeatureTypeInfo(features, mwmId, index);
|
||||
return info && info->m_uploadStatus == kUploaded;
|
||||
return info && !info->m_object.GetJournal().GetJournalHistory().empty();
|
||||
}
|
||||
|
||||
void Editor::UpdateXMLFeatureTags(editor::XMLFeature & feature, std::list<JournalEntry> const & journal,
|
||||
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
FeatureStatus GetFeatureStatus(FeatureID const & fid) const;
|
||||
|
||||
/// @returns true if a feature was uploaded to osm.
|
||||
bool IsFeatureUploaded(MwmId const & mwmId, uint32_t index) const;
|
||||
bool AreSomeFeatureChangesUploaded(MwmId const & mwmId, uint32_t index) const;
|
||||
|
||||
/// Marks feature as "deleted" from MwM file.
|
||||
void DeleteFeature(FeatureID const & fid);
|
||||
@@ -240,7 +240,7 @@ private:
|
||||
|
||||
static FeatureStatus GetFeatureStatusImpl(FeaturesContainer const & features, MwmId const & mwmId, uint32_t index);
|
||||
|
||||
static bool IsFeatureUploadedImpl(FeaturesContainer const & features, MwmId const & mwmId, uint32_t index);
|
||||
static bool AreSomeFeatureChangesUploadedImpl(FeaturesContainer const & features, MwmId const & mwmId, uint32_t index);
|
||||
|
||||
static void UpdateXMLFeatureTags(editor::XMLFeature & feature, std::list<JournalEntry> const & journal,
|
||||
ChangesetWrapper & changeset);
|
||||
|
||||
Reference in New Issue
Block a user