【发布时间】:2016-03-21 05:20:55
【问题描述】:
嘿,我正在使用信标实现室内定位。我完成了室内地图并使用信标定位用户位置。 我被困在用户想要搜索从当前位置到目的地的路径的地方。目前我设法通过提供整个路径的点来实现它,但在大面积的情况下这不会有效。 例如。用户在房间 A,他想搜索房间 Z 的路径。目前我正在使用保存整个路径的坐标。但如果有的话,我正在寻找更好的解决方案。
我没有使用 MapKit 我只是使用滚动视图和 pdf 导入。
这就是我显示路径的方式。 注意:路径坐标存储在 JSON 文件中,目前我是手动放置的。
UIBezierPath *path = [UIBezierPath bezierPath];
[path moveToPoint:CGPointMake(394.0, 290.0)];
[path addLineToPoint:CGPointMake(100.0, 290.0)];
[path addLineToPoint:CGPointMake(50.0, 250.0)];
CAShapeLayer *pathLayer = [CAShapeLayer layer];
pathLayer.frame = self.view.bounds;
pathLayer.path = path.CGPath;
pathLayer.strokeColor = [[UIColor redColor] CGColor];
pathLayer.fillColor = nil;
pathLayer.lineWidth = 2.0f;
pathLayer.lineJoin = kCALineJoinBevel;
[self.view.layer addSublayer:pathLayer];
CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
pathAnimation.duration = 2.0;
pathAnimation.fromValue = [NSNumber numberWithFloat:0.0f];
pathAnimation.toValue = [NSNumber numberWithFloat:1.0f];
[pathLayer addAnimation:pathAnimation forKey:@"strokeEnd"];
提前致谢。
【问题讨论】:
标签: ios iphone navigation ibeacon indoor-positioning-system