diff options
author | ExMix <rahuba.youri@mapswithme.com> | 2014-10-08 11:35:23 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:29:37 +0300 |
commit | b0a390f1943873f12153e7bf0282198e9bc0ff43 (patch) | |
tree | 8b1cb96c232c15aadb258b07ee1a8d2606b8d5ef /map/information_display.cpp | |
parent | 943dc568bcaaba64ad1048d9e7b3142cfe162484 (diff) |
[core] remove useless code
Diffstat (limited to 'map/information_display.cpp')
-rw-r--r-- | map/information_display.cpp | 160 |
1 files changed, 15 insertions, 145 deletions
diff --git a/map/information_display.cpp b/map/information_display.cpp index e21bb5593e..d28f4d8ab3 100644 --- a/map/information_display.cpp +++ b/map/information_display.cpp @@ -33,7 +33,6 @@ namespace InformationDisplay::InformationDisplay(Framework * fw) : m_framework(fw) - , m_visualScale(1) { m_fontDesc.m_color = Color(0x4D, 0x4D, 0x4D, 0xCC); @@ -44,19 +43,11 @@ InformationDisplay::InformationDisplay(Framework * fw) InitDebugLabel(); InitCopyright(fw); - enableDebugPoints(false); +#ifdef DEBUG enableDebugInfo(false); - enableMemoryWarning(false); - enableBenchmarkInfo(false); - enableCountryStatusDisplay(false); +#endif - m_compassArrow->setIsVisible(false); - m_ruler->setIsVisible(false); - - for (size_t i = 0; i < ARRAY_SIZE(m_DebugPts); ++i) - m_DebugPts[i] = m2::PointD(0, 0); - - setVisualScale(m_visualScale); + setVisualScale(1); } void InformationDisplay::InitRuler(Framework * fw) @@ -68,6 +59,7 @@ void InformationDisplay::InitRuler(Framework * fw) p.m_framework = fw; m_ruler.reset(new Ruler(p)); + m_ruler->setIsVisible(false); } void InformationDisplay::InitCountryStatusDisplay(Framework * fw) @@ -104,6 +96,7 @@ void InformationDisplay::InitCompassArrow(Framework * fw) p.m_framework = fw; m_compassArrow.reset(new CompassArrow(p)); + m_compassArrow->setIsVisible(false); } void InformationDisplay::InitLocationState(Framework * fw) @@ -158,45 +151,24 @@ void InformationDisplay::setController(gui::Controller * controller) void InformationDisplay::setDisplayRect(m2::RectI const & rect) { - m_displayRect = rect; - + double visualScale = m_framework->GetVisualScale(); m_countryStatusDisplay->setPivot(m2::PointD(rect.Center())); m2::PointD const size = m_compassArrow->GetPixelSize(); - m_compassArrow->setPivot(m2::PointD(COMPASS_X_OFFSET * m_visualScale + size.x / 2.0, - rect.maxY() - COMPASS_Y_OFFSET * m_visualScale - size.y / 2.0)); + m_compassArrow->setPivot(m2::PointD(COMPASS_X_OFFSET * visualScale + size.x / 2.0, + rect.maxY() - COMPASS_Y_OFFSET * visualScale - size.y / 2.0)); - m_ruler->setPivot(m2::PointD(rect.maxX() - RULLER_X_OFFSET * m_visualScale, - rect.maxY() - RULLER_Y_OFFSET * m_visualScale)); + m_ruler->setPivot(m2::PointD(rect.maxX() - RULLER_X_OFFSET * visualScale, + rect.maxY() - RULLER_Y_OFFSET * visualScale)); if (m_copyrightLabel) { - m_copyrightLabel->setPivot(m2::PointD(rect.maxX() - RULLER_X_OFFSET * m_visualScale, - rect.maxY() - RULLER_Y_OFFSET * m_visualScale)); + m_copyrightLabel->setPivot(m2::PointD(rect.maxX() - RULLER_X_OFFSET * visualScale, + rect.maxY() - RULLER_Y_OFFSET * visualScale)); } m_debugLabel->setPivot(m2::PointD(rect.minX() + 10, - rect.minY() + 50 + 5 * m_visualScale)); -} - -void InformationDisplay::enableDebugPoints(bool doEnable) -{ - m_isDebugPointsEnabled = doEnable; -} - -void InformationDisplay::setDebugPoint(int pos, m2::PointD const & pt) -{ - m_DebugPts[pos] = pt; -} - -void InformationDisplay::drawDebugPoints(Drawer * pDrawer) -{ - for (size_t i = 0; i < ARRAY_SIZE(m_DebugPts); ++i) - if (m_DebugPts[i] != m2::PointD(0, 0)) - { - pDrawer->screen()->drawArc(m_DebugPts[i], 0, math::pi * 2, 30, Color(0, 0, 255, 32), debugDepth); - pDrawer->screen()->fillSector(m_DebugPts[i], 0, math::pi * 2, 30, Color(0, 0, 255, 32), debugDepth); - } + rect.minY() + 50 + 5 * visualScale)); } bool InformationDisplay::isCopyrightActive() const @@ -219,9 +191,7 @@ bool InformationDisplay::isRulerEnabled() const void InformationDisplay::setVisualScale(double visualScale) { - m_visualScale = visualScale; - - m_fontDesc.m_size = static_cast<uint32_t>(FONT_SIZE * m_visualScale); + m_fontDesc.m_size = static_cast<uint32_t>(FONT_SIZE * visualScale); m_ruler->setFont(gui::Element::EActive, m_fontDesc); m_debugLabel->setFont(gui::Element::EActive, m_fontDesc); @@ -242,36 +212,6 @@ void InformationDisplay::setDebugInfo(double frameDuration, int currentScale) m_debugLabel->setText(out.str()); } -void InformationDisplay::enableMemoryWarning(bool flag) -{ - m_isMemoryWarningEnabled = flag; -} - -void InformationDisplay::memoryWarning() -{ - enableMemoryWarning(true); - m_lastMemoryWarning = my::Timer(); -} - -void InformationDisplay::drawMemoryWarning(Drawer * drawer) -{ - m_yOffset += 20; - m2::PointD pos(m_displayRect.minX() + 10, m_displayRect.minY() + m_yOffset); - - ostringstream out; - out << "MemoryWarning : " << m_lastMemoryWarning.ElapsedSeconds() << " sec. ago."; - - drawer->screen()->drawText(m_fontDesc, - pos, - EPosAboveRight, - out.str(), - debugDepth, - false); - - if (m_lastMemoryWarning.ElapsedSeconds() > 5) - enableMemoryWarning(false); -} - void InformationDisplay::enableCompassArrow(bool doEnable) { if (doEnable) @@ -290,79 +230,9 @@ void InformationDisplay::setCompassArrowAngle(double angle) m_compassArrow->SetAngle(angle); } -void InformationDisplay::enableCountryStatusDisplay(bool doEnable) -{ - m_countryStatusDisplay->setIsVisible(doEnable); -} - void InformationDisplay::setEmptyCountryIndex(storage::TIndex const & idx) { - m_countryStatusDisplay->setCountryIndex(idx); -} - -void InformationDisplay::setDownloadListener(gui::Button::TOnClickListener const & l) -{ - m_downloadButton->setOnClickListener(l); -} - -void InformationDisplay::enableBenchmarkInfo(bool doEnable) -{ - m_isBenchmarkInfoEnabled = doEnable; -} - -bool InformationDisplay::addBenchmarkInfo(string const & name, m2::RectD const & globalRect, double frameDuration) -{ - BenchmarkInfo info; - info.m_name = name; - info.m_duration = frameDuration; - info.m_rect = globalRect; - m_benchmarkInfo.push_back(info); - - return true; -} - -void InformationDisplay::drawBenchmarkInfo(Drawer * pDrawer) -{ - m_yOffset += 20; - m2::PointD pos(m_displayRect.minX() + 10, m_displayRect.minY() + m_yOffset); - pDrawer->screen()->drawText(m_fontDesc, - pos, - EPosAboveRight, - "benchmark info :", - benchmarkDepth, - false); - - size_t const count = m_benchmarkInfo.size(); - for (size_t i = (count <= 5 ? 0 : count - 5); i < count; ++i) - { - ostringstream out; - m2::RectD const & r = m_benchmarkInfo[i].m_rect; - out << " " << m_benchmarkInfo[i].m_name - << ", " << "rect: (" << r.minX() - << ", " << r.minY() - << ", " << r.maxX() - << ", " << r.maxY() - << "), duration : " << m_benchmarkInfo[i].m_duration; - m_yOffset += 20; - pos.y += 20; - pDrawer->screen()->drawText(m_fontDesc, - pos, - EPosAboveRight, - out.str(), - benchmarkDepth, - false); - } -} - -void InformationDisplay::doDraw(Drawer *drawer) -{ - m_yOffset = 0; - if (m_isDebugPointsEnabled) - drawDebugPoints(drawer); - if (m_isMemoryWarningEnabled) - drawMemoryWarning(drawer); - if (m_isBenchmarkInfoEnabled) - drawBenchmarkInfo(drawer); + m_countryStatusDisplay->SetCountryIndex(idx); } shared_ptr<CountryStatusDisplay> const & InformationDisplay::countryStatusDisplay() const |