diff options
author | Sergey Pisarchik <pisarchik@mapswithme.com> | 2014-07-25 21:38:47 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:22:34 +0300 |
commit | a19eb91ca455a9afe8b5287492c786e90e540965 (patch) | |
tree | 5461de103f0f70387e256794a1bb6a887da1652b | |
parent | 01149efe0412e66be2e02f4dd85bde2ecfd92bc8 (diff) |
[Tizen] Review fixes.
-rw-r--r-- | tizen/MapsWithMe/inc/BookMarkSplitPanel.hpp | 2 | ||||
-rw-r--r-- | tizen/MapsWithMe/inc/BookMarkUtils.hpp | 2 | ||||
-rw-r--r-- | tizen/MapsWithMe/src/BookMarkSplitPanel.cpp | 33 | ||||
-rw-r--r-- | tizen/MapsWithMe/src/BookMarkUtils.cpp | 4 |
4 files changed, 19 insertions, 22 deletions
diff --git a/tizen/MapsWithMe/inc/BookMarkSplitPanel.hpp b/tizen/MapsWithMe/inc/BookMarkSplitPanel.hpp index 69fc9fdef2..1f5dac34ba 100644 --- a/tizen/MapsWithMe/inc/BookMarkSplitPanel.hpp +++ b/tizen/MapsWithMe/inc/BookMarkSplitPanel.hpp @@ -113,5 +113,5 @@ private: Tizen::Ui::Controls::ListView * m_pList; MapsWithMeForm * m_pMainForm; Tizen::Uix::Sensor::SensorManager m_sensorManager; - double m_NorthAzimut; + double m_northAzimuth; }; diff --git a/tizen/MapsWithMe/inc/BookMarkUtils.hpp b/tizen/MapsWithMe/inc/BookMarkUtils.hpp index ab834619f8..f9900a095e 100644 --- a/tizen/MapsWithMe/inc/BookMarkUtils.hpp +++ b/tizen/MapsWithMe/inc/BookMarkUtils.hpp @@ -27,7 +27,7 @@ Tizen::Base::String GetMarkName(UserMark const * pUserMark); Tizen::Base::String GetMarkType(UserMark const * pUserMark); Tizen::Base::String GetMarkCountry(UserMark const * pUserMark); Tizen::Base::String GetDistance(UserMark const * pUserMark); -double GetAzimut(UserMark const * pUserMark, double north); +double GetAzimuth(UserMark const * pUserMark, double north); const wchar_t * GetColorBM(EColor color); const wchar_t * GetColorPPBM(EColor color); diff --git a/tizen/MapsWithMe/src/BookMarkSplitPanel.cpp b/tizen/MapsWithMe/src/BookMarkSplitPanel.cpp index 072678de6c..10a69e9232 100644 --- a/tizen/MapsWithMe/src/BookMarkSplitPanel.cpp +++ b/tizen/MapsWithMe/src/BookMarkSplitPanel.cpp @@ -100,7 +100,7 @@ bool BookMarkSplitPanel::Construct(const Tizen::Graphics::FloatRectangle& rect) m_sensorManager.Construct(); if (m_sensorManager.IsAvailable(SENSOR_TYPE_MAGNETIC)) m_sensorManager.AddSensorListener(*this, SENSOR_TYPE_MAGNETIC, 50, true); - m_NorthAzimut = 0; + m_northAzimuth = 0; return true; } @@ -367,31 +367,28 @@ void BookMarkSplitPanel::UpdateCompass() Tizen::Graphics::Canvas * pCanvas = m_pList->GetCanvasN(); if (pCanvas) { - pCanvas->FillRectangle(consts::green, Rectangle(2,headerItemHeight + 2, 100,100)); + pCanvas->FillRectangle(consts::green, Rectangle(2, headerItemHeight + 2, 100, 100)); Bitmap const * pBTM_Back = GetBitmap(IDB_PLACE_PAGE_COMPASS_BACKGROUND); - int imgBackHeighDiv2 = pBTM_Back->GetHeight()/2; + int const imgBackHeighDiv2 = pBTM_Back->GetHeight() / 2; Bitmap const * pBTM = GetBitmap(IDB_PLACE_PAGE_COMPASS); - int imgHeighDiv2 = pBTM->GetHeight()/2; - int centerX = btwWdth + imgHeighDiv2; - int centerY = headerItemHeight + btwWdth + imgHeighDiv2; - - - - pCanvas->DrawBitmap(Point(centerX - imgBackHeighDiv2, centerY - imgBackHeighDiv2), *pBTM_Back); - double dAzimut = GetAzimut(GetCurMark(), m_NorthAzimut); - pCanvas->DrawBitmap(Point(centerX, centerY), *pBTM, Point(imgHeighDiv2, imgHeighDiv2), (dAzimut/(2*M_PI))*360); + int const imgHeighDiv2 = pBTM->GetHeight() / 2; + int const centerX = btwWdth + imgHeighDiv2; + int const centerY = headerItemHeight + btwWdth + imgHeighDiv2; + pCanvas->DrawBitmap(Point(centerX - imgBackHeighDiv2, centerY - imgBackHeighDiv2), * pBTM_Back); + double const dAzimut = GetAzimuth(GetCurMark(), m_northAzimuth); + pCanvas->DrawBitmap(Point(centerX, centerY), *pBTM, Point(imgHeighDiv2, imgHeighDiv2), (dAzimut / (2 * math::pi)) * 360); delete pCanvas; } } void BookMarkSplitPanel::OnDataReceived(SensorType sensorType, SensorData & sensorData, result r) { MagneticSensorData & data = static_cast< MagneticSensorData& >(sensorData); - m_NorthAzimut = atan2(data.y, data.x) - math::pi; - double const pi2 = 2.0*math::pi; - if (m_NorthAzimut < 0.0) - m_NorthAzimut += pi2; - else if (m_NorthAzimut > pi2) - m_NorthAzimut -= pi2; + m_northAzimuth = atan2(data.y, data.x) - math::pi; + double const pi2 = 2.0 * math::pi; + if (m_northAzimuth < 0.0) + m_northAzimuth += pi2; + else if (m_northAzimuth > pi2) + m_northAzimuth -= pi2; UpdateCompass(); } diff --git a/tizen/MapsWithMe/src/BookMarkUtils.cpp b/tizen/MapsWithMe/src/BookMarkUtils.cpp index 4b334f7f27..37cf258b27 100644 --- a/tizen/MapsWithMe/src/BookMarkUtils.cpp +++ b/tizen/MapsWithMe/src/BookMarkUtils.cpp @@ -83,7 +83,7 @@ Tizen::Base::String GetDistance(UserMark const * pUserMark) return dist.c_str(); } -double GetAzimut(UserMark const * pUserMark, double north) +double GetAzimuth(UserMark const * pUserMark, double north) { if (!pUserMark) return 0; @@ -91,7 +91,7 @@ double GetAzimut(UserMark const * pUserMark, double north) GetFramework()->GetCurrentPosition(lat, lon); string dist; double azimut; - m2::PointD pt = pUserMark->GetOrg(); + m2::PointD const pt = pUserMark->GetOrg(); GetFramework()->GetDistanceAndAzimut(pt, lat, lon, north, dist, azimut); return azimut; } |