From 2967d56af3e4c51bb800781b5e6484e55f835406 Mon Sep 17 00:00:00 2001 From: rachytski Date: Sun, 4 Dec 2011 00:47:28 +0400 Subject: [PATCH] drawing empty model message. --- map/draw_processor.cpp | 6 +----- map/framework.cpp | 7 +++++++ map/information_display.cpp | 16 ++++++---------- map/information_display.hpp | 2 ++ map/render_queue_routine.cpp | 3 +++ 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/map/draw_processor.cpp b/map/draw_processor.cpp index d451cd67f6..7628bcd8cc 100644 --- a/map/draw_processor.cpp +++ b/map/draw_processor.cpp @@ -216,7 +216,6 @@ namespace fwork m_paintEvent(e), m_zoom(scaleLevel), m_hasNonCoast(false), - m_hasAnyFeature(false), m_glyphCache(e->drawer()->screen()->glyphCache()) #ifdef PROFILER_DRAWING , m_drawCount(0) @@ -407,16 +406,13 @@ namespace fwork } if (isExist) - { pDrawer->Draw(ptr.get(), rules.data(), count); - m_hasAnyFeature = true; - } return true; } bool DrawProcessor::IsEmptyDrawing() const { - return (m_zoom >= feature::g_arrCountryScales[0] && (!m_hasAnyFeature || !m_hasNonCoast)); + return (m_zoom >= feature::g_arrCountryScales[0] && !m_hasNonCoast); } } diff --git a/map/framework.cpp b/map/framework.cpp index 1893668f61..79b2520852 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -95,6 +95,13 @@ Framework::Framework() m_informationDisplay.enableDebugPoints(true); #endif + char const s [] = "Nothing found. Have you tried\n"\ + "downloading maps of the countries?\n"\ + "Just click the downloader button \n"\ + "at the bottom of the screen."; + + m_informationDisplay.setEmptyModelMessage(s); + m_informationDisplay.enableCenter(true); m_informationDisplay.enableRuler(true); m_informationDisplay.setRulerParams(m_minRulerWidth, m_metresMinWidth, m_metresMaxWidth); diff --git a/map/information_display.cpp b/map/information_display.cpp index 9f690b853c..8574dd62d0 100644 --- a/map/information_display.cpp +++ b/map/information_display.cpp @@ -318,19 +318,16 @@ void InformationDisplay::enableEmptyModelMessage(bool doEnable) m_isEmptyModelMessageEnabled = doEnable; } -//#ifdef OMIM_OS_IPHONE +void InformationDisplay::setEmptyModelMessage(char const * msg) +{ + m_emptyModelMessage = msg; +} + void InformationDisplay::drawEmptyModelMessage(DrawerYG * pDrawer) { m2::RectD pxRect = m_screen.PixelRect(); m2::PointD pt = m2::PointD(pxRect.SizeX() / 2, pxRect.SizeY() / 2) - m2::PointD(0, m_bottomShift * m_visualScale); - char const s [] = "Nothing found. Have you tried\n"\ - "downloading maps of the countries?\n"\ - "Just click the button at the bottom\n"\ - "right corner to download the maps."; - -// yg::FontDesc bigFont(false, 30 * m_visualScale); - yg::StraightTextElement::Params params; params.m_depth = yg::maxDepth; params.m_fontDesc = m_emptyMessageFont; @@ -338,7 +335,7 @@ void InformationDisplay::drawEmptyModelMessage(DrawerYG * pDrawer) params.m_pivot = pt; params.m_position = yg::EPosCenter; params.m_glyphCache = pDrawer->screen()->glyphCache(); - params.m_logText = strings::MakeUniString(s); + params.m_logText = strings::MakeUniString(m_emptyModelMessage); params.m_doSplit = true; params.m_delimiters = "\n"; params.m_useAllParts = true; @@ -347,7 +344,6 @@ void InformationDisplay::drawEmptyModelMessage(DrawerYG * pDrawer) ste.draw(pDrawer->screen().get(), math::Identity()); } -//#endif void InformationDisplay::enableBenchmarkInfo(bool doEnable) { diff --git a/map/information_display.hpp b/map/information_display.hpp index afc6f0fdbc..55db849ca4 100644 --- a/map/information_display.hpp +++ b/map/information_display.hpp @@ -44,6 +44,7 @@ private: double m_frameDuration; bool m_isEmptyModelMessageEnabled; + string m_emptyModelMessage; bool m_isBenchmarkInfoEnabled; @@ -109,6 +110,7 @@ public: void drawLog(DrawerYG * pDrawer); void enableEmptyModelMessage(bool doEnable); + void setEmptyModelMessage(char const * msg); void drawEmptyModelMessage(DrawerYG * pDrawer); static void logMessage(my::LogLevel, my::SrcPoint const &, string const &); diff --git a/map/render_queue_routine.cpp b/map/render_queue_routine.cpp index d99cb89af2..3b2a7f8287 100644 --- a/map/render_queue_routine.cpp +++ b/map/render_queue_routine.cpp @@ -336,7 +336,10 @@ void RenderQueueRoutine::Do() ); } else + { m_threadDrawer->screen()->infoLayer()->clear(); + m_renderState->m_isEmptyModelCurrent = true; + } } }