diff options
author | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2019-05-27 15:06:53 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2019-05-30 18:53:51 +0300 |
commit | b0868d6d3f371a2aff5db043b219906c95502a42 (patch) | |
tree | aeac2e18d7fdae208b0e2ee919afd19c356b6614 /coding | |
parent | c0fb90a4a8b1228144e564a1fd1734136201d549 (diff) |
[geometry] LatLon refactoring.
Diffstat (limited to 'coding')
-rw-r--r-- | coding/coding_tests/traffic_test.cpp | 12 | ||||
-rw-r--r-- | coding/serdes_json.hpp | 8 | ||||
-rw-r--r-- | coding/traffic.hpp | 16 |
3 files changed, 18 insertions, 18 deletions
diff --git a/coding/coding_tests/traffic_test.cpp b/coding/coding_tests/traffic_test.cpp index 2ba6b3e034..3727d72cec 100644 --- a/coding/coding_tests/traffic_test.cpp +++ b/coding/coding_tests/traffic_test.cpp @@ -21,8 +21,8 @@ double CalculateLength(vector<TrafficGPSEncoder::DataPoint> const & path) double res = 0; for (size_t i = 1; i < path.size(); ++i) { - auto p1 = MercatorBounds::FromLatLon(path[i - 1].m_latLon.lat, path[i - 1].m_latLon.lon); - auto p2 = MercatorBounds::FromLatLon(path[i].m_latLon.lat, path[i].m_latLon.lon); + auto p1 = MercatorBounds::FromLatLon(path[i - 1].m_latLon.m_lat, path[i - 1].m_latLon.m_lon); + auto p2 = MercatorBounds::FromLatLon(path[i].m_latLon.m_lat, path[i].m_latLon.m_lon); res += MercatorBounds::DistanceOnEarth(p1, p2); } return res; @@ -48,10 +48,10 @@ void Test(vector<TrafficGPSEncoder::DataPoint> & points) { TEST_EQUAL(points[i].m_timestamp, result[i].m_timestamp, (points[i].m_timestamp, result[i].m_timestamp)); - TEST(base::AlmostEqualAbsOrRel(points[i].m_latLon.lat, result[i].m_latLon.lat, kEps), - (points[i].m_latLon.lat, result[i].m_latLon.lat)); - TEST(base::AlmostEqualAbsOrRel(points[i].m_latLon.lon, result[i].m_latLon.lon, kEps), - (points[i].m_latLon.lon, result[i].m_latLon.lon)); + TEST(base::AlmostEqualAbsOrRel(points[i].m_latLon.m_lat, result[i].m_latLon.m_lat, kEps), + (points[i].m_latLon.m_lat, result[i].m_latLon.m_lat)); + TEST(base::AlmostEqualAbsOrRel(points[i].m_latLon.m_lon, result[i].m_latLon.m_lon, kEps), + (points[i].m_latLon.m_lon, result[i].m_latLon.m_lon)); } if (version == TrafficGPSEncoder::kLatestVersion) diff --git a/coding/serdes_json.hpp b/coding/serdes_json.hpp index 61ae2af589..46977fbf31 100644 --- a/coding/serdes_json.hpp +++ b/coding/serdes_json.hpp @@ -165,8 +165,8 @@ public: void operator()(ms::LatLon const & ll, char const * name = nullptr) { NewScopeWith(base::NewJSONObject(), name, [this, &ll] { - (*this)(ll.lat, "lat"); - (*this)(ll.lon, "lon"); + (*this)(ll.m_lat, "lat"); + (*this)(ll.m_lon, "lon"); }); } @@ -374,8 +374,8 @@ public: void operator()(ms::LatLon & ll, char const * name = nullptr) { json_t * outerContext = SaveContext(name); - (*this)(ll.lat, "lat"); - (*this)(ll.lon, "lon"); + (*this)(ll.m_lat, "lat"); + (*this)(ll.m_lon, "lon"); RestoreContext(outerContext); } diff --git a/coding/traffic.hpp b/coding/traffic.hpp index 363cc56e2f..d3581c6120 100644 --- a/coding/traffic.hpp +++ b/coding/traffic.hpp @@ -88,9 +88,9 @@ private: if (!points.empty()) { uint64_t const firstTimestamp = points[0].m_timestamp; - uint32_t const firstLat = DoubleToUint32(points[0].m_latLon.lat, ms::LatLon::kMinLat, + uint32_t const firstLat = DoubleToUint32(points[0].m_latLon.m_lat, ms::LatLon::kMinLat, ms::LatLon::kMaxLat, kCoordBits); - uint32_t const firstLon = DoubleToUint32(points[0].m_latLon.lon, ms::LatLon::kMinLon, + uint32_t const firstLon = DoubleToUint32(points[0].m_latLon.m_lon, ms::LatLon::kMinLon, ms::LatLon::kMaxLon, kCoordBits); WriteVarUint(writer, firstTimestamp); WriteVarUint(writer, firstLat); @@ -102,9 +102,9 @@ private: ASSERT_LESS_OR_EQUAL(points[i - 1].m_timestamp, points[i].m_timestamp, ()); uint64_t const deltaTimestamp = points[i].m_timestamp - points[i - 1].m_timestamp; - uint32_t deltaLat = DoubleToUint32(points[i].m_latLon.lat - points[i - 1].m_latLon.lat, + uint32_t deltaLat = DoubleToUint32(points[i].m_latLon.m_lat - points[i - 1].m_latLon.m_lat, kMinDeltaLat, kMaxDeltaLat, kCoordBits); - uint32_t deltaLon = DoubleToUint32(points[i].m_latLon.lon - points[i - 1].m_latLon.lon, + uint32_t deltaLon = DoubleToUint32(points[i].m_latLon.m_lon - points[i - 1].m_latLon.m_lon, kMinDeltaLon, kMaxDeltaLon, kCoordBits); WriteVarUint(writer, deltaTimestamp); @@ -125,9 +125,9 @@ private: if (!points.empty()) { uint64_t const firstTimestamp = points[0].m_timestamp; - uint32_t const firstLat = DoubleToUint32(points[0].m_latLon.lat, ms::LatLon::kMinLat, + uint32_t const firstLat = DoubleToUint32(points[0].m_latLon.m_lat, ms::LatLon::kMinLat, ms::LatLon::kMaxLat, kCoordBits); - uint32_t const firstLon = DoubleToUint32(points[0].m_latLon.lon, ms::LatLon::kMinLon, + uint32_t const firstLon = DoubleToUint32(points[0].m_latLon.m_lon, ms::LatLon::kMinLon, ms::LatLon::kMaxLon, kCoordBits); uint32_t const traffic = points[0].m_traffic; WriteVarUint(writer, firstTimestamp); @@ -141,9 +141,9 @@ private: ASSERT_LESS_OR_EQUAL(points[i - 1].m_timestamp, points[i].m_timestamp, ()); uint64_t const deltaTimestamp = points[i].m_timestamp - points[i - 1].m_timestamp; - uint32_t deltaLat = DoubleToUint32(points[i].m_latLon.lat - points[i - 1].m_latLon.lat, + uint32_t deltaLat = DoubleToUint32(points[i].m_latLon.m_lat - points[i - 1].m_latLon.m_lat, kMinDeltaLat, kMaxDeltaLat, kCoordBits); - uint32_t deltaLon = DoubleToUint32(points[i].m_latLon.lon - points[i - 1].m_latLon.lon, + uint32_t deltaLon = DoubleToUint32(points[i].m_latLon.m_lon - points[i - 1].m_latLon.m_lon, kMinDeltaLon, kMaxDeltaLon, kCoordBits); uint32_t const traffic = points[i - 1].m_traffic; |