Java 雷达标度坐标

Java 雷达标度坐标,java,android,math,gps,location,Java,Android,Math,Gps,Location,我目前正在为android开发雷达。(在本教程之后:) 我从服务器获取当前位置周围5KM范围内的所有用户,然后我在customview中绘制如下: float xU = (float)(userLocation.getLongitude() + getWidth() / 2 - currentLong); float yU = (float)(getHeight() / 2 - userLocation.getLatitude() + currentLat); canvas.drawBitmap

我目前正在为android开发雷达。(在本教程之后:)

我从服务器获取当前位置周围5KM范围内的所有用户,然后我在customview中绘制如下:

float xU = (float)(userLocation.getLongitude() + getWidth() / 2 - currentLong);
float yU = (float)(getHeight() / 2 - userLocation.getLatitude() + currentLat);
canvas.drawBitmap(bmpUser,xU,yU,radarPaint);

现在我的问题是,我需要缩放我在雷达上绘制的点/坐标,因为距离5公里以下的所有用户都将被绘制为距离中心仅2-3像素。我如何做到这一点?

这是一种方法。您所需要做的就是将“scale”变量的值设置为所需的值

float scale = 3.0f; //set this to any number to change the drawing scale

float xU = (float)(getWidth() / 2 + (userLocation.getLongitude() - currentLong) * scale);
float yU = (float)(getHeight() / 2 - (userLocation.getLatitude() - currentLat) * scale);
canvas.drawBitmap(bmpUser,xU,yU,radarPaint);

很好,这实际上解决了每个点都靠近中心的问题,但是我如何增加我画的坐标之间的距离?你如何画坐标?你也可以分享这段代码吗?我只使用canvas.drawBitmap并在X/Y坐标上绘制bmp。我仍然需要源代码,因为我可以想象许多绘制坐标的方法,就像你描述的那样。除了在自定义视图中的OP中绘制坐标外,我不做任何事情