首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用carto-mobile( CARTO)在ios中旋转位置标记

如何使用carto-mobile( CARTO)在ios中旋转位置标记
EN

Stack Overflow用户
提问于 2017-10-15 16:03:46
回答 1查看 298关注 0票数 0

我正在使用Carto,我试图使用CLLocation真正的hedding旋转位置标记,但我无法使它工作。

我将位图图像设置为位置标记(即NTPoint对象),但NTPoint没有根据角度旋转的任何方法,而不是NTMarker,我尝试使用NTMarker作为位置标记,但在低缩放级别(缩放6)下,从未显示真实位置,因此NTPoint更适合。

因此,我希望任何人都能告诉我,如何使用CLLocation真正的hedding使用CARTO-SDK旋转位置标记。

问候

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-10-17 18:56:50

以下代码应该工作,并将图像保持在精确的位置:

代码语言:javascript
复制
    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];
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46757053

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档