diff options
Diffstat (limited to 'map/compass_arrow.cpp')
-rw-r--r-- | map/compass_arrow.cpp | 176 |
1 files changed, 66 insertions, 110 deletions
diff --git a/map/compass_arrow.cpp b/map/compass_arrow.cpp index d0beff1250..7f1ca34338 100644 --- a/map/compass_arrow.cpp +++ b/map/compass_arrow.cpp @@ -19,27 +19,27 @@ CompassArrow::Params::Params() {} CompassArrow::CompassArrow(Params const & p) - : BaseT(p), - m_pixelSize(-1, -1), - m_angle(0), + : m_angle(0), m_framework(p.m_framework) { } void CompassArrow::AnimateShow() { - if (!isVisible()) - { - setIsVisible(true); - double startValue = m_animTask == nullptr ? 0.1 : GetCurrentAlfa(); - CreateAnim(startValue, 1.0, 0.2, 0.0, true); - } + ///@TODO UVR +// if (!isVisible()) +// { +// setIsVisible(true); +// double startValue = m_animTask == nullptr ? 0.1 : GetCurrentAlfa(); +// CreateAnim(startValue, 1.0, 0.2, 0.0, true); +// } } void CompassArrow::AnimateHide() { - if (isBaseVisible() && (m_animTask == NULL || !IsHidingAnim())) - CreateAnim(1.0, 0.0, 0.3, 0.0, false); + ///@TODO UVR +// if (isBaseVisible() && (m_animTask == NULL || !IsHidingAnim())) +// CreateAnim(1.0, 0.0, 0.3, 0.0, false); } void CompassArrow::SetAngle(double angle) @@ -47,44 +47,26 @@ void CompassArrow::SetAngle(double angle) m_angle = angle; } -m2::PointI CompassArrow::GetPixelSize() const -{ - if (m_pixelSize == m2::PointI(-1, -1)) - { - Resource const * res = GetCompassResource(); - m_pixelSize = m2::PointI(res->m_texRect.SizeX(), res->m_texRect.SizeY()); - } - return m_pixelSize; -} +///@TODO UVR +//void CompassArrow::draw(OverlayRenderer * r, +// math::Matrix<double, 3, 3> const & m) const +//{ +// if (isBaseVisible()) +// { +// checkDirtyLayout(); -void CompassArrow::GetMiniBoundRects(RectsT & rects) const -{ - double const halfW = m_pixelSize.x / 2.0; - double const halfH = m_pixelSize.y / 2.0; +// UniformsHolder holder; +// holder.insertValue(ETransparency, GetCurrentAlfa()); - rects.push_back(m2::AnyRectD(pivot(), -math::pi / 2 + m_angle, - m2::RectD(-halfW, -halfH, halfW, halfH))); -} +// math::Matrix<double, 3, 3> drawM = math::Shift( +// math::Rotate( +// math::Identity<double, 3>(), +// m_angle), +// pivot()); -void CompassArrow::draw(OverlayRenderer * r, - math::Matrix<double, 3, 3> const & m) const -{ - if (isBaseVisible()) - { - checkDirtyLayout(); - - UniformsHolder holder; - holder.insertValue(ETransparency, GetCurrentAlfa()); - - math::Matrix<double, 3, 3> drawM = math::Shift( - math::Rotate( - math::Identity<double, 3>(), - m_angle), - pivot()); - - r->drawDisplayList(m_dl.get(), drawM * m, &holder); - } -} +// r->drawDisplayList(m_dl.get(), drawM * m, &holder); +// } +//} bool CompassArrow::isVisible() const { @@ -96,7 +78,8 @@ bool CompassArrow::isVisible() const void CompassArrow::AlfaAnimEnded(bool isVisible) { - setIsVisible(isVisible); + ///@TODO UVR + //setIsVisible(isVisible); m_animTask.reset(); } @@ -131,84 +114,57 @@ void CompassArrow::CreateAnim(double startAlfa, double endAlfa, double timeInter m_framework->GetAnimController()->AddTask(m_animTask); } -const Resource * CompassArrow::GetCompassResource() const -{ - Screen * cacheScreen = m_controller->GetCacheScreen(); - Icon::Info icon("compass-image"); - Resource const * res = m_controller->GetCacheScreen()->fromID(cacheScreen->findInfo(icon)); - ASSERT(res, ("Commpass-image not founded")); - return res; -} - void CompassArrow::cache() { - Screen * cacheScreen = m_controller->GetCacheScreen(); + ///@TODO UVR +// Screen * cacheScreen = m_controller->GetCacheScreen(); - m_dl.reset(); - m_dl.reset(cacheScreen->createDisplayList()); +// m_dl.reset(); +// m_dl.reset(cacheScreen->createDisplayList()); - cacheScreen->beginFrame(); - cacheScreen->setDisplayList(m_dl.get()); - cacheScreen->applyVarAlfaStates(); +// cacheScreen->beginFrame(); +// cacheScreen->setDisplayList(m_dl.get()); +// cacheScreen->applyVarAlfaStates(); - Resource const * res = GetCompassResource(); - shared_ptr<gl::BaseTexture> texture = cacheScreen->pipeline(res->m_pipelineID).texture(); - m2::RectU rect = res->m_texRect; - double halfW = rect.SizeX() / 2.0; - double halfH = rect.SizeY() / 2.0; +// Resource const * res = GetCompassResource(); +// shared_ptr<gl::BaseTexture> texture = cacheScreen->pipeline(res->m_pipelineID).texture(); +// m2::RectU rect = res->m_texRect; +// double halfW = rect.SizeX() / 2.0; +// double halfH = rect.SizeY() / 2.0; - m2::PointD coords[] = - { - m2::PointD(-halfW, -halfH), - m2::PointD(-halfW, halfH), - m2::PointD(halfW, -halfH), - m2::PointD(halfW, halfH), - }; - - m2::PointF normal(0.0, 0.0); - m2::PointF texCoords[] = - { - texture->mapPixel(m2::PointF(rect.minX(), rect.minY())), - texture->mapPixel(m2::PointF(rect.minX(), rect.maxY())), - texture->mapPixel(m2::PointF(rect.maxX(), rect.minY())), - texture->mapPixel(m2::PointF(rect.maxX(), rect.maxY())), - }; +// m2::PointD coords[] = +// { +// m2::PointD(-halfW, -halfH), +// m2::PointD(-halfW, halfH), +// m2::PointD(halfW, -halfH), +// m2::PointD(halfW, halfH), +// }; + +// m2::PointF normal(0.0, 0.0); +// m2::PointF texCoords[] = +// { +// texture->mapPixel(m2::PointF(rect.minX(), rect.minY())), +// texture->mapPixel(m2::PointF(rect.minX(), rect.maxY())), +// texture->mapPixel(m2::PointF(rect.maxX(), rect.minY())), +// texture->mapPixel(m2::PointF(rect.maxX(), rect.maxY())), +// }; - cacheScreen->addTexturedStripStrided(coords, sizeof(m2::PointD), - &normal, 0, - texCoords, sizeof(m2::PointF), - 4, depth(), res->m_pipelineID); +// cacheScreen->addTexturedStripStrided(coords, sizeof(m2::PointD), +// &normal, 0, +// texCoords, sizeof(m2::PointF), +// 4, depth(), res->m_pipelineID); - cacheScreen->setDisplayList(0); - cacheScreen->endFrame(); +// cacheScreen->setDisplayList(0); +// cacheScreen->endFrame(); } void CompassArrow::purge() { - m_dl.reset(); } bool CompassArrow::isBaseVisible() const { - return BaseT::isVisible(); -} - -bool CompassArrow::onTapEnded(m2::PointD const & pt) -{ - anim::Controller * animController = m_framework->GetAnimController(); - anim::Controller::Guard guard(animController); - - // switching off compass follow mode - m_framework->GetLocationState()->OnCompassTaped(); - m_framework->Invalidate(); - - return true; -} - -bool CompassArrow::hitTest(m2::PointD const & pt) const -{ - Resource const * res = GetCompassResource(); - double rad = 1.5 * max(res->m_texRect.SizeX() / 2.0, res->m_texRect.SizeY() / 2.0); - return pt.Length(pivot()) < rad * visualScale(); + ///@TODO UVR + return false; } |