From 96c14e00ed2d4683a8d27139ae57886a78ed7f12 Mon Sep 17 00:00:00 2001 From: rachytski Date: Thu, 8 Sep 2011 13:36:24 +0300 Subject: [PATCH] fixed constant GPS radius bug. closes #330 --- map/location_state.cpp | 7 ++++--- yg/shape_renderer.cpp | 9 +++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/map/location_state.cpp b/map/location_state.cpp index 387daad197..af0aca99b4 100644 --- a/map/location_state.cpp +++ b/map/location_state.cpp @@ -73,9 +73,10 @@ namespace location if ((m_flags & State::EGps) || (m_flags & State::ECompass)) { - pxPosition = screen.GtoP(Position()) - pxShift; - pxErrorRadius = pxPosition.Length(screen.GtoP(Position() - + m2::PointD(ErrorRadius(), 0))); + pxPosition = screen.GtoP(Position()); + pxErrorRadius = pxPosition.Length(screen.GtoP(Position() + m2::PointD(ErrorRadius(), 0))); + + pxPosition -= pxShift; if (m_flags & State::EGps) { diff --git a/yg/shape_renderer.cpp b/yg/shape_renderer.cpp index caa448b08c..878d603e66 100644 --- a/yg/shape_renderer.cpp +++ b/yg/shape_renderer.cpp @@ -22,6 +22,9 @@ namespace yg vector pts; approximateArc(center, startA, endA, r, pts); + if (pts.size() < 2) + return; + drawPath(&pts[0], pts.size(), 0, skin()->mapPenInfo(yg::PenInfo(c, 3, 0, 0, 0)), depth); } @@ -43,6 +46,9 @@ namespace yg approximateArc(center, startA, endA, r, pts); pts.push_back(center); + if (pts.size() < 3) + return; + drawPath(&pts[0], pts.size(), 0, skin()->mapPenInfo(yg::PenInfo(c, 2, 0, 0, 0)), depth); } @@ -53,6 +59,9 @@ namespace yg arcPts.push_back(center); approximateArc(center, startA, endA, r, arcPts); + if (arcPts.size() < 3) + return; + m2::PointD pt0 = arcPts[0]; m2::PointD pt1 = arcPts[1];