diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp index 37db6c3b21..2dec5eb700 100644 --- a/android/jni/com/mapswithme/maps/Framework.cpp +++ b/android/jni/com/mapswithme/maps/Framework.cpp @@ -713,6 +713,12 @@ Java_com_mapswithme_maps_Framework_nativeGetDrawScale(JNIEnv * env, jclass) return static_cast(frm()->GetDrawScale()); } +JNIEXPORT void JNICALL +Java_com_mapswithme_maps_Framework_nativeUpdateUserViewportChanged(JNIEnv * env, jclass) +{ + frm()->UpdateUserViewportChanged(); +} + JNIEXPORT jdoubleArray JNICALL Java_com_mapswithme_maps_Framework_nativeGetScreenRectCenter(JNIEnv * env, jclass) { diff --git a/android/src/com/mapswithme/maps/Framework.java b/android/src/com/mapswithme/maps/Framework.java index 77c4f028fe..baac6d2441 100644 --- a/android/src/com/mapswithme/maps/Framework.java +++ b/android/src/com/mapswithme/maps/Framework.java @@ -99,6 +99,8 @@ public class Framework public static native void nativeShowTrackRect(int category, int track); public static native int nativeGetDrawScale(); + + public static native int nativeUpdateUserViewportChanged(); @Size(2) public static native double[] nativeGetScreenRectCenter(); diff --git a/android/src/com/mapswithme/maps/editor/EditorFragment.java b/android/src/com/mapswithme/maps/editor/EditorFragment.java index fc5db7dc49..0e569818bc 100644 --- a/android/src/com/mapswithme/maps/editor/EditorFragment.java +++ b/android/src/com/mapswithme/maps/editor/EditorFragment.java @@ -22,6 +22,7 @@ import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; +import com.mapswithme.maps.Framework; import com.mapswithme.maps.R; import com.mapswithme.maps.base.BaseMwmFragment; import com.mapswithme.maps.bookmarks.data.Metadata.MetadataType; @@ -620,6 +621,7 @@ public class EditorFragment extends BaseMwmFragment implements View.OnClickListe public void onClick(DialogInterface dialog, int which) { Editor.nativeRollbackMapObject(); + Framework.nativeUpdateUserViewportChanged(); mParent.onBackPressed(); } }) diff --git a/iphone/Maps/Classes/Editor/MWMEditorViewController.mm b/iphone/Maps/Classes/Editor/MWMEditorViewController.mm index 063ea2bae8..9a060ce207 100644 --- a/iphone/Maps/Classes/Editor/MWMEditorViewController.mm +++ b/iphone/Maps/Classes/Editor/MWMEditorViewController.mm @@ -992,6 +992,7 @@ void registerCellsForTableView(vector const & cells, UITab if (!f.RollBackChanges(fid)) NSAssert(false, @"We shouldn't call this if we can't roll back!"); + f.UpdateUserViewportChanged(); [self backTap]; }; diff --git a/search/retrieval.cpp b/search/retrieval.cpp index fb0587d3a4..2c25219706 100644 --- a/search/retrieval.cpp +++ b/search/retrieval.cpp @@ -263,14 +263,25 @@ unique_ptr RetrievePostcodeFeaturesImpl( // Retrieves from the geometry index corresponding to handle all // features from |coverage|. unique_ptr RetrieveGeometryFeaturesImpl( - MwmContext const & context, my::Cancellable const & cancellable, - covering::IntervalsT const & coverage, int scale) + MwmContext const & context, my::Cancellable const & cancellable, m2::RectD const & rect, + int scale) { + EditedFeaturesHolder holder(context.GetId()); + + covering::IntervalsT coverage; + CoverRect(rect, scale, coverage); + vector features; FeaturesCollector collector(cancellable, features); context.ForEachIndex(coverage, scale, collector); + + holder.ForEachModifiedOrCreated([&](FeatureType & ft, uint64_t index) { + auto const center = feature::GetCenter(ft); + if (rect.IsPointInside(center)) + features.push_back(index); + }); return SortFeaturesAndBuildCBV(move(features)); } @@ -338,8 +349,6 @@ unique_ptr RetrieveGeometryFeatures( MwmContext const & context, my::Cancellable const & cancellable, m2::RectD const & rect, int scale) { - covering::IntervalsT coverage; - CoverRect(rect, scale, coverage); - return RetrieveGeometryFeaturesImpl(context, cancellable, coverage, scale); + return RetrieveGeometryFeaturesImpl(context, cancellable, rect, scale); } } // namespace search