Mapsforge图像叠加android

时间:2014-06-26 12:16:44

标签: java android mapsforge

如何将圆形叠加更改为图像?

这是我的代码MainActivity扩展了Circle Overlay的MapActivity代码:

ListOverlay listOverlay = new ListOverlay();
        List<OverlayItem> overlayItems = listOverlay.getOverlayItems();

        Cursor campgroundList = campgroundDB.getCampgrounds();
        if(campgroundList != null) {
            while(campgroundList.moveToNext()) {
                GeoPoint campgroundLocation = new  GeoPoint(campgroundList.getDouble(campgroundList.getColumnIndex("latitude")),campgroundList.getDouble(campgroundList.getColumnIndex("longitude")));
                //if(shouldShowCampground(campgroundLocation)) {
                    Circle circle = showCampground(campgroundLocation);
                    //overlayItems.setMarker(defaultMarker);
                    overlayItems.add(circle);
                //}
            }
        }
        mapView.getOverlays().add(listOverlay);

private static Circle showCampground(GeoPoint location) {
    Paint paintFill = new Paint(Paint.ANTI_ALIAS_FLAG);
    paintFill.setStyle(Paint.Style.FILL);
    paintFill.setColor(Color.MAGENTA);
    paintFill.setAlpha(64);

    Paint paintStroke = new Paint(Paint.ANTI_ALIAS_FLAG);
    paintStroke.setStyle(Paint.Style.STROKE);
    paintStroke.setColor(Color.MAGENTA);
    paintStroke.setAlpha(128);
    paintStroke.setStrokeWidth(3);

    return new Circle(location, 200, paintFill, paintStroke);
}

0 个答案:

没有答案