diff --git a/map/bookmark.hpp b/map/bookmark.hpp new file mode 100644 index 0000000000..d99f73a6e2 --- /dev/null +++ b/map/bookmark.hpp @@ -0,0 +1,20 @@ +#pragma once + +#include "../geometry/point2d.hpp" + +#include "../std/string.hpp" + + +class Bookmark +{ + m2::PointD m_org; + string m_name; + +public: + Bookmark(m2::PointD const & org, string const & name) + : m_org(org), m_name(name) + { + } + + m2::PointD GetOrg() const { return m_org; } +}; diff --git a/map/framework.cpp b/map/framework.cpp index 47f1f388de..cf6b79fcdf 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -181,6 +181,16 @@ void Framework::RemoveLocalMaps() m_model.RemoveAllCountries(); } +void Framework::AddBookmark(m2::PointD const & pt, string const & name) +{ + m_bookmarks.push_back(Bookmark(pt, name)); +} + +void Framework::ClearBookmarks() +{ + m_bookmarks.clear(); +} + void Framework::GetLocalMaps(vector & outMaps) { Platform & pl = GetPlatform(); @@ -378,7 +388,9 @@ void Framework::DrawAdditionalInfo(shared_ptr const & e) { ASSERT ( m_renderPolicy, () ); - e->drawer()->screen()->beginFrame(); + DrawerYG * pDrawer = e->drawer(); + + pDrawer->screen()->beginFrame(); /// m_informationDisplay is set and drawn after the m_renderPolicy @@ -394,14 +406,20 @@ void Framework::DrawAdditionalInfo(shared_ptr const & e) m_informationDisplay.enableRuler(true/*!IsEmptyModel()*/); - m_informationDisplay.doDraw(e->drawer()); + m_informationDisplay.doDraw(pDrawer); - m_locationState.DrawMyPosition(*e->drawer(), m_navigator.Screen()); + m_locationState.DrawMyPosition(*pDrawer, m_navigator.Screen()); if (m_drawPlacemark) - m_informationDisplay.drawPlacemark(e->drawer(), m_navigator.GtoP(m_placemark)); + m_informationDisplay.drawPlacemark(pDrawer, "placemark", m_navigator.GtoP(m_placemark)); - e->drawer()->screen()->endFrame(); + for (list::const_iterator i = m_bookmarks.begin(); i != m_bookmarks.end(); ++i) + { + /// @todo Pass different symbol. + m_informationDisplay.drawPlacemark(pDrawer, "placemark", m_navigator.GtoP(i->GetOrg())); + } + + pDrawer->screen()->endFrame(); } /// Function for calling from platform dependent-paint function. diff --git a/map/framework.hpp b/map/framework.hpp index 323f9c6419..e4fec3da9e 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -8,9 +8,12 @@ #include "location_state.hpp" #include "navigator.hpp" #include "feature_vec_model.hpp" +#include "bookmark.hpp" #include "../defines.hpp" +#include "../search/search_engine.hpp" + #include "../storage/storage.hpp" #include "../indexer/mercator.hpp" @@ -43,8 +46,6 @@ #include "../std/scoped_ptr.hpp" #include "../std/target_os.hpp" -#include "../search/search_engine.hpp" - //#define DRAW_TOUCH_POINTS @@ -59,6 +60,8 @@ protected: model::FeaturesFetcher m_model; Navigator m_navigator; + list m_bookmarks; + scoped_ptr m_renderPolicy; bool m_hasPendingInvalidate, m_doForceUpdate, m_queryMaxScaleMode, m_drawPlacemark; @@ -116,6 +119,9 @@ public: void AddLocalMaps(); void RemoveLocalMaps(); + void AddBookmark(m2::PointD const & pt, string const & name); + void ClearBookmarks(); + storage::Storage & Storage() { return m_storage; } void OnLocationStatusChanged(location::TLocationStatus newStatus); diff --git a/map/information_display.cpp b/map/information_display.cpp index 6e88cfe7f3..ddb2c28ec6 100644 --- a/map/information_display.cpp +++ b/map/information_display.cpp @@ -243,9 +243,9 @@ void InformationDisplay::drawMemoryWarning(DrawerYG * drawer) enableMemoryWarning(false); } -void InformationDisplay::drawPlacemark(DrawerYG * pDrawer, m2::PointD const & pt) +void InformationDisplay::drawPlacemark(DrawerYG * pDrawer, char const * symbol, m2::PointD const & pt) { - pDrawer->drawSymbol(pt, "placemark", yg::EPosAbove, yg::maxDepth); + pDrawer->drawSymbol(pt, symbol, yg::EPosAbove, yg::maxDepth); } /* diff --git a/map/information_display.hpp b/map/information_display.hpp index 7a777a7ffe..59bbe661bc 100644 --- a/map/information_display.hpp +++ b/map/information_display.hpp @@ -101,7 +101,7 @@ public: void memoryWarning(); void drawMemoryWarning(DrawerYG * pDrawer); - void drawPlacemark(DrawerYG * pDrawer, m2::PointD const & pt); + void drawPlacemark(DrawerYG * pDrawer, char const * symbol, m2::PointD const & pt); void enableBenchmarkInfo(bool doEnable); bool addBenchmarkInfo(string const & name, m2::RectD const & globalRect, double frameDuration); diff --git a/map/map.pro b/map/map.pro index 39bd6d8d29..52574d9e94 100644 --- a/map/map.pro +++ b/map/map.pro @@ -44,7 +44,8 @@ HEADERS += \ basic_render_policy.hpp \ proto_to_yg_styles.hpp \ test_render_policy.hpp \ - queued_render_policy.hpp + queued_render_policy.hpp \ + bookmark.hpp SOURCES += \ feature_vec_model.cpp \ diff --git a/qt/search_panel.cpp b/qt/search_panel.cpp index ed293c78c5..fdaadcd6c0 100644 --- a/qt/search_panel.cpp +++ b/qt/search_panel.cpp @@ -123,6 +123,9 @@ void SearchPanel::OnSearchResult(ResultsT * res, int queryId) m_pTable->setRowCount(0); m_results.clear(); + Framework & frm = m_pDrawWidget->GetFramework(); + frm.ClearBookmarks(); + for (ResultsT::IterT i = res->Begin(); i != res->End(); ++i) { ResultT const & e = *i; @@ -135,6 +138,8 @@ void SearchPanel::OnSearchResult(ResultsT * res, int queryId) if (e.GetResultType() == ResultT::RESULT_FEATURE) { + frm.AddBookmark(e.GetFeatureCenter(), e.GetString()); + m_pTable->setItem(rowCount, 0, create_item(QString::fromUtf8(e.GetFeatureType())));