[core] Create Standalone Note core

Signed-off-by: hemanggs <hemangmanhas@gmail.com>
This commit is contained in:
hemanggs
2025-05-21 19:33:50 +05:30
committed by Konstantin Pastbin
parent 1c8ac1f32a
commit 9e494ed8a5
5 changed files with 18 additions and 0 deletions

View File

@@ -161,6 +161,7 @@ public final class Editor
public static native void nativeCreateNote(String text); public static native void nativeCreateNote(String text);
public static native void nativePlaceDoesNotExist(@NonNull String comment); public static native void nativePlaceDoesNotExist(@NonNull String comment);
public static native void nativeRollbackMapObject(); public static native void nativeRollbackMapObject();
public static native void nativeCreateStandaloneNote(double lat, double lon, String text);
/** /**
* @return all cuisines keys. * @return all cuisines keys.

View File

@@ -610,6 +610,9 @@
<string name="error_enter_correct_fediverse_page">Enter a valid Mastodon username or web address</string> <string name="error_enter_correct_fediverse_page">Enter a valid Mastodon username or web address</string>
<string name="error_enter_correct_bluesky_page">Enter a valid Bluesky username or web address</string> <string name="error_enter_correct_bluesky_page">Enter a valid Bluesky username or web address</string>
<string name="placepage_add_place_button">Add Place to OpenStreetMap</string> <string name="placepage_add_place_button">Add Place to OpenStreetMap</string>
<string name="placepage_add_note">Leave Note to OpenStreetMap</string>
<string name="osm_note_hint">Describe the issue, add details, or suggest an improvement.</string>
<string name="error_enter_note">Please enter a note text.</string>
<!-- Displayed when saving some edits to the map to warn against publishing personal data --> <!-- Displayed when saving some edits to the map to warn against publishing personal data -->
<string name="editor_share_to_all_dialog_title">Do you want to send it to all users?</string> <string name="editor_share_to_all_dialog_title">Do you want to send it to all users?</string>
<!-- Dialog before publishing the modifications to the public map. --> <!-- Dialog before publishing the modifications to the public map. -->

View File

@@ -391,6 +391,12 @@ Java_app_organicmaps_sdk_editor_Editor_nativeCreateNote(JNIEnv * env, jclass cla
g_editableMapObject, osm::Editor::NoteProblemType::General, jni::ToNativeString(env, text)); g_editableMapObject, osm::Editor::NoteProblemType::General, jni::ToNativeString(env, text));
} }
JNIEXPORT void JNICALL
Java_app_organicmaps_editor_Editor_nativeCreateStandaloneNote(JNIEnv * env, jclass clazz, jdouble lat, jdouble lon,jstring text)
{
osm::Editor::Instance().CreateStandaloneNote(ms::LatLon(lat, lon), jni::ToNativeString(env, text));
}
// static void nativePlaceDoesNotExist(String comment); // static void nativePlaceDoesNotExist(String comment);
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_app_organicmaps_sdk_editor_Editor_nativePlaceDoesNotExist(JNIEnv * env, jclass clazz, jstring comment) Java_app_organicmaps_sdk_editor_Editor_nativePlaceDoesNotExist(JNIEnv * env, jclass clazz, jstring comment)

View File

@@ -1184,6 +1184,12 @@ void Editor::CreateNote(ms::LatLon const & latLon, FeatureID const & fid,
m_notes->CreateNote(latLon, sstr.str()); m_notes->CreateNote(latLon, sstr.str());
} }
void Editor::CreateStandaloneNote(ms::LatLon const & latLon, std::string const & noteText)
{
CHECK_THREAD_CHECKER(MainThreadChecker,(""));
m_notes->CreateNote(latLon, noteText + "\n");
}
void Editor::MarkFeatureWithStatus(FeaturesContainer & editableFeatures, FeatureID const & fid, void Editor::MarkFeatureWithStatus(FeaturesContainer & editableFeatures, FeatureID const & fid,
FeatureStatus status) FeatureStatus status)
{ {

View File

@@ -170,6 +170,8 @@ public:
Stats GetStats() const; Stats GetStats() const;
void CreateStandaloneNote(ms::LatLon const & latLon, std::string const & noteText);
// Don't use this function to determine if a feature in editor was created. // Don't use this function to determine if a feature in editor was created.
// Use GetFeatureStatus(fid) instead. This function is used when a feature is // Use GetFeatureStatus(fid) instead. This function is used when a feature is
// not yet saved, and we have to know if it was modified or created. // not yet saved, and we have to know if it was modified or created.