Android的GoogleMap的V2:怎样绘制具有特定长度的线? [英] Android GoogleMap V2 : How can I draw a line with specific length?

查看:315
本文介绍了Android的GoogleMap的V2:怎样绘制具有特定长度的线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中的GoogleMap的。它在缩放级别18集我想画一条线,1米长。我看到并使用code这样的:

I have a GoogleMap in my project. It's set in zoom level 18. I want to draw a line that is 1 meter in length. I saw and use a code Like this:

googleMap.addCircle(new CircleOptions()
     .center(latLng1)
     .radius(5)
     .fillColor(Color.BLUE));     

我给它的半径米。 ?我怎么能做到这一点用一根线(折线没有这个选项),具体经纬度和具体方向(例如:从北标题)线和具体的长度是多少? 我可以通过正弦和余弦指定方向..但我能做些什么的线长?

I gave it's radius in meters. how can I do it with a line?(polyLine doesn't have this options) a line with specific LatLng and specific direction(for example: Heading from north) and specific length? I can specify direction by sin and cos.. but what can I do for length of the line?

推荐答案

对于给定的点,只有一个给定半径的圆。但随着线路的情况有点不同。对于给定的点也有从这个点和给定长度开始行数限制。因此,你不能简单的得出这样的行。

For given point there is only one circle with given radius. But with lines the situation is a bit different. For given point there are infinite number of lines starting from this points and given length. Therefore you can't simple draw such line.

要做到这一点的方法之一是挑对半径1米圆点和中心你的观点。 <一href="http://stackoverflow.com/questions/839899/how-do-i-calculate-a-point-on-a-circle-s-circumference">Here就是一个很好的例子,如何来计算给定半径的圆点。比只画在两个点之间的线。

One way to do it is to pick a point on the circle with radius 1 meter and center your point. Here is a good example how to calculate point on a circle with given radius. Than just draw a line between the two points.

更新:

这可能会帮助你如何找到在圆<一的经纬度点href="http://stackoverflow.com/questions/18650907/latlng-points-on-circle-on-goggle-map-v2-in-android">LatLng点在机器人圆圈面罩地图V2

This may help you how to find the LatLng points on the circle LatLng Points on circle on Goggle Map V2 in android

这篇关于Android的GoogleMap的V2:怎样绘制具有特定长度的线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆