本文整理匯總了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));
}
示例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()));
}
}
示例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()));
}
示例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);
}
示例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;
}
}
示例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);
}
示例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));
}
示例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();
}
}
}
示例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();
}
}
}
示例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();
}
}
}
示例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));
}
示例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();
}
示例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);
}
示例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();
}
示例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());
}