Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/qt
diff options
context:
space:
mode:
authorVladimir Byko-Ianko <v.bykoianko@corp.mail.ru>2019-03-09 09:38:38 +0300
committerVladimir Byko-Ianko <v.bykoianko@corp.mail.ru>2019-03-09 10:01:04 +0300
commit848a6ab5eaa13f89d73bc26e7a19c0e0c11f9b79 (patch)
tree2a8c6d7752488d10538fc544c6b3aa6fa0e19986 /qt
parent8dceb19e7c17039c34de13964905054e0e2ed9da (diff)
Displaying in openlr_assessment_tool osm features tags.
Diffstat (limited to 'qt')
-rw-r--r--qt/draw_widget.cpp46
-rw-r--r--qt/draw_widget.hpp1
-rw-r--r--qt/qt_common/map_widget.cpp47
-rw-r--r--qt/qt_common/map_widget.hpp10
4 files changed, 57 insertions, 47 deletions
diff --git a/qt/draw_widget.cpp b/qt/draw_widget.cpp
index b76c86030b..da9c49a455 100644
--- a/qt/draw_widget.cpp
+++ b/qt/draw_widget.cpp
@@ -39,22 +39,12 @@ using namespace qt::common;
namespace
{
search::ReverseGeocoder::Address GetFeatureAddressInfo(Framework const & framework,
- FeatureType & ft)
-{
- search::ReverseGeocoder const coder(framework.GetDataSource());
- search::ReverseGeocoder::Address address;
- coder.GetExactAddress(ft, address);
-
- return address;
-}
-
-search::ReverseGeocoder::Address GetFeatureAddressInfo(Framework const & framework,
FeatureID const & fid)
{
FeatureType ft;
if (!framework.GetFeatureByID(fid, ft))
return {};
- return GetFeatureAddressInfo(framework, ft);
+ return qt::common::GetFeatureAddressInfo(framework, ft);
}
} // namespace
@@ -514,40 +504,6 @@ void DrawWidget::ShowPlacePage(place_page::Info const & info)
m_framework.DeactivateMapSelection(false);
}
-void DrawWidget::ShowInfoPopup(QMouseEvent * e, m2::PointD const & pt)
-{
- // show feature types
- QMenu menu;
- auto const addStringFn = [&menu](string const & s)
- {
- if (s.empty())
- return;
-
- menu.addAction(QString::fromUtf8(s.c_str()));
- };
-
- m_framework.ForEachFeatureAtPoint([&](FeatureType & ft)
- {
- string concat;
- auto types = feature::TypesHolder(ft);
- types.SortBySpec();
- for (auto const & type : types.ToObjectNames())
- concat += type + " ";
- addStringFn(concat);
-
- std::string name;
- ft.GetReadableName(name);
- addStringFn(name);
-
- auto const info = GetFeatureAddressInfo(m_framework, ft);
- addStringFn(info.FormatAddress());
-
- menu.addSeparator();
- }, m_framework.PtoG(pt));
-
- menu.exec(e->pos());
-}
-
void DrawWidget::SetRouter(routing::RouterType routerType)
{
m_framework.GetRoutingManager().SetRouter(routerType);
diff --git a/qt/draw_widget.hpp b/qt/draw_widget.hpp
index 72a1bf7a43..589fdefac8 100644
--- a/qt/draw_widget.hpp
+++ b/qt/draw_widget.hpp
@@ -102,7 +102,6 @@ private:
void SubmitFakeLocationPoint(m2::PointD const & pt);
void SubmitRoutingPoint(m2::PointD const & pt);
void SubmitBookmark(m2::PointD const & pt);
- void ShowInfoPopup(QMouseEvent * e, m2::PointD const & pt);
void ShowPlacePage(place_page::Info const & info);
void UpdateCountryStatus(storage::CountryId const & countryId);
diff --git a/qt/qt_common/map_widget.cpp b/qt/qt_common/map_widget.cpp
index 304958789f..00d2a98ec6 100644
--- a/qt/qt_common/map_widget.cpp
+++ b/qt/qt_common/map_widget.cpp
@@ -9,10 +9,13 @@
#include "base/assert.hpp"
+#include <string>
+
#include <QtGui/QMouseEvent>
#include <QtGui/QOpenGLFunctions>
#include <QtGui/QOpenGLShaderProgram>
#include <QtWidgets/QAction>
+#include <QtWidgets/QMenu>
#include <QtGui/QOpenGLBuffer>
#include <QtGui/QOpenGLVertexArrayObject>
@@ -265,6 +268,40 @@ void MapWidget::Build()
m_vao->release();
}
+void MapWidget::ShowInfoPopup(QMouseEvent * e, m2::PointD const & pt)
+{
+ // show feature types
+ QMenu menu;
+ auto const addStringFn = [&menu](string const & s) {
+ if (s.empty())
+ return;
+
+ menu.addAction(QString::fromUtf8(s.c_str()));
+ };
+
+ m_framework.ForEachFeatureAtPoint(
+ [&](FeatureType & ft) {
+ string concat;
+ auto types = feature::TypesHolder(ft);
+ types.SortBySpec();
+ for (auto const & type : types.ToObjectNames())
+ concat += type + " ";
+ addStringFn(concat);
+
+ std::string name;
+ ft.GetReadableName(name);
+ addStringFn(name);
+
+ auto const info = GetFeatureAddressInfo(m_framework, ft);
+ addStringFn(info.FormatAddress());
+
+ menu.addSeparator();
+ },
+ m_framework.PtoG(pt));
+
+ menu.exec(e->pos());
+}
+
void MapWidget::initializeGL()
{
ASSERT(m_contextFactory == nullptr, ());
@@ -369,5 +406,15 @@ void MapWidget::wheelEvent(QWheelEvent * e)
QOpenGLWidget::wheelEvent(e);
m_framework.Scale(exp(e->delta() / 360.0), m2::PointD(L2D(e->x()), L2D(e->y())), false);
}
+
+search::ReverseGeocoder::Address GetFeatureAddressInfo(Framework const & framework,
+ FeatureType & ft)
+{
+ search::ReverseGeocoder const coder(framework.GetDataSource());
+ search::ReverseGeocoder::Address address;
+ coder.GetExactAddress(ft, address);
+
+ return address;
+}
} // namespace common
} // namespace qt
diff --git a/qt/qt_common/map_widget.hpp b/qt/qt_common/map_widget.hpp
index 27c78266c0..54a04e7b0c 100644
--- a/qt/qt_common/map_widget.hpp
+++ b/qt/qt_common/map_widget.hpp
@@ -4,10 +4,14 @@
#include "drape_frontend/gui/skin.hpp"
#include "drape_frontend/user_event_stream.hpp"
-#include "kml/type_utils.hpp"
+#include "search/reverse_geocoder.hpp"
#include "qt/qt_common/qtoglcontextfactory.hpp"
+#include "kml/type_utils.hpp"
+
+#include "indexer/feature.hpp"
+
#include <QtCore/QTimer>
#include <QtWidgets/QOpenGLWidget>
@@ -73,6 +77,7 @@ protected:
void UpdateScaleControl();
void Build();
+ void ShowInfoPopup(QMouseEvent * e, m2::PointD const & pt);
// QOpenGLWidget overrides:
void initializeGL() override;
@@ -101,5 +106,8 @@ protected:
unique_ptr<QOpenGLVertexArrayObject> m_vao;
unique_ptr<QOpenGLBuffer> m_vbo;
};
+
+search::ReverseGeocoder::Address GetFeatureAddressInfo(Framework const & framework,
+ FeatureType & ft);
} // namespace common
} // namespace qt