Add nautical miles (with feet for altitude).

Fixes #1280.
This commit is contained in:
Dennis Guse
2022-06-13 22:21:10 +02:00
parent 1c3a2bd2e4
commit a283464331
15 changed files with 142 additions and 39 deletions
@@ -93,6 +93,10 @@ public class Speed {
return toKMH() * UnitConversions.KM_TO_MI;
}
public double toKnots() {
return toKMH() * UnitConversions.KM_TO_NAUTICAL_MILE;
}
public Duration toPace(UnitSystem unitSystem) {
if (isZero()) {
return Duration.ofSeconds(0);
@@ -106,6 +110,9 @@ public class Speed {
case IMPERIAL:
distance *= UnitConversions.M_TO_MI;
break;
case NAUTICAL_IMPERIAL:
distance *= UnitConversions.M_TO_NAUTICAL_MILE;
break;
default:
throw new RuntimeException("Not implemented");
}
@@ -119,6 +126,8 @@ public class Speed {
return toKMH();
case IMPERIAL:
return toMPH();
case NAUTICAL_IMPERIAL:
return toKnots();
default:
throw new RuntimeException("Not implemented");
}