首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法使用iOS估计内部SDK手动创建位置

问无法使用iOS估计内部SDK手动创建位置
EN

Stack Overflow用户
提问于 2015-05-21 09:22:14
回答 1查看 968关注 0票数 3

无法手动创建正确的位置-它总是显示错误的位置。有人能告诉我如何正确地做这件事并指出我的代码中有错误的值吗?谢谢。

​

​

代码语言:javascript
复制
    ESTLocationBuilder *locationBuilder = [ESTLocationBuilder new];

    [locationBuilder setLocationBoundaryPoints:@[
                                                 [ESTPoint pointWithX:0 y:0],
                                                 [ESTPoint pointWithX:0 y:7.46],
                                                 [ESTPoint pointWithX:7.6 y:7.46],
                                                 [ESTPoint pointWithX:7.6 y:0]
                                                 ]];

    [locationBuilder setLocationOrientation:275];

    [locationBuilder addBeaconIdentifiedByMac:kBeaconMac1
                       atBoundarySegmentIndex:0
                                   inDistance:0
                                     fromSide:ESTLocationBuilderLeftSide];

    [locationBuilder addBeaconIdentifiedByMac:kBeaconMac2
                       atBoundarySegmentIndex:1
                                   inDistance:0
                                     fromSide:ESTLocationBuilderLeftSide];

    [locationBuilder addBeaconIdentifiedByMac:kBeaconMac3
                       atBoundarySegmentIndex:2
                                   inDistance:0
                                     fromSide:ESTLocationBuilderRightSide];

    [locationBuilder addBeaconIdentifiedByMac:kBeaconMac4
                       atBoundarySegmentIndex:3
                                   inDistance:0
                                     fromSide:ESTLocationBuilderRightSide];

    self.location = [locationBuilder build];
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-05-21 17:58:23

你设置地点和方向的方式看起来很好。

唯一需要改变的是:

代码语言:javascript
复制
[locationBuilder addBeaconIdentifiedByMac:kBeaconMac1
                       atBoundarySegmentIndex:0
                                   inDistance:0
                                     fromSide:ESTLocationBuilderLeftSide];

该代码如下:

我有一个kBeaconMac1地址的信标放在第一堵墙(atBoundarySegmentIndex:0)上,距离墙左侧0米(inDistance:0) (fromSide:ESTLocationBuilderLeftSide)。

“左”或“右”被理解为“我在房间的中间,直面墙壁;左边是我的左边,右边是我的右边”。

“第一道墙”被理解为你在setLocationBoundaryPoints中定义的前两点之间的墙。“第二墙”在第二和第三点之间,“第三墙”在第三和第四点之间,最后的“第四墙”-the第四和第一。

查看图片,您实际上在墙的中间有您的信标,因此您希望将inDistance参数设置为theWidthOfTheWall / 2,即在“第一堵墙”7.46 / 2 = 3.73的情况下。在这种特殊情况下,“左”或“右”并不重要。

下面是与图片匹配的代码:

代码语言:javascript
复制
[locationBuilder addBeaconIdentifiedByMac:kBeaconMac1
                   atBoundarySegmentIndex:0
                               inDistance:3.73
                                 fromSide:ESTLocationBuilderLeftSide];

[locationBuilder addBeaconIdentifiedByMac:kBeaconMac2
                   atBoundarySegmentIndex:1
                               inDistance:3.8
                                 fromSide:ESTLocationBuilderLeftSide];

[locationBuilder addBeaconIdentifiedByMac:kBeaconMac3
                   atBoundarySegmentIndex:2
                               inDistance:3.73
                                 fromSide:ESTLocationBuilderRightSide];

[locationBuilder addBeaconIdentifiedByMac:kBeaconMac4
                   atBoundarySegmentIndex:3
                               inDistance:3.8
                                 fromSide:ESTLocationBuilderRightSide];
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30369615

复制
相关文章

相似问题

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