我正在使用Carto,我试图使用CLLocation真正的hedding旋转位置标记,但我无法使它工作。
我将位图图像设置为位置标记(即NTPoint对象),但NTPoint没有根据角度旋转的任何方法,而不是NTMarker,我尝试使用NTMarker作为位置标记,但在低缩放级别(缩放6)下,从未显示真实位置,因此NTPoint更适合。
因此,我希望任何人都能告诉我,如何使用CLLocation真正的hedding使用CARTO-SDK旋转位置标记。
问候
发布于 2017-10-17 18:56:50
以下代码应该工作,并将图像保持在精确的位置:
NTMarkerStyleBuilder *builder = [[NTMarkerStyleBuilder alloc]init];
// anchor 0,0 means that image is rotated from the center
// you may have different anchor point depending on graphics
[builder setAnchorPointX:0 anchorPointY:0];
self.positionMarker = [[NTMarker alloc] initWithPos:position style:[builder buildStyle]];
...
// rotate marker, depending on marker graphics
// "180-course" is ok if it is "arrow down"
// additional adjustment is for mapView rotation, image keeps
// here correct course even if map is rotated
double course = location.course;
[self.positionMarker setRotation: 180 - course - self.contentView.mapView.getRotation];https://stackoverflow.com/questions/46757053
复制相似问题