MapView에 원 (즉, 반지름)을 그려야합니다. 나는 이런 식으로 작업을 수행합니다 MapActivity에서MapView에서 원 (반지름)으로 오버레이 그리기
public class RadiusOverlay extends Overlay {
private Context context;
private double latitude;
private double longitude;
private float radius;
public RadiusOverlay(Context context, double latitude, double longitude, float radius){
/*.....................*/
}
public void draw(Canvas canvas, MapView mapView, boolean shadow){
super.draw(canvas, mapView, shadow);
Point point = new Point();
GeoPoint geoPoint = new GeoPoint((int) (latitude *1e6), (int)(longitude * 1e6));
Projection projection = mapView.getProjection();
projection.toPixels(geoPoint, point);
radius = projection.metersToEquatorPixels(radius);
Paint paint = new Paint();
paint.setStyle(Paint.Style.FILL);
paint.setARGB(100, 100, 100, 100);
canvas.drawCircle((float)point.x, (float)point.y, radius, paint);
}
}
:
오버레이가 원을 그릴
List<Overlay> mapOverlays = mapView.getOverlays();
RadiusOverlay radiusOverlay = new RadiusOverlay(this, latitude, longitude, radius);
mapOverlays.add(radiusOverlay);
MapActivity를 시작할 때 내가 원을보고, 그것이 내가 의도 한 크기의, 그러나 화면의 크기로 커지고 사라집니다. 이 문제를 어떻게 해결할 수 있습니까? 도움을 주셔서 감사합니다.
을 시작할 때 자라고? 확대/축소 수준을 변경하거나지도를 이동할 수 있습니까? – Olegas