forked from organicmaps/organicmaps
[search] Restore interactive search after drape merge.
This commit is contained in:
parent
d8a213e87d
commit
cc61b2aefc
4 changed files with 9 additions and 26 deletions
|
@ -212,7 +212,7 @@ extern "C"
|
|||
Java_com_mapswithme_maps_search_SearchEngine_nativeShowAllResults(JNIEnv * env, jclass clazz)
|
||||
{
|
||||
lock_guard<mutex> guard(g_resultsMutex);
|
||||
auto results = g_results;
|
||||
auto const & results = g_results;
|
||||
g_framework->PostDrapeTask([results]()
|
||||
{
|
||||
g_framework->NativeFramework()->ShowAllSearchResults(results);
|
||||
|
|
|
@ -772,10 +772,13 @@ void Framework::StartInteractiveSearch(search::SearchParams const & params)
|
|||
m_lastSearch.m_callback = [this](Results const & results)
|
||||
{
|
||||
if (!results.IsEndMarker())
|
||||
{
|
||||
GetPlatform().RunOnGuiThread([this, results]()
|
||||
{
|
||||
UpdateSearchResults(results);
|
||||
if (IsISActive())
|
||||
FillSearchResultsMarks(results);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -789,22 +792,6 @@ void Framework::UpdateUserViewportChanged()
|
|||
}
|
||||
}
|
||||
|
||||
void Framework::UpdateSearchResults(search::Results const & results)
|
||||
{
|
||||
if (!results.IsEndMarker() && results.GetCount() > 0)
|
||||
{
|
||||
// Got here from search thread. Need to switch into GUI thread to modify search mark container.
|
||||
// Do copy the results structure to pass into GUI thread.
|
||||
GetPlatform().RunOnGuiThread(bind(&Framework::OnSearchResultsCallbackUI, this, results));
|
||||
}
|
||||
}
|
||||
|
||||
void Framework::OnSearchResultsCallbackUI(search::Results const & results)
|
||||
{
|
||||
if (IsISActive())
|
||||
FillSearchResultsMarks(results);
|
||||
}
|
||||
|
||||
void Framework::ClearAllCaches()
|
||||
{
|
||||
m_model.ClearCaches();
|
||||
|
@ -1025,14 +1012,13 @@ void Framework::LoadSearchResultMetadata(search::Result & res) const
|
|||
|
||||
void Framework::ShowSearchResult(search::Result const & res)
|
||||
{
|
||||
CancelInteractiveSearch();
|
||||
|
||||
UserMarkControllerGuard guard(m_bmManager, UserMarkType::SEARCH_MARK);
|
||||
guard.m_controller.SetIsDrawable(false);
|
||||
guard.m_controller.Clear();
|
||||
guard.m_controller.SetIsVisible(true);
|
||||
|
||||
m_lastSearch.Clear();
|
||||
m_fixedSearchResults = 0;
|
||||
|
||||
int scale;
|
||||
m2::PointD center;
|
||||
|
||||
|
@ -1258,6 +1244,7 @@ void Framework::CreateDrapeEngine(ref_ptr<dp::OGLContextFactory> contextFactory,
|
|||
m_drapeEngine = make_unique_dp<df::DrapeEngine>(move(p));
|
||||
AddViewportListener([this](ScreenBase const & screen)
|
||||
{
|
||||
UpdateUserViewportChanged();
|
||||
m_currentModelView = screen;
|
||||
});
|
||||
m_drapeEngine->SetTapEventInfoListener(bind(&Framework::OnTapEvent, this, _1, _2, _3, _4));
|
||||
|
|
|
@ -331,8 +331,6 @@ private:
|
|||
search::SearchParams m_lastSearch;
|
||||
uint8_t m_fixedSearchResults;
|
||||
|
||||
void OnSearchResultsCallback(search::Results const & results);
|
||||
void OnSearchResultsCallbackUI(search::Results const & results);
|
||||
void FillSearchResultsMarks(search::Results const & results);
|
||||
|
||||
void OnDownloadMapCallback(storage::TIndex const & countryIndex);
|
||||
|
@ -355,9 +353,7 @@ public:
|
|||
|
||||
void LoadSearchResultMetadata(search::Result & res) const;
|
||||
void ShowSearchResult(search::Result const & res);
|
||||
|
||||
size_t ShowAllSearchResults(search::Results const & results);
|
||||
void UpdateSearchResults(search::Results const & results);
|
||||
|
||||
void StartInteractiveSearch(search::SearchParams const & params);
|
||||
bool IsISActive() const { return !m_lastSearch.m_query.empty(); }
|
||||
|
|
|
@ -219,7 +219,7 @@ void UserMarkContainer::Clear(size_t skipCount/* = 0*/)
|
|||
{
|
||||
SetDirty();
|
||||
if (skipCount < m_userMarks.size())
|
||||
m_userMarks.erase(m_userMarks.begin() + skipCount, m_userMarks.end());
|
||||
m_userMarks.erase(m_userMarks.begin(), m_userMarks.end() - skipCount);
|
||||
}
|
||||
|
||||
void UserMarkContainer::SetIsDrawable(bool isDrawable)
|
||||
|
|
Loading…
Add table
Reference in a new issue