gpt4 book ai didi

ios - 这里 map iOS distanceToDestination

转载 作者:行者123 更新时间:2023-12-01 16:09:01 26 4
gpt4 key购买 nike

我想知道是否有人可以帮助我在Heremap iOS SDK中获得总路线距离。根据文档,应该执行以下操作,但我只会获得无穷大的边界值,这简直就是邪恶。有人可以提供一个有效的例子吗?我正在模拟器中运行它,但这并不重要。

unsigned long long distance_ul = [NMANavigationManager sharedNavigationManager].distanceToDestination;

NMAUint64 distance_i64 = [NMANavigationManager sharedNavigationManager].distanceToDestination;

最佳答案

您的第二个用法NMAUint64 distance = [NMANavigationManager sharedNavigationManager].distanceToDestination;可以。然后,您应该自己计算距离。以下是公制的示例

- (NSString *)distanceToMetricStringFromLongValue:(NMAUint64)value {
NSString *distanceText = @"";
if (value < 250) {
NMAUint64 distance = (NMAUint64)round(value / 5.0) * 5;
if (showZeroDistance || distance > 0) {
distanceText = [NSString stringWithFormat:@"%lld m", distance];
}
} else if (value < 500) {
NMAUint64 distance = (NMAUint64)round(value / 10.0) * 10;
if (showZeroDistance || distance > 0) {
distanceText = [NSString stringWithFormat:@"%lld m", distance];
}
} else if (value < 1000) {
NMAUint64 distance = (NMAUint64)round(value / 50.0) * 50;
distanceText = [NSString stringWithFormat:@"%lld m", distance];
} else {
double distance = value / 1000.0;
if (distance >= 10.0) {
distanceText = [NSString stringWithFormat:@"%0.0f km", round(distance)];
} else {
distanceText = [NSString stringWithFormat:@"%0.1f km", distance];
}
}
}

关于ios - 这里 map iOS distanceToDestination,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39151812/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com