diff options
author | Philipp Prangenberg <philipp.prangenberg@derkurier.de> | 2016-12-05 12:03:08 +0100 |
---|---|---|
committer | Philipp Prangenberg <philipp.prangenberg@derkurier.de> | 2016-12-05 12:03:08 +0100 |
commit | a21f436a58133f7da0cae06366d729665f3b8f9c (patch) | |
tree | 72ff1743d96f79e4a9d85b0d48715e5f9aa67cf9 /src/org/traccar/helper/UnitsConverter.java | |
parent | 960bf899414d89221e92138fdb98777c3f4f73ec (diff) | |
parent | 40607036c5aa6385a7ae3f3a283bf107238a5944 (diff) | |
download | trackermap-server-a21f436a58133f7da0cae06366d729665f3b8f9c.tar.gz trackermap-server-a21f436a58133f7da0cae06366d729665f3b8f9c.tar.bz2 trackermap-server-a21f436a58133f7da0cae06366d729665f3b8f9c.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/org/traccar/helper/UnitsConverter.java')
-rw-r--r-- | src/org/traccar/helper/UnitsConverter.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/org/traccar/helper/UnitsConverter.java b/src/org/traccar/helper/UnitsConverter.java index 4bc7348db..e0d94c6dc 100644 --- a/src/org/traccar/helper/UnitsConverter.java +++ b/src/org/traccar/helper/UnitsConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2015 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ public final class UnitsConverter { private static final double KNOTS_TO_MPH_RATIO = 0.868976; private static final double KNOTS_TO_MPS_RATIO = 1.94384; private static final double KNOTS_TO_CPS_RATIO = 0.0194384449; + private static final double METERS_TO_FEET_RATIO = 0.3048; private UnitsConverter() { } @@ -45,8 +46,20 @@ public final class UnitsConverter { return value * KNOTS_TO_MPS_RATIO; } + public static double mpsFromKnots(double value) { + return value / KNOTS_TO_MPS_RATIO; + } + public static double knotsFromCps(double value) { // cm/s return value * KNOTS_TO_CPS_RATIO; } + public static double feetFromMeters(double value) { + return value / METERS_TO_FEET_RATIO; + } + + public static double metersFromFeet(double value) { + return value * METERS_TO_FEET_RATIO; + } + } |