iOS 版 AR:在屏幕上显示位置(纬度、经度)
我想制作一个应用程序来显示屏幕上的位置。
我将在相机图像上显示一条文本,指示用户是否正在查看它。例如,如果用户正在寻找位于其位置北部的城镇,则当他向北看时,将会看到指示该城镇的文本。
我还想显示用户和位置之间的距离。
知道用户位置后,我必须向其表明用户正在寻找另一个位置。例如,我在纽约,我想知道自由女神像在哪里。我必须知道它的纬度和经度才能在用户查看时将其显示在屏幕上。
有没有什么SDK可以实现?
您需要更多详细信息吗?抱歉,我英语说得不太好。
I want to make an app that shows where is a location on screen.
I'm going to show over camera image a text indicating if user is looking to it. For example, if user is looking for a town that is in north of his location it will see a text indicating it when he looks to the north.
I also want to show distance between user and location.
Knowing user location, I have to show it user is looking to another location. For example, I'm in New York and I want to know where is Statue of Liberty. I have to know its latitude and longitude to show it on screen when user looks at.
Is there any SDK to do it?
Do you need more details? I'm sorry, but I don't speak English very well.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
步骤应该是:
获取纬度和经度并将它们设置为两个标签,self.label1 和 self.label2
创建一个具有透明颜色背景的空视图。
使用 addSubview: 将标签添加到步骤 2 中的视图。
将cameraOverlayView 设置为步骤 2 中创建的视图。
显示您的选择器。
在代码中:
在 .h 中定义:
CLLocationManager *locationManager
并实现委托:然后实现:
然后在您想要向相机展示坐标的任何位置:
希望它足够清楚,并且没有遗漏任何东西,因为我还没有对此进行测试。
Steps should be:
Get lat and long and set them to two labels, self.label1 and self.label2
Create an empty view with transparentColor background.
Add your labels with addSubview: to the view in step 2.
Set cameraOverlayView to the view created in step 2.
Present your picker.
In code:
Define in your .h:
CLLocationManager *locationManager
and implement delegate:<CLLocationManagerDelegate>
Then implement:
Then wherever you want to present your camera with coords:
Hope its clear enough and that there isn't anything missing as i have not tested this.
另一个解决方案是在 opnengl 中构建一个世界,并将您的兴趣点放入您的 OpenGL 世界中,将它们的纬度/经度值转换为您的 OpenGL 坐标。
第一个选项更容易,我认为第二个选项更灵活。
The other solution would be to build up a world in opnengl and place your points-of-interest into your OpenGL world, transforming their lat/lon values to your OpenGL coordinates.
The first one is much easier, I would think the second option is more flexible.