Do additional search according to search mode.

This commit is contained in:
vng 2012-11-23 18:17:33 +03:00 committed by Alex Zolotarev
parent a8f49d2d39
commit 614e13677e
3 changed files with 8 additions and 5 deletions

View file

@ -293,7 +293,9 @@ void Engine::SearchAsync()
{
try
{
m_pQuery->SearchAdditional(res);
m_pQuery->SearchAdditional(res,
params.NeedSearch(SearchParams::AROUND_POSITION),
params.NeedSearch(SearchParams::IN_VIEWPORT));
}
catch (Query::CancelException const &)
{

View file

@ -1623,18 +1623,19 @@ void Query::SearchAllInViewport(m2::RectD const & viewport, Results & res, unsig
}
}
void Query::SearchAdditional(Results & res)
void Query::SearchAdditional(Results & res, bool nearMe, bool inViewport)
{
ClearQueues();
string name[2];
// search in mwm with position ...
if (m_position.x > empty_pos_value && m_position.y > empty_pos_value)
if (nearMe && m_position.x > empty_pos_value && m_position.y > empty_pos_value)
name[0] = m_pInfoGetter->GetRegionFile(m_position);
// ... and in mwm with viewport
name[1] = m_pInfoGetter->GetRegionFile(GetViewport().Center());
if (inViewport)
name[1] = m_pInfoGetter->GetRegionFile(GetViewport().Center());
LOG(LDEBUG, ("Additional MWM search: ", name[0], name[1]));

View file

@ -85,7 +85,7 @@ public:
void SearchCoordinates(string const & query, Results & res) const;
void Search(Results & res);
void SearchAllInViewport(m2::RectD const & viewport, Results & res, unsigned int resultsNeeded = 30);
void SearchAdditional(Results & res);
void SearchAdditional(Results & res, bool nearMe, bool inViewport);
//@}
void ClearCaches();