diff options
author | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2015-02-27 20:31:21 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:46:03 +0300 |
commit | c5a45d38c2060c1b8722a387031bef03cabdc9e6 (patch) | |
tree | cfbcac93439a272583e96657c5d17caaae8c97b5 /platform/measurement_utils.hpp | |
parent | b6db1697139223354c36524605eb13cbdc2f9f15 (diff) |
Developing infrastucture for launching integration tests and unit tests for Android. Porting integration tests and indexer tests on Android platform.
Diffstat (limited to 'platform/measurement_utils.hpp')
-rw-r--r-- | platform/measurement_utils.hpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/platform/measurement_utils.hpp b/platform/measurement_utils.hpp new file mode 100644 index 0000000000..8d2961dba7 --- /dev/null +++ b/platform/measurement_utils.hpp @@ -0,0 +1,43 @@ +#pragma once + +#include "geometry/point2d.hpp" + +#include "std/string.hpp" + +namespace MeasurementUtils +{ + +inline double MetersToMiles(double m) { return m * 0.000621371192; } +inline double MilesToMeters(double mi) { return mi * 1609.344; } +inline double MetersToYards(double m) { return m * 1.0936133; } +inline double YardsToMeters(double yd) { return yd * 0.9144; } +inline double MetersToFeet(double m) { return m * 3.2808399; } +inline double FeetToMeters(double ft) { return ft * 0.3048; } +inline double FeetToMiles(double ft) { return ft * 5280; } +inline double YardToMiles(double yd) { return yd * 1760; } + +/// Takes into an account user settings [metric, imperial] +/// @param[in] m meters +/// @param[out] res formatted string for search +/// @return should be direction arrow drawed? false if distance is to small (< 1.0) +bool FormatDistance(double m, string & res); + +/// We always use meters and feet/yards for altitude +string FormatAltitude(double altitudeInMeters); +/// km/h or mph +string FormatSpeed(double metersPerSecond); + +/// @param[in] dac Digits after comma in seconds. +/// Use dac == 3 for our common conversions to DMS. +string FormatLatLonAsDMS(double lat, double lon, int dac = 3); +void FormatLatLonAsDMS(double lat, double lon, string & latText, string & lonText, int dac = 3); +string FormatMercatorAsDMS(m2::PointD const & mercator, int dac = 3); +void FormatMercatorAsDMS(m2::PointD const & mercator, string & lat, string & lon, int dac = 3); + +/// Default dac == 6 for the simple decimal formatting. +string FormatLatLon(double lat, double lon, int dac = 6); +void FormatLatLon(double lat, double lon, string & latText, string & lonText, int dac = 6); +string FormatMercator(m2::PointD const & mercator, int dac = 6); +void FormatMercator(m2::PointD const & mercator, string & lat, string & lon, int dac = 6); + +} |