本文整理汇总了Java中com.baidu.mapapi.map.MapStatusUpdate类的典型用法代码示例。如果您正苦于以下问题:Java MapStatusUpdate类的具体用法?Java MapStatusUpdate怎么用?Java MapStatusUpdate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MapStatusUpdate类属于com.baidu.mapapi.map包,在下文中一共展示了MapStatusUpdate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initView
import com.baidu.mapapi.map.MapStatusUpdate; //导入依赖的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);
}
示例2: moveToMe
import com.baidu.mapapi.map.MapStatusUpdate; //导入依赖的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();
}
示例3: initMapSetting
import com.baidu.mapapi.map.MapStatusUpdate; //导入依赖的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);
}
示例4: iniMap
import com.baidu.mapapi.map.MapStatusUpdate; //导入依赖的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();
}
示例5: navigateTo
import com.baidu.mapapi.map.MapStatusUpdate; //导入依赖的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());
}
示例6: onReceiveLocation
import com.baidu.mapapi.map.MapStatusUpdate; //导入依赖的package包/类
@Override
public void onReceiveLocation(BDLocation bdLocation) {
mLastLocationData=bdLocation;
MyLocationData myLocationData=new MyLocationData.Builder()
.accuracy(bdLocation.getRadius())
.latitude(bdLocation.getLatitude())
.longitude(bdLocation.getLongitude())
.build();
mBaiduMap.setMyLocationData(myLocationData);
MapStatusUpdate msu1 = MapStatusUpdateFactory.zoomTo(15.0f);
mBaiduMap.setMapStatus(msu1);
if(isFirstIn){
LatLng ll=new LatLng(bdLocation.getLatitude(),bdLocation.getLongitude());
MapStatusUpdate msu=MapStatusUpdateFactory.newLatLng(ll);
mBaiduMap.setMapStatus(msu);
isFirstIn=false;
}
}
示例7: onMapStatusChangeFinish
import com.baidu.mapapi.map.MapStatusUpdate; //导入依赖的package包/类
public void onMapStatusChangeFinish(MapStatus mapStatus) {
String _str = mapStatus.toString();
String _regex = "target lat: (.*)\ntarget lng";
String _regex2 = "target lng: (.*)\ntarget screen x";
changeLatitude = Double.parseDouble(latlng(_regex, _str));
changeLongitude = Double.parseDouble(latlng(_regex2, _str));
LatLng changeLL = new LatLng(changeLatitude, changeLongitude);
startNodeStr = PlanNode.withLocation(changeLL);
Log.d(TAG, "changeLatitude-----change--------" + changeLatitude);
Log.d(TAG, "changeLongitude-----change--------" + changeLongitude);
if (!isNeedCurrentlocation) {
MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(changeLL);
baiduMap.setMapStatus(u);
if (Math.hypot((changeLatitude - currentLatitude),
(changeLongitude - currentLongitude)) > 0.00001) {
Logger.d(Math.hypot((changeLatitude - currentLatitude),
(changeLongitude - currentLongitude)));
if (routeOverlay != null)
routeOverlay.removeFromMap();
addOverLayout(changeLatitude, changeLongitude);
}
}
}
示例8: navigateTo
import com.baidu.mapapi.map.MapStatusUpdate; //导入依赖的package包/类
/**
* des:地图跳到指定位置
*
* @param location
*/
private void navigateTo(BDLocation location) {
if (isFirstLocation) {
LatLng ll = new LatLng(location.getLatitude(), location.getLongitude());
MapStatusUpdate update = MapStatusUpdateFactory.newLatLng(ll);
baiduMap.animateMapStatus(update);
update = MapStatusUpdateFactory.zoomTo(18f);
baiduMap.animateMapStatus(update);
isFirstLocation = false;
}
MyLocationData.Builder builder = new MyLocationData.Builder();
builder.latitude(location.getLatitude());
builder.longitude(location.getLongitude());
MyLocationData data = builder.build();
baiduMap.setMyLocationData(data);
}
示例9: initViews
import com.baidu.mapapi.map.MapStatusUpdate; //导入依赖的package包/类
private void initViews() {
mBtnPre = (Button) findViewById(R.id.btn_busline_pre);
mBtnNext = (Button) findViewById(R.id.btn_busline_next);
mBtnPre.setVisibility(View.INVISIBLE);
mBtnNext.setVisibility(View.INVISIBLE);
etRouteOnline = (EditText) findViewById(R.id.et_route_online);
mBaiduMap = ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.bmapView)).getBaiduMap();
// �趨��ͼ��ʼ���ĵ����꣨�����ʵ��ѧ����У����
LatLng xayd = new LatLng(34.162719, 108.907775);
// �趨��ͼ״̬���趨��ʼ���ĵ�����ż�����
MapStatus mMapStatus = new MapStatus.Builder().target(xayd).zoom(12)
.build();
// ����MapStatusUpdate�����Ա�������ͼ״̬��Ҫ�����ı仯
MapStatusUpdate mMapStatusUpdate = MapStatusUpdateFactory
.newMapStatus(mMapStatus);
// ���õ�ͼ״̬
mBaiduMap.setMapStatus(mMapStatusUpdate);
}
示例10: initBaiduMap
import com.baidu.mapapi.map.MapStatusUpdate; //导入依赖的package包/类
private void initBaiduMap() {
mBaiduMap = mIMapView.getBaiduMap();
//获取地图对象控制器
mBaiduMap.setBuildingsEnabled(true);//设置显示楼体
mBaiduMap.setMapStatus(MapStatusUpdateFactory.zoomTo(19f));//设置地图状态
mUiSettings = mBaiduMap.getUiSettings();
mUiSettings.setZoomGesturesEnabled(true);
mUiSettings.setScrollGesturesEnabled(true);
mUiSettings.setRotateGesturesEnabled(true);
mUiSettings.setOverlookingGesturesEnabled(true);
mUiSettings.setCompassEnabled(true);
MapStatus ms = new MapStatus.Builder().overlook(30).build();
MapStatusUpdate u = MapStatusUpdateFactory.newMapStatus(ms);
mBaiduMap.animateMapStatus(u, 1000);
// 初始化搜索模块
mSearch = GeoCoder.newInstance();
mSearch.setOnGetGeoCodeResultListener(this);
}
示例11: onCreateView
import com.baidu.mapapi.map.MapStatusUpdate; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_map, container, false);
// Inflate the layout for this fragment
switchLocation = (Switch) view.findViewById(R.id.switchLocation);
switchLBSTrace = (Switch) view.findViewById(R.id.switchLBSTrace);
switchLocation.setOnCheckedChangeListener(this);
switchLBSTrace.setOnCheckedChangeListener(this);
mMapView = (TextureMapView) view.findViewById(R.id.bmapView);
baiduMap = mMapView.getMap();
baiduMap.setMyLocationConfigeration(new MyLocationConfiguration(MyLocationConfiguration.LocationMode.NORMAL, false, null));
application.setMaxZoomLevel(baiduMap.getMaxZoomLevel());
// 开启定位图层
baiduMap.setMyLocationEnabled(true);
baiduMap.setOnMarkerClickListener(this);
//再次进入地图fragment时界面刷新
if (application.latLng != null) {
MapStatusUpdate u = MapStatusUpdateFactory.newLatLngZoom(application.getLatLng(), application.getMaxZoomLevel() - 2);
baiduMap.animateMapStatus(u);//动画移动摄像头
if (radarNearbyInfoList != null) {
refreshMapUI();
}
}
return view;
}
示例12: onMarkerClick
import com.baidu.mapapi.map.MapStatusUpdate; //导入依赖的package包/类
@Override
public boolean onMarkerClick(Marker marker) {
Log.d("lml", "MapFragment:覆盖物被点击");
baiduMap.hideInfoWindow();
if (marker != null) {
latLngshow = marker.getPosition();
reverseGeoCodeOption.location(latLngshow);
geoCoder.reverseGeoCode(reverseGeoCodeOption);
tvAddOverlayGeoCoder.setText("正在获取详细位置");
bundle = marker.getExtraInfo();
generalIsMale = bundle.getString("general").equals("m");
layoutAddOverlayRadarNearbyItem.setBackgroundColor(getResources().getColor(generalIsMale ? R.color.blue : R.color.pink));
imageViewAddOverlayItem.setImageResource(generalIsMale ? R.mipmap.map_portrait_man : R.mipmap.map_portrait_woman);
tvAddOverlayItemUserID.setText(bundle.getString("userID"));
tvAddOverlayItemDistance.setText("距离" + bundle.getInt("distance") + "米 ");
tvAddOverlayItemLatlng.setText("坐标: " + latLngshow.latitude + " , " + latLngshow.longitude + " ");
Log.d("lml", "MapFragment显示的信息:" + bundle.getString("userID"));
Log.d("lml", bundle.getString("general") + ";" + generalIsMale);
baiduMap.showInfoWindow(new InfoWindow(viewOverlayItem, marker.getPosition(), -70));
MapStatusUpdate update = MapStatusUpdateFactory.newLatLng(marker.getPosition());
baiduMap.animateMapStatus(update);
return true;
} else
return false;
}
示例13: updateBDMapStatus
import com.baidu.mapapi.map.MapStatusUpdate; //导入依赖的package包/类
private void updateBDMapStatus(BDLocation location) {
final BaiduMap map = getBaiduMap();
final BaiduMapPrefFragment provider = (BaiduMapPrefFragment)(getProvider().getMapProviderPreferences());
final Context context = getActivity().getApplicationContext();
int mapType = provider.getMapType(context);
map.setMapType(mapType);
MyLocationData locData = new MyLocationData.Builder()
.accuracy(location.getRadius())
.latitude(location.getLatitude())
.longitude(location.getLongitude()).build();
map.setMyLocationData(locData);
LatLng ll = new LatLng(location.getLatitude(), location.getLongitude());
MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(ll);
map.animateMapStatus(u);
}
示例14: addMarker
import com.baidu.mapapi.map.MapStatusUpdate; //导入依赖的package包/类
/**
* 添加覆盖物
*/
protected void addMarker() {
if(null != mapStatusUpdate){
MapStatusUpdate ms = MapStatusUpdateFactory.zoomTo(19);
mBaiduMap.setMapStatus(mapStatusUpdate);
mBaiduMap.animateMapStatus(ms);
Log.i(MainActivity.TAG, "zoom level = "+ mBaiduMap.getMaxZoomLevel());
}
if(null != startMarker){
mBaiduMap.addOverlay(startMarker);
}
if(null != endMarker){
mBaiduMap.addOverlay(endMarker);
}
if(null != polylineOptions){
mBaiduMap.addOverlay(polylineOptions);
}
}
示例15: initMapView
import com.baidu.mapapi.map.MapStatusUpdate; //导入依赖的package包/类
/**
* 初始化地图
*/
private void initMapView() {
//设定中心点坐标
myLatLng = new LatLng(Const.LATITUDE_OF_MY_LOCATION,Const.LONGITUDE_OF_MY_LOCATION);
//定义地图状态
MapStatus mMapStatus = new MapStatus.Builder()
.target(myLatLng)
.zoom(18)
.build();
//定义MapStatusUpdate对象,以便描述地图状态将要发生的变化
bd = BitmapDescriptorFactory
.fromResource(R.drawable.icon_gcoding);
MarkerOptions markerOptions = new MarkerOptions().position(myLatLng).icon(bd);
mBaiduMap.addOverlay(markerOptions);
MapStatusUpdate mMapStatusUpdate = MapStatusUpdateFactory.newMapStatus(mMapStatus);
//改变地图状态
mBaiduMap.setMapStatus(mMapStatusUpdate);
}