相关疑难解决方法(0)

Google Maps API v2在MapFragment上绘制部分圆圈

我需要绘制这样的东西,这些东西将被涂上并且几乎没有透明度

它也需要是可点击的(onTouch事件等)

在此输入图像描述

我知道在API v1中你必须使用Overlay并使用canvas和一些数学来扩展它.在Google Map API v2中最简单的方法是什么?

PS:半径是可变的.

(供进一步参考)编辑1:

我实现了CanvasTileProvider子类并覆盖它的onDraw()方法:

@Override
void onDraw(Canvas canvas, TileProjection projection) {
    // TODO Auto-generated method stub

    LatLng tempLocation = moveByDistance(mSegmentLocation, mSegmentRadius, mSegmentAngle);

    DoublePoint segmentLocationPoint = new DoublePoint(0, 0);
    DoublePoint tempLocationPoint = new DoublePoint(0, 0);

    projection.latLngToPoint(mSegmentLocation, segmentLocationPoint);
    projection.latLngToPoint(tempLocationPoint, tempLocationPoint);

    float radiusInPoints = FloatMath.sqrt((float) (Math.pow(
            (segmentLocationPoint.x - tempLocationPoint.x), 2) + Math.pow(
            (segmentLocationPoint.y - tempLocationPoint.y), 2)));

    RectF segmentArea = new RectF();
    segmentArea.set((float)segmentLocationPoint.x - radiusInPoints, (float)segmentLocationPoint.y - radiusInPoints, 
            (float)segmentLocationPoint.x + radiusInPoints, (float)segmentLocationPoint.y + radiusInPoints);

    canvas.drawArc(segmentArea, getAdjustedAngle(mSegmentAngle), 
            getAdjustedAngle(mSegmentAngle + …
Run Code Online (Sandbox Code Playgroud)

android google-maps-android-api-2

6
推荐指数
1
解决办法
6368
查看次数

标签 统计

android ×1

google-maps-android-api-2 ×1