当前位置: 首页>>代码示例>>Java>>正文


Java MapController.setZoom方法代码示例

本文整理汇总了Java中org.osmdroid.views.MapController.setZoom方法的典型用法代码示例。如果您正苦于以下问题:Java MapController.setZoom方法的具体用法?Java MapController.setZoom怎么用?Java MapController.setZoom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.osmdroid.views.MapController的用法示例。


在下文中一共展示了MapController.setZoom方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: openStreetMapInit

import org.osmdroid.views.MapController; //导入方法依赖的package包/类
private void openStreetMapInit() {
    setContentView(R.layout.activity_openstreetmapgpsmanager);
    mMapView = (MapView) findViewById(R.id.OSMGPSmanager);
    MapController mController = mMapView.getController();

    mMapView.setTileSource(TileSourceFactory.MAPNIK);
    mMapView.setBuiltInZoomControls(true);
    mMapView.setMultiTouchControls(true);

    imageUri = (Uri) getIntent().getExtras().get("imageUri");
    try {
        String degreeGPS = new ConvertLatlng().convertToDegreeForm(imageUri.getPath());
        String[] position = degreeGPS.split(";");
        GeoPoint center = new GeoPoint(Double.parseDouble(position[0]), Double.parseDouble(position[1]));
        mController.setCenter(center);
        mController.setZoom(13);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:phimpme,项目名称:phimpme-android-v1,代码行数:21,代码来源:GeographicalLocationActivity.java

示例2: setupMapView

import org.osmdroid.views.MapController; //导入方法依赖的package包/类
private void setupMapView() {
    mMapView.setMultiTouchControls(true);
    mMapView.setUseDataConnection(true);
    mMapView.setTileSource(TileSourceFactory.MAPQUESTOSM);

    mMapController = (MapController) mMapView.getController();
    mMapController.setZoom(13);
    mMapController.setCenter(BERLIN);

    fetchPois();
}
 
开发者ID:refugeehackathon,项目名称:refugeetransit-android,代码行数:12,代码来源:MapFragment.java

示例3: init_mapView

import org.osmdroid.views.MapController; //导入方法依赖的package包/类
private void init_mapView() {
    mMapView = (MapView) findViewById(R.id.myOSMmapview);
    MapController mController = mMapView.getController();

    mMapView.setTileSource(TileSourceFactory.MAPNIK);
    mMapView.setBuiltInZoomControls(true);
    mMapView.setMultiTouchControls(true);

    LatLng latLng = getCurrentLocation();
    GeoPoint center = new GeoPoint(latLng.latitude, latLng.longitude);
    mController.setCenter(center);
    mController.setZoom(13);
}
 
开发者ID:phimpme,项目名称:phimpme-android-v1,代码行数:14,代码来源:OpenStreetMapActivity.java

示例4: onCreate

import org.osmdroid.views.MapController; //导入方法依赖的package包/类
/**
 * Init method for instanciate all variables
 * @param savedInstanceState
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_2);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    if (toolbar != null) {
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }

    //region initVars
    double dLat = getIntent().getDoubleExtra("xtra_destination_lat", 0);
    double dLong = getIntent().getDoubleExtra("xtra_destination_long",0);
    busDeparture = (Departure)getIntent().getSerializableExtra("xtra_bus_depart") ;
    distGoal = (TextView) findViewById(R.id.tV_distance_goal);
    timeLeft = (TextView) findViewById(R.id.tV_time_left);
    timeToBus = (TextView) findViewById(R.id.tV_time_left_to_bus);
    destinationLocation = new GeoPoint(dLat, dLong);
    //endregion

    //region GPS Location init
    if (!MainActivity.demomode) {
        // get GPS manager -> GPS longitude, latitude in onLocationChanged
        locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        String locationProvider = LocationManager.GPS_PROVIDER;


        try {
            locationManager.requestLocationUpdates(locationProvider, 0, 0, Activity2.this);
        }
        catch(final SecurityException ex) {
            Toast.makeText(this, "Leider können wir ohne GPS keine Route berechnen", Toast.LENGTH_SHORT).show();
        }
    }

    else {
        android.os.Handler handler = new android.os.Handler();
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                Location location  = new Location("");
                location.setLatitude(48.4224);//your coords of course
                location.setLongitude(9.9579);

                onLocationChanged(location);
            }
        },1000);
    }
    //endregion

    //Map view init
    // MapView integration
    mMapView = (MapView) findViewById(R.id.mapview_calculated);
    mMapView.setTileSource(TileSourceFactory.DEFAULT_TILE_SOURCE);
    mMapView.setBuiltInZoomControls(true);
    mMapView.setMultiTouchControls(true);
    mMapController = (MapController) mMapView.getController();
    mMapController.setZoom(17);
    //endregion

    //road manager init
    roadManager = new MapQuestRoadManager("DIGIF2BiDrtD1Xbi28SXrkd9Ap2h73Vn");
    roadManager.addRequestOption("routeType=pedestrian");



}
 
开发者ID:flbbr,项目名称:Run2Stop,代码行数:72,代码来源:Activity2.java


注:本文中的org.osmdroid.views.MapController.setZoom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。