當前位置: 首頁>>代碼示例>>Java>>正文


Java MapStatusUpdateFactory類代碼示例

本文整理匯總了Java中com.baidu.mapapi.map.MapStatusUpdateFactory的典型用法代碼示例。如果您正苦於以下問題:Java MapStatusUpdateFactory類的具體用法?Java MapStatusUpdateFactory怎麽用?Java MapStatusUpdateFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MapStatusUpdateFactory類屬於com.baidu.mapapi.map包,在下文中一共展示了MapStatusUpdateFactory類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: locationReceiveAddress

import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入依賴的package包/類
/**
 * 定位接收到的地址
 **/
private void locationReceiveAddress() {
    if (receiveAddress == null) {
        return;
    }
    LatLng p = new LatLng(receiveAddress.getLatitude(), receiveAddress.getLongitude());
    MarkerOptions markerOptions = new MarkerOptions();
    /* 設置覆蓋物圖標 */
    markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_openmap_focuse_mark))
            .position(p)
            .visible(true);
    baiduMap.setOnMarkerClickListener(new BaiduMap.OnMarkerClickListener() {
        @Override
        public boolean onMarkerClick(Marker marker) {
            setSinglePoiDetail();
            return true;
        }
    });
    if (NetUtil.getInstance(SetFavoriteMapActivity.this).getCurrentNetType().equals(NetUtil.NetType.NETWORK_TYPE_NONE)) {
        // Snackbar.make(mAmosfPoiList,mAppConfig.getResources().getString(R.string.no_network), Snackbar.LENGTH_SHORT).show();
        return;
    }
    /* 添加覆蓋圖層 */
    baiduMap.addOverlay(markerOptions);
    baiduMap.setMapStatus(MapStatusUpdateFactory.newLatLngZoom(p, 17F));
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:29,代碼來源:SetFavoriteMapActivity.java

示例2: zoomToSpan

import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入依賴的package包/類
/**
 * 縮放地圖,使所有Overlay都在合適的視野內
 * <p>
 * 注: 該方法隻對Marker類型的overlay有效
 * </p>
 * 
 */
public void zoomToSpan() {
    if (mBaiduMap == null) {
        return;
    }
    if (mOverlayList.size() > 0) {
        LatLngBounds.Builder builder = new LatLngBounds.Builder();
        for (Overlay overlay : mOverlayList) {
            // polyline 中的點可能太多,隻按marker 縮放
            if (overlay instanceof Marker) {
                builder.include(((Marker) overlay).getPosition());
            }
        }
        mBaiduMap.setMapStatus(MapStatusUpdateFactory
                .newLatLngBounds(builder.build()));
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:24,代碼來源:OverlayManager.java

示例3: cancelBook

import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入依賴的package包/類
private void cancelBook() {
    countDownTimer.cancel();
    bike_layout.setVisibility(View.GONE);
    bike_info_layout.setVisibility(View.GONE);
    confirm_cancel_layout.setVisibility(View.GONE);
    prompt.setVisibility(View.GONE);
    bike_distance_layout.setVisibility(View.VISIBLE);
    bike_distance_layout.setVisibility(View.VISIBLE);
    book_bt.setVisibility(View.VISIBLE);
    if (routeOverlay != null)
        routeOverlay.removeFromMap();
    MapStatus.Builder builder = new MapStatus.Builder();
    //地圖縮放比設置為18
    builder.target(currentLL).zoom(18.0f);
    mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:17,代碼來源:MainActivity.java

示例4: initView

import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入依賴的package包/類
private void initView() {
    mapView = (MapView) findViewById(R.id.see_location_mapview);
    toolBarView = (ToolBarView) findViewById(R.id.see_location_toolbar);

    toolBarView.setBackButtonImage(R.mipmap.icon_back);
    toolBarView.setBackButtonVisible(true);
    toolBarView.setBackButtonOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });
    toolBarView.setTitleText("查看接單人位置");

    baiduMap = mapView.getMap();

    MapStatusUpdate update = MapStatusUpdateFactory.zoomTo(19f);
    baiduMap.setMapStatus(update);

    handler = new MyHandler(this);


}
 
開發者ID:838030195,項目名稱:DaiGo,代碼行數:24,代碼來源:SeeLocationActivity.java

示例5: handleMessage

import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入依賴的package包/類
@Override
public void handleMessage(Message msg) {
    final SeeLocationActivity activity = activityWeakReference.get();
    switch (msg.what) {
        case 0:
            final String response = (String) msg.obj;

            Scanner scanner = new Scanner(response);
            double latitude = Double.parseDouble(scanner.next());
            double longitude = Double.parseDouble(scanner.next());
            LatLng point = new LatLng(latitude, longitude);
            if (activity.centP == null) {
                activity.centP = point;
                activity.baiduMap.setMapStatus(MapStatusUpdateFactory.newLatLng(activity.centP));
            }
            activity.initHeadBitmap();
            OverlayOptions options = new MarkerOptions().position(point).icon(activity.bitmapDescriptor);
            activity.baiduMap.clear();
            activity.baiduMap.addOverlay(options);
            break;
    }
}
 
開發者ID:838030195,項目名稱:DaiGo,代碼行數:23,代碼來源:SeeLocationActivity.java

示例6: initBaiduMap

import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入依賴的package包/類
/**
 * 初始化百度地圖
 */
private void initBaiduMap() {
    // 設置是否顯示縮放控件
    mMapView.showZoomControls(false);
    mBaiduMap = mMapView.getMap();
    // 設定地圖中心點坐標:寧波天翔貨櫃有限公司(雲台山路)
    LatLng point = new LatLng(29.882673, 121.894326);
    // 以動畫方式更新地圖狀態,動畫耗時默認 300 ms ,地圖支持的最大最小級別分別為[3-21]
    mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newLatLngZoom(point, 18));
    // 定義Maker坐標點:寧波天翔貨櫃有限公司(雲台山路)
    ArrayList<BitmapDescriptor> giflist = new ArrayList<>();
    giflist.add(BitmapDescriptorFactory.fromResource(R.mipmap.ic_marker));
    giflist.add(BitmapDescriptorFactory.fromResource(R.mipmap.ic_marker_light));
    // 通過marker的icons設置一組圖片,再通過period設置多少幀刷新一次圖片資源
    MarkerOptions mo = new MarkerOptions().position(point).icons(giflist).zIndex(0).period(20);
    // 設置生長動畫/掉下動畫
    // mo.animateType(MarkerOptions.MarkerAnimateType.drop);
    // 在地圖上添加Marker,並顯示
    mBaiduMap.addOverlay(mo);
}
 
開發者ID:jpaijh,項目名稱:TYT,代碼行數:23,代碼來源:CB_BaiduMapActivity.java

示例7: initView

import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入依賴的package包/類
private void initView() {
    //設置模擬狀態欄的高度
    ViewGroup.LayoutParams layoutParams = mStatusBar.getLayoutParams();
    layoutParams.height = ScreenUtil.getStatusBarHeight(this);
    mStatusBar.setLayoutParams(layoutParams);

    baiduMap = mapView.getMap();
    /* 是否顯示比例尺控件 */
    mapView.showScaleControl(true);
    /* 是否顯示縮放控件 */
    mapView.showZoomControls(false);
    baiduMap = mapView.getMap();
    /* 是否允許定位圖層 */
    baiduMap.setMyLocationEnabled(true);
    /* 設置縮放級別,改變地圖狀態 */
    baiduMap.setMapStatus(MapStatusUpdateFactory.zoomTo(17f));
    mNaviDao = BaiduNaviDao.getInstance();
    /* 獲取家和單位地址 */
    homeAddress = mNaviDao.getHomeOrCompanyAddress(getResources().getString(R.string.home));
    companyAddress = mNaviDao.getHomeOrCompanyAddress(getResources().getString(R.string.company));
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:22,代碼來源:TrafficShowActivity.java

示例8: zoomToSpan

import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入依賴的package包/類
@Override
public void zoomToSpan() {
    if (mAmosfMap != null) {
        try {
            mAmosfMap.postDelayed(new Runnable() {
                @Override
                public void run() {
                    ConfirmCustomPoiOverlay.super.zoomToSpan();
                    if (mAmosfPoiBox.getVisibility() == View.VISIBLE) {
                        MapStatus ms = baiduMap.getMapStatus();
                        ms.targetScreen.set(ScreenUtil.getInstance().getWidthPixels() / 2, ScreenUtil.getInstance().getHeightPixels() / 4);
                        baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(ms));
                    }
                }
            }, 300);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:21,代碼來源:SetFavoriteMapActivity.java

示例9: zoomToSpan

import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入依賴的package包/類
@Override
public void zoomToSpan() {
    if (mAncpMap != null) {
        try {
            mAncpMap.postDelayed(new Runnable() {
                @Override
                public void run() {
                    ConfirmCustomPoiOverlay.super.zoomToSpan();
                    if (mAncpPoiBox.getVisibility() == View.VISIBLE) {
                        MapStatus ms = baiduMap.getMapStatus();
                        ms.targetScreen.set(ScreenUtil.getInstance().getWidthPixels() / 2, ScreenUtil.getInstance().getHeightPixels() / 4);
                        baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(ms));
                    }
                }
            }, 500);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:21,代碼來源:NaviConfirmPointActivity.java

示例10: zoomToSpan

import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入依賴的package包/類
@Override
public void zoomToSpan() {
    if (mapView != null) {
        try {
            mapView.postDelayed(new Runnable() {
                @Override
                public void run() {
                    ConfirmPoiOverlay.super.zoomToSpan();
                    if (mTrafficShowView.getPoiListBox().getVisibility() == View.VISIBLE) {
                        MapStatus ms = baiduMap.getMapStatus();
                        ms.targetScreen.set(ScreenUtil.getInstance().getWidthPixels() / 2, ScreenUtil.getInstance().getHeightPixels() / 4);
                        baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(ms));
                    }
                }
            }, 300);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:21,代碼來源:TrafficShowPresenter.java

示例11: stopRunning

import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入依賴的package包/類
private void stopRunning() {
    runningStatus = 2;
    timer.stop();
    client.stop();

    startButton.setIdleText("跑步結束");
    startButton.setProgress(0);

    if (!pointList.isEmpty()) {
        addMarker(pointList.get(pointList.size() - 1), R.drawable.ic_loc_end);
    }

    msUpdate = MapStatusUpdateFactory.newMapStatus(
            new MapStatus.Builder().zoom(17).build()
    );
    baiduMap.setMapStatus(msUpdate);

    locTimes = 0;//重置定位次數

    stepSensor.unregisterStep();
    saveRunData();

    // 計算平均速度
    float speed = Integer.parseInt(distanceNumber.getNumber()) / getSeconds();
    speedNumber.setText(Utility.formatDecimal(speed, 2));
}
 
開發者ID:SailFlorve,項目名稱:RunHDU,代碼行數:27,代碼來源:RunningActivity.java

示例12: moveToMe

import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入依賴的package包/類
private void moveToMe(BDLocation location)
{
    MapStatusUpdate mapUpdate=MapStatusUpdateFactory.zoomTo(18);
    baiduMap.setMapStatus(mapUpdate);
    //開始移動
    MapStatusUpdate mapLatlng=MapStatusUpdateFactory.newLatLng(new LatLng(location.getLatitude(),location.getLongitude()));
    baiduMap.setMapStatus(mapLatlng);
    //顯示我的位置
    MyLocationData.Builder locationBuilder=new MyLocationData.Builder();
    locationBuilder.latitude(location.getLatitude());
    locationBuilder.longitude(location.getLongitude());
    MyLocationData locationData=locationBuilder.build();
    baiduMap.setMyLocationData(locationData);
    //顯示用戶所在地附近
    Toast.makeText(this,"您當前在"+location.getAddrStr()+"附近",Toast.LENGTH_SHORT).show();
}
 
開發者ID:WindFromFarEast,項目名稱:SmartButler,代碼行數:17,代碼來源:LocationActivity.java

示例13: initMapSetting

import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入依賴的package包/類
private void initMapSetting() {

        mMapView.showZoomControls(false);

        mBaiduMap = mMapView.getMap();
        // 開啟定位圖層
        mBaiduMap.setMyLocationEnabled(true);
        //設置指南針
//        UiSettings uiSettings = mBaiduMap.getUiSettings();
//        uiSettings.setCompassEnabled(true);

        mBaiduMap.setCompassPosition(new Point(660,60));

        //設置普通地圖
        mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL);
        //設置定位圖層配置信息,隻有先允許定位圖層後設置定位圖層配置信息才會生效
        mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration(
                MyLocationConfiguration.LocationMode.NORMAL, false, null));
        mBaiduMap.setBuildingsEnabled(false);

        //設置縮放級別
        MapStatusUpdate msu = MapStatusUpdateFactory.zoomTo(16.0f);
        mBaiduMap.setMapStatus(msu);

    }
 
開發者ID:funnyzhaov,項目名稱:Tribe,代碼行數:26,代碼來源:NearbyFragment.java

示例14: iniMap

import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入依賴的package包/類
/**
 * iniMap 初始化地圖
 */
private void iniMap() {
    LocationClientOption option = new LocationClientOption();
    option.setOpenGps(true);// 打開gps
    option.setCoorType("bd09ll"); // 設置坐標類型
    option.setScanSpan(3000);
    mCurrentMode = MyLocationConfiguration.LocationMode.NORMAL;

    // 縮放
    MapStatusUpdate msu = MapStatusUpdateFactory.zoomTo(14.0f);
    mBaiduMap.setMapStatus(msu);

    mBaiduMap.setMyLocationConfigeration(new MyLocationConfiguration(mCurrentMode, true, mCurrentMarker));
    mLocClient.setLocOption(option);
    mLocClient.start();
    initOverlay();

    // 開啟線程,一直修改GPS坐標
    LocationUtil.startLocaton();
}
 
開發者ID:littleRich,項目名稱:VirtualLocation,代碼行數:23,代碼來源:MainActivity.java

示例15: navigateTo

import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入依賴的package包/類
public void navigateTo(BDLocation location){
    if(isFirstLocate){
        LatLng latLng=new LatLng(location.getLatitude(),location.getLongitude());
        showToast("定位到當前位置已執行");

        MapStatusUpdate    update=MapStatusUpdateFactory.zoomTo(8f);
        baiduMap.animateMapStatus(update);
        update= MapStatusUpdateFactory.newLatLng(latLng);
        baiduMap.animateMapStatus(update);

       isFirstLocate=false;
    }
    MyLocationData.Builder locationBuilder=new MyLocationData.Builder();
    locationBuilder.latitude(location.getLatitude());
    locationBuilder.longitude(location.getLongitude());
    baiduMap.setMyLocationData(locationBuilder.build());

}
 
開發者ID:MoonRiser,項目名稱:MaterialLearning,代碼行數:19,代碼來源:BaiduMapActivity.java


注:本文中的com.baidu.mapapi.map.MapStatusUpdateFactory類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。