3

我有一个关于 Mapview 的问题。我有一张小区域的地图(例如:http: //goo.gl/tKQM6)。

我可以在地图视图中使用此图像吗?如果可能的话,我可以在上面使用叠加层和其他地图视图操作吗?我可以为不同的缩放级别添加不同的图像。

如果谷歌地图无法做到这一点,有没有其他方法可以做到这一点?

谢谢。

4

1 回答 1

1

I have successfully drawn a circule on map. I override the on draw method of ItemizedOverlay for this and perform some canvas and paint operations in it. Like that:

public class DepartureItemizdOverlay extends ItemizedOverlay { 
.......
......


public boolean draw(Canvas canvas, MapView mapView, boolean shadow,
long when) {  

    Paint paint;      
    paint = new Paint();
    paint.setColor(Color.BLUE);
    paint.setAntiAlias(true);
    float strockWidth = Departure.gpsAccuracy / ACCURACY_width_constant;
        if(strockWidth >= MAX_STROCK_WIDTH)
            strockWidth = MAX_STROCK_WIDTH;
    Projection projection = mapView.getProjection();
    Point point = new Point();
    projection.toPixels(mOverlays.get(GPS_DETECTED_GP_INDEX).getPoint(), point);
    float circleRadius = (float)         (projection.metersToEquatorPixels
    (Departure.MAX_DISTANCE_gps_dep) * (1/
    Math.cos(Math.toRadians(mOverlays.
    get(GPS_DETECTED_GP_INDEX).getPoint().
    getLatitudeE6()/1E6))));

    paint.setStyle(Style.FILL);
    paint.setAlpha(30);
    canvas.drawCircle(point.x, point.y, circleRadius, paint);

    paint.setStyle(Style.STROKE);
    paint.setStrokeWidth(MAX_STROCK_WIDTH);
        paint.setAlpha(100);
    canvas.drawCircle(point.x, point.y, circleRadius, paint);


    mapView.postInvalidate();


    return super.draw(canvas, mapView, shadow, when);  
}

.....

}
于 2012-06-01T07:50:34.770 回答