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