diff --git a/map/framework.cpp b/map/framework.cpp index 04528c9570..786d3dcc55 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -39,12 +39,14 @@ namespace fwork DrawProcessor::DrawProcessor( m2::RectD const & r, ScreenBase const & convertor, - shared_ptr paintEvent, - int scaleLevel) + shared_ptr const & paintEvent, + int scaleLevel, + shared_ptr const & renderState) : m_rect(r), m_convertor(convertor), m_paintEvent(paintEvent), - m_zoom(scaleLevel) + m_zoom(scaleLevel), + m_renderState(renderState) #ifdef PROFILER_DRAWING , m_drawCount(0) #endif @@ -118,6 +120,8 @@ namespace fwork return true; } + m_renderState->m_isEmptyModelCurrent = false; + shared_ptr ptr(new di::DrawInfo(f.GetName())); using namespace get_pts; diff --git a/map/framework.hpp b/map/framework.hpp index 62a64fd0ef..b37b63e9cf 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -61,6 +61,7 @@ namespace fwork vector m_keys; int m_zoom; + shared_ptr m_renderState; #ifdef PROFILER_DRAWING size_t m_drawCount; @@ -73,11 +74,12 @@ namespace fwork static const int reserve_rules_count = 16; public: + DrawProcessor(m2::RectD const & r, ScreenBase const & convertor, - shared_ptr paintEvent, - int scaleLevel); - + shared_ptr const & paintEvent, + int scaleLevel, + shared_ptr const & renderState); bool operator() (FeatureType const & f); }; @@ -360,7 +362,8 @@ public: int scaleLevel ) { - fwork::DrawProcessor doDraw(selectRect, screen, e, scaleLevel); + fwork::DrawProcessor doDraw(selectRect, screen, e, scaleLevel, m_renderQueue.renderStatePtr()); + m_renderQueue.renderStatePtr()->m_isEmptyModelCurrent = true; try { @@ -448,6 +451,9 @@ public: OGLCHECK(glTranslatef(-ptShift.x, -ptShift.y, 0)); ScreenBase currentScreen = m_navigator.Screen(); + + m_informationDisplay.enableEmptyModelMessage(m_renderQueue.renderStatePtr()->m_isEmptyModelActual); + if (m_isBenchmarking) currentScreen = m_renderQueue.renderState().m_actualScreen; diff --git a/map/information_display.cpp b/map/information_display.cpp index f835f641aa..fba7e20b9d 100644 --- a/map/information_display.cpp +++ b/map/information_display.cpp @@ -28,6 +28,7 @@ InformationDisplay::InformationDisplay() enableMemoryWarning(false); enableBenchmarkInfo(false); enableGlobalRect(false); + enableEmptyModelMessage(false); for (int i = 0; i < sizeof(m_DebugPts) / sizeof(m2::PointD); ++i) m_DebugPts[i] = m2::PointD(0, 0); @@ -526,6 +527,34 @@ void InformationDisplay::drawLog(DrawerYG * pDrawer) } } +void InformationDisplay::enableEmptyModelMessage(bool doEnable) +{ + m_isEmptyModelMessageEnabled = doEnable; +} + +void InformationDisplay::drawEmptyModelMessage(DrawerYG * pDrawer) +{ + m2::PointD pt = m_screen.PixelRect().Center() - m2::PointD(0, m_bottomShift * m_visualScale); + + char const s0 [] = "Nothing found. Have you tried downloading maps of the countries?"; + char const s1 [] = "Just the button at the bottom right corner to download the maps."; + + m2::RectD tr0 = pDrawer->screen()->textRect(s0, 10, true, false); + m2::RectD tr1 = pDrawer->screen()->textRect(s1, 10, true, false); + + pDrawer->screen()->drawText(m2::PointD(-tr0.SizeX() / 2, -tr0.SizeY() / 2) + pt, + 0, 10, yg::Color(255, 255, 255, 255), s0, true, yg::Color(255, 255, 255, 255), + yg::maxDepth, + true, + false); + + pDrawer->screen()->drawText(m2::PointD(-tr1.SizeX() / 2, -tr1.SizeY() / 2 + tr0.SizeY() + 5) + pt, + 0, 10, yg::Color(255, 255, 255, 255), s1, true, yg::Color(255, 255, 255, 255), + yg::maxDepth, + true, + false); +} + void InformationDisplay::enableBenchmarkInfo(bool doEnable) { m_isBenchmarkInfoEnabled = doEnable; @@ -625,4 +654,6 @@ void InformationDisplay::doDraw(DrawerYG *drawer) drawBenchmarkInfo(drawer); if (s_isLogEnabled) drawLog(drawer); + if (m_isEmptyModelMessageEnabled) + drawEmptyModelMessage(drawer); } diff --git a/map/information_display.hpp b/map/information_display.hpp index d328e80192..69fe6ca414 100644 --- a/map/information_display.hpp +++ b/map/information_display.hpp @@ -52,6 +52,8 @@ private: bool m_isDebugInfoEnabled; double m_frameDuration; + bool m_isEmptyModelMessageEnabled; + bool m_isBenchmarkInfoEnabled; struct BenchmarkInfo @@ -130,5 +132,8 @@ public: void setLogSize(size_t logSize); void drawLog(DrawerYG * pDrawer); + void enableEmptyModelMessage(bool doEnable); + void drawEmptyModelMessage(DrawerYG * pDrawer); + static void logMessage(my::LogLevel, my::SrcPoint const &, string const &); }; diff --git a/map/render_queue.cpp b/map/render_queue.cpp index 0bc8cd7662..56b63c5d6a 100644 --- a/map/render_queue.cpp +++ b/map/render_queue.cpp @@ -83,6 +83,11 @@ yg::gl::RenderState const & RenderQueue::renderState() const return *m_renderState.get(); } +shared_ptr const & RenderQueue::renderStatePtr() const +{ + return m_renderState; +} + void RenderQueue::memoryWarning() { m_routine->memoryWarning(); diff --git a/map/render_queue.hpp b/map/render_queue.hpp index 37ee858053..9ac5809a10 100644 --- a/map/render_queue.hpp +++ b/map/render_queue.hpp @@ -58,6 +58,8 @@ public: /// copy primary render state yg::gl::RenderState const CopyState() const; + shared_ptr const & renderStatePtr() const; + yg::gl::RenderState const & renderState() const; /// free all possible memory caches diff --git a/yg/render_state.cpp b/yg/render_state.cpp index 3444be9d7f..0d67d50078 100644 --- a/yg/render_state.cpp +++ b/yg/render_state.cpp @@ -12,7 +12,9 @@ namespace yg : m_backBufferLayers(1), m_isResized(false), m_doRepaintAll(false), - m_mutex(new threads::Mutex()) + m_mutex(new threads::Mutex()), + m_isEmptyModelActual(false), + m_isEmptyModelCurrent(false) {} bool RenderState::isPanning() const diff --git a/yg/render_state.hpp b/yg/render_state.hpp index a0933e1421..f56ddebcad 100644 --- a/yg/render_state.hpp +++ b/yg/render_state.hpp @@ -25,6 +25,8 @@ namespace yg shared_ptr m_actualTarget; /// Screen parameters ScreenBase m_actualScreen; + /// Empty-model flag + bool m_isEmptyModelActual; /// @} /// In-Progress rendering operation params @@ -37,6 +39,8 @@ namespace yg shared_ptr m_depthBuffer; /// Duration of the rendering operation double m_duration; + /// Empty-model flag of the current rendering operation + bool m_isEmptyModelCurrent; /// @} /// Surface height and width. diff --git a/yg/render_state_updater.cpp b/yg/render_state_updater.cpp index 6a84cf02ea..fc43b62b23 100644 --- a/yg/render_state_updater.cpp +++ b/yg/render_state_updater.cpp @@ -55,6 +55,7 @@ namespace yg threads::MutexGuard guard(*m_renderState->m_mutex.get()); swap(m_renderState->m_actualTarget, m_renderState->m_backBufferLayers.front()); m_renderState->m_actualScreen = m_renderState->m_currentScreen; + m_renderState->m_isEmptyModelActual = m_renderState->m_isEmptyModelCurrent; } /// blitting will be performed through