本文整理汇总了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());
}