forked from organicmaps/organicmaps
Search by world map
This commit is contained in:
parent
cfd16d8c8b
commit
718503d631
3 changed files with 16 additions and 5 deletions
|
@ -1070,7 +1070,9 @@ void FrameWork<TModel>::AddRedrawCommandSure()
|
|||
string name;
|
||||
f.GetName(name);
|
||||
if (!name.empty() && name.find(m_text) != string::npos)
|
||||
m_callback(name, f.GetLimitRect(16)); //@TODO hardcoded scale
|
||||
{
|
||||
m_callback(name, f.GetLimitRect(-1));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
@ -1078,8 +1080,12 @@ void FrameWork<TModel>::AddRedrawCommandSure()
|
|||
template<typename TModel>
|
||||
void FrameWork<TModel>::Search(string const & text, SearchCallbackT callback) const
|
||||
{
|
||||
threads::MutexGuard lock(m_modelSyn);
|
||||
SearchProcessor doClass(text, callback);
|
||||
m_model.ForEachFeature(m_navigator.Screen().GlobalRect(), doClass);
|
||||
m_model.ForEachFeatureWithScale(m2::RectD(MercatorBounds::minX,
|
||||
MercatorBounds::minY,
|
||||
MercatorBounds::maxX,
|
||||
MercatorBounds::maxY), doClass, 9);
|
||||
}
|
||||
|
||||
template class FrameWork<model::FeaturesFetcher>;
|
||||
|
|
|
@ -134,7 +134,7 @@ class FrameWork
|
|||
LocationRetrievedCallbackT m_locationObserver;
|
||||
location::State m_locationState;
|
||||
|
||||
threads::Mutex m_modelSyn;
|
||||
mutable threads::Mutex m_modelSyn;
|
||||
|
||||
void AddRedrawCommandSure();
|
||||
void AddRedrawCommand();
|
||||
|
|
|
@ -357,12 +357,17 @@ void MainWindow::OnSearchTextChanged(QString const & str)
|
|||
void MainWindow::OnSearchResult(string const & name, m2::RectD const & rect)
|
||||
{
|
||||
QTableWidget * table = static_cast<QTableWidget *>(m_Docks[3]->widget());
|
||||
table->insertRow(0);
|
||||
|
||||
int const rowCount = table->rowCount();
|
||||
if (rowCount > 100)
|
||||
return;
|
||||
|
||||
table->setRowCount(rowCount + 1);
|
||||
QTableWidgetItem * item = new QTableWidgetItem(QString::fromUtf8(name.c_str()));
|
||||
item->setData(Qt::UserRole, QRectF(QPointF(rect.minX(), rect.maxY()),
|
||||
QPointF(rect.maxX(), rect.minY())));
|
||||
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
table->setItem(0, 0, item);
|
||||
table->setItem(rowCount, 0, item);
|
||||
|
||||
if (!m_Docks[3]->isVisible())
|
||||
m_Docks[3]->show();
|
||||
|
|
Loading…
Add table
Reference in a new issue