diff options
author | Alex Zolotarev <alex@maps.me> | 2016-03-15 20:39:41 +0300 |
---|---|---|
committer | Sergey Yershov <yershov@corp.mail.ru> | 2016-03-23 16:57:05 +0300 |
commit | ba208ffb6cc5e9ab60310e22b4487c58635b39e8 (patch) | |
tree | 3cca4a06ae72af58748670b16152e5e084b89840 /platform/measurement_utils.hpp | |
parent | 226b50494a06297c205fb979a83a9fcfbfab8f61 (diff) |
MeasurementUtils::OSMDistanceToMeters validation.
Diffstat (limited to 'platform/measurement_utils.hpp')
-rw-r--r-- | platform/measurement_utils.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/platform/measurement_utils.hpp b/platform/measurement_utils.hpp index 0fe8c4c257..1da8145ec7 100644 --- a/platform/measurement_utils.hpp +++ b/platform/measurement_utils.hpp @@ -12,6 +12,8 @@ inline double MilesToMeters(double mi) { return mi * 1609.344; } 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 InchesToMeters(double in) { return in / 39.370; } +inline double NauticalMilesToMeters(double nmi) { return nmi * 1852; } /// Takes into an account user settings [metric, imperial] /// @param[in] m meters @@ -37,4 +39,13 @@ void FormatLatLon(double lat, double lon, string & latText, string & lonText, in string FormatMercator(m2::PointD const & mercator, int dac = 6); void FormatMercator(m2::PointD const & mercator, string & lat, string & lon, int dac = 6); +/// Converts OSM distance (height, ele etc.) to meters. +/// @returns false if fails. +bool OSMDistanceToMeters(string const & osmRawValue, double & outMeters); +/// Converts OSM distance (height, ele etc.) to meters string. +/// @returns empty string on failure. +string OSMDistanceToMetersString(string const & osmRawValue, + bool supportZeroAndNegativeValues = true, + int digitsAfterComma = 2); + } |