diff options
author | Maxim Pimenov <m@maps.me> | 2019-04-10 18:40:28 +0300 |
---|---|---|
committer | Tatiana Yan <tatiana.kondakova@gmail.com> | 2019-04-11 17:43:38 +0300 |
commit | a3b07b35a8429a8a97397cb4f2e7c32c7e684b97 (patch) | |
tree | 87c38999376de486bcf5b401eb79e5968783cfa1 /search | |
parent | b393f055e386af30db693aab307ac44c0c52c28c (diff) |
[search] [assessment-tool] Changed the display of the user's position.
We used to call Framework's methods (OnLocationUpdate/OnLocationError)
here but they come bundled with an unremovable heuristic that keeps the
old position for some time when the position is lost.
This resulted in sometimes showing wrong positions for the samples that
do not have position info (the search params worked correctly
and were not using the old pos).
Diffstat (limited to 'search')
-rw-r--r-- | search/search_quality/assessment_tool/sample_view.cpp | 20 | ||||
-rw-r--r-- | search/search_quality/assessment_tool/sample_view.hpp | 4 |
2 files changed, 20 insertions, 4 deletions
diff --git a/search/search_quality/assessment_tool/sample_view.cpp b/search/search_quality/assessment_tool/sample_view.cpp index 77ec0abc1c..969de74900 100644 --- a/search/search_quality/assessment_tool/sample_view.cpp +++ b/search/search_quality/assessment_tool/sample_view.cpp @@ -58,6 +58,9 @@ void SetVerticalStretch(QWidget & widget, int stretch) SampleView::SampleView(QWidget * parent, Framework & framework) : QWidget(parent), m_framework(framework) { + m_framework.GetBookmarkManager().GetEditSession().SetIsVisible(UserMark::Type::SEARCH, true); + m_framework.GetBookmarkManager().GetEditSession().SetIsVisible(UserMark::Type::COLORED, true); + auto * mainLayout = BuildLayout<QVBoxLayout>(this /* parent */); // When the dock for SampleView is attached to the right side of the @@ -242,8 +245,6 @@ void SampleView::ShowNonFoundResults(std::vector<search::Sample::Result> const & { CHECK_EQUAL(results.size(), entries.size(), ()); - m_framework.GetBookmarkManager().GetEditSession().SetIsVisible(UserMark::Type::SEARCH, true); - m_nonFoundResults->Clear(); bool allDeleted = true; @@ -343,10 +344,21 @@ void SampleView::OnRemoveNonFoundResult(int row) { m_nonFoundResultsEdits->Delet void SampleView::ShowUserPosition(m2::PointD const & position) { - m_framework.OnLocationUpdate(qt::common::MakeGpsInfo(position)); + // Clear the old position. + HideUserPosition(); + + auto es = m_framework.GetBookmarkManager().GetEditSession(); + auto mark = es.CreateUserMark<ColoredMarkPoint>(position); + mark->SetColor(dp::Color(200, 100, 240, 255) /* purple */); + mark->SetRadius(8.0f); + m_positionMarkId = mark->GetId(); } void SampleView::HideUserPosition() { - m_framework.OnLocationError(location::EGPSIsOff); + if (m_positionMarkId == kml::kInvalidMarkId) + return; + + m_framework.GetBookmarkManager().GetEditSession().DeleteUserMark(m_positionMarkId); + m_positionMarkId = kml::kInvalidMarkId; } diff --git a/search/search_quality/assessment_tool/sample_view.hpp b/search/search_quality/assessment_tool/sample_view.hpp index 8bb15ad4c9..6fc6c9eba7 100644 --- a/search/search_quality/assessment_tool/sample_view.hpp +++ b/search/search_quality/assessment_tool/sample_view.hpp @@ -6,6 +6,8 @@ #include "geometry/point2d.hpp" +#include "kml/type_utils.hpp" + #include <boost/optional.hpp> #include <QtCore/QMargins> @@ -90,5 +92,7 @@ private: QMargins m_rightAreaMargins; QMargins m_defaultMargins; + kml::MarkId m_positionMarkId = kml::kInvalidMarkId; + boost::optional<m2::PointD> m_position; }; |