【发布时间】:2011-02-18 09:28:36
【问题描述】:
我已经设置了n 点,我想使用这些点绘制一个n-sided 多边形。
我尝试使用 android.graphics.path(请参见下文)。
Path path = new Path();
Vertex currVtx;
for (int j = 0; j < vertices.size(); j++) {
currVtx = vertices.get(j);
if (!currVtx.hasLatLong())
continue;
Point currentScreenPoint = getScreenPointFromGeoPoint(
currVtx, mapview);
if (j == 0)
path.moveTo(currentScreenPoint.x, currentScreenPoint.y);
// vertex.
else
path.lineTo(currentScreenPoint.x, currentScreenPoint.y);
}
目前,我正在使用此代码获得一个实心(填充画布颜色)多边形。有没有办法可以得到一个未填充的多边形。 android.graphics.Path有一个替代方法
谢谢。
【问题讨论】:
-
嗨!你能解释一下你是如何实现 getScreenPointFromGeoPoint 的吗?我正在尝试绘制一个填充的多边形,但我不知道如何从我拥有的纬度和经度中获取屏幕点。如果你能分享我会很高兴
标签: android graphics path polygon android-sdk-2.1