Java Mapsforge图像覆盖
如何将圆形覆盖改为图像 以下是我的代码MainActivity Extendes MapActivity用于圆覆盖的代码:Java Mapsforge图像覆盖,java,android,mapsforge,Java,Android,Mapsforge,如何将圆形覆盖改为图像 以下是我的代码MainActivity Extendes MapActivity用于圆覆盖的代码: ListOverlay listOverlay = new ListOverlay(); List<OverlayItem> overlayItems = listOverlay.getOverlayItems(); Cursor campgroundList = campgroundDB.getCampgrounds();
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);
}
ListOverlay ListOverlay=新建ListOverlay();
List overlayItems=listOverlay.getOverlayItems();
游标campgroundList=campgroundDB.getCampgrounds();
如果(campgroundList!=null){
while(campgroundList.moveToNext()){
地理点campgroundLocation=新的地理点(campgroundList.getDouble(campgroundList.getColumnIndex(“纬度”)),campgroundList.getDouble(campgroundList.getColumnIndex(“经度”);
//如果(应显示营地(营地位置)){
圆圈=展示营地(营地位置);
//overlayItems.setMarker(defaultMarker);
叠加项。添加(圆圈);
//}
}
}
mapView.getOverlays().add(listOverlay);
私人静态圆形展示营地(地质点位置){
油漆油漆填充=新油漆(油漆.防油漆别名标志);
paintFill.setStyle(Paint.Style.FILL);
paintFill.setColor(颜色为洋红色);
paintFill.setAlpha(64);
油漆油漆笔划=新油漆(油漆.防油漆别名标志);
paintStroke.setStyle(Paint.Style.STROKE);
画笔。设置颜色(颜色。洋红色);
画笔。setAlpha(128);
油漆冲程。设置冲程宽度(3);
返回新圆(位置,200,油漆填充,油漆笔划);
}