gpt4 book ai didi

ios - 这里映射 iOS SDK : Rotate the marker in Here maps

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

我正在使用 Here map 开发车辆跟踪应用程序。我想根据车辆的转向将 Here map 中的标记图标 (NMAMapMarker) 旋转到特定角度(类似于 Uber 应用程序)。之前我用过谷歌地图,谷歌地图中的标记提供了一个旋转属性,可以将标记旋转到特定的角度。 Here map 中是否有任何类似的属性可用?

这个有更新吗 Nokia Here maps Navigation marker orientation

谢谢

最佳答案

一般来说,不可能旋转 NMAMapMarker,在 HERE iOS Premium SDK 中,默认位置指示器 NMAPositionIndicator 具有属性 tracksCourse,它将使用设备可用的标题旋转指示器。

另一种方法是使用上面评论中提到的 NMAMapLocalModel

   ... 
NMAFloatMesh *mesh = [[NMAFloatMesh alloc] init];

float size = 5.0f;

float vertices[4 * 3] = {-size / 2, -size/2, 0.0f,
-size/2, size / 2, 0.0f,
size / 2, -size/2, 0.0f,
size/2, size/2, 0.0f,
};

[mesh setVertices:vertices withCount:4];

float textureCoordinates[4 * 2] = {0.0, 0.0,
0.0, 1.0,
1.0, 0.0,
1.0, 1.0};

[mesh setTextureCoordinates:textureCoordinates withCount:4];

short triangles[2 * 3] = {2, 1, 0,
1, 2, 3};

[mesh setTriangles:triangles withCount:2];

_customPosIndicator = [[NMAMapLocalModel alloc] initWithMesh:mesh];

NMAImage *image = [NMAImage imageWithUIImage:[UIImage imageNamed:@"256-256-pin2.png"]];

/*
// To load svg file as a custom position indicator, please use this code.
NSBundle* main = [NSBundle mainBundle];
NSString *resourcePath = [main pathForResource:@"tracker-1093167" ofType:@"svg"];

NSLog(@"resourcePath: %@", resourcePath);
NSData *resourceData = [NSData dataWithContentsOfFile:resourcePath];
NMAImage *image = [NMAImage imageWithData:resourceData];
*/

[_customPosIndicator setAutoscaled:true];
[_customPosIndicator setTexture:image];
[_customPosIndicator setCoordinates:[NMAGeoCoordinates alloc]];

self.mapView.positionIndicator.displayObject = _customPosIndicator;

self.mapView.positionIndicator.visible = true;

...

- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(nonnull CLHeading *)newHeading {
NSLog(@"%f", newHeading.magneticHeading);
if(_customPosIndicator != nil){
[_customPosIndicator setYaw:newHeading.magneticHeading];
}
}

关于ios - 这里映射 iOS SDK : Rotate the marker in Here maps,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58450003/

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