如何缩放 openstreet 地图?我下面的代码只有一个 mapview.builinzoom 控件(TRUE)
我如何像在 googlemapview 中一样提供我的缩放级别有一个类似的功能
MapController mc = mapView.getController();
mc.setZoom(15);
那么如何在 openstreet 地图中添加这种类型的函数,以便在启动应用程序时它已经缩放并显示正确的结果?
import org.osmdroid.DefaultResourceProxyImpl;
import org.osmdroid.ResourceProxy;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.MapView;
import com.google.android.maps.MapController;
import android.os.Bundle;
import android.app.Activity;
import android.graphics.drawable.Drawable;
public class MainActivity extends Activity {
MyItemizedOverlay myItemizedOverlay = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MapView mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
Drawable marker=getResources().getDrawable(android.R.drawable.star_big_on);
int markerWidth = marker.getIntrinsicWidth();
int markerHeight = marker.getIntrinsicHeight();
marker.setBounds(0, markerHeight, markerWidth, 0);
ResourceProxy resourceProxy = new
DefaultResourceProxyImpl(getApplicationContext());
myItemizedOverlay = new MyItemizedOverlay(marker, resourceProxy);
mapView.getOverlays().add(myItemizedOverlay);
GeoPoint myPoint1 = new GeoPoint(24.893379000000000000, 67.028060900000010000);
myItemizedOverlay.addItem(myPoint1, "myPoint1", "myPoint1");
GeoPoint myPoint2 = new GeoPoint(24.824796300000000000, 67.031565699999990000);
myItemizedOverlay.addItem(myPoint2, "myPoint2", "myPoint2");
}
}