本文整理匯總了Java中com.baidu.mapapi.map.MapStatusUpdateFactory.newLatLngZoom方法的典型用法代碼示例。如果您正苦於以下問題:Java MapStatusUpdateFactory.newLatLngZoom方法的具體用法?Java MapStatusUpdateFactory.newLatLngZoom怎麽用?Java MapStatusUpdateFactory.newLatLngZoom使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.baidu.mapapi.map.MapStatusUpdateFactory
的用法示例。
在下文中一共展示了MapStatusUpdateFactory.newLatLngZoom方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreateView
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的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;
}
示例2: navigateTo
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的package包/類
private void navigateTo(BDLocation location){
if (isFirstLocate){
LatLng ll=new LatLng(location.getLatitude(),location.getLongitude());
MapStatusUpdate mapStatus=MapStatusUpdateFactory.newLatLngZoom(ll,16f);
baiduMap.setMapStatus(mapStatus);
isFirstLocate=false;
}
MyLocationData.Builder locationBuilder=new MyLocationData.Builder();
locationBuilder.latitude(location.getLatitude());
locationBuilder.longitude(location.getLongitude());
MyLocationData locationData=locationBuilder.build();
baiduMap.setMyLocationData(locationData);
}
示例3: showMap
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的package包/類
private void showMap(double latitude, double longtitude, String address) {
sendButton.setVisibility(View.GONE);
LatLng llA = new LatLng(latitude, longtitude);
CoordinateConverter converter= new CoordinateConverter();
converter.coord(llA);
converter.from(CoordinateConverter.CoordType.COMMON);
LatLng convertLatLng = converter.convert();
OverlayOptions ooA = new MarkerOptions().position(convertLatLng).icon(BitmapDescriptorFactory
.fromResource(R.drawable.ease_icon_marka))
.zIndex(4).draggable(true);
mBaiduMap.addOverlay(ooA);
MapStatusUpdate u = MapStatusUpdateFactory.newLatLngZoom(convertLatLng, 17.0f);
mBaiduMap.animateMapStatus(u);
}
示例4: onReceiveLocation
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location) {
if (location == null) {
return;
}
Log.d("map", "On location change received:" + location);
Log.d("map", "addr:" + location.getAddrStr());
sendButton.setEnabled(true);
if (progressDialog != null) {
progressDialog.dismiss();
}
if (lastLocation != null) {
if (lastLocation.getLatitude() == location.getLatitude() && lastLocation.getLongitude() == location.getLongitude()) {
Log.d("map", "same location, skip refresh");
// mMapView.refresh(); //need this refresh?
return;
}
}
lastLocation = location;
mBaiduMap.clear();
LatLng llA = new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude());
CoordinateConverter converter= new CoordinateConverter();
converter.coord(llA);
converter.from(CoordinateConverter.CoordType.COMMON);
LatLng convertLatLng = converter.convert();
OverlayOptions ooA = new MarkerOptions().position(convertLatLng).icon(BitmapDescriptorFactory
.fromResource(R.drawable.ease_icon_marka))
.zIndex(4).draggable(true);
mBaiduMap.addOverlay(ooA);
MapStatusUpdate u = MapStatusUpdateFactory.newLatLngZoom(convertLatLng, 17.0f);
mBaiduMap.animateMapStatus(u);
}
示例5: setBaiduMapLocationData
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的package包/類
public void setBaiduMapLocationData(MyLocationData locData) {
baiduMap.setMyLocationData(locData);
if (isFirstLocate) {
MapStatusUpdate u = MapStatusUpdateFactory.newLatLngZoom(application.getLatLng(), application.getMaxZoomLevel() - 2);
baiduMap.animateMapStatus(u);//動畫移動攝像頭
isFirstLocate = false;
}
Log.d("lml", "MapFragment - 設置一次位置");
}
示例6: showMap
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的package包/類
/**
* 顯示地圖
* @param position 點擊第幾個公交站點
*/
private void showMap(int position) {
calculate();
changeStatus(STATUS_MAP);
mBaiduMap.clear();
mBusLineOverlay = new BusLineOverlay(mBaiduMap);
mBaiduMap.setOnMarkerClickListener(mBusLineOverlay);
mBusLineOverlay.setData(mBusLineResult);
mBusLineOverlay.addToMap();
mBusLineOverlay.zoomToSpan();
MapStatusUpdate u = MapStatusUpdateFactory.newLatLngZoom(
mBusLineResult.getStations().get(position).getLocation(), (float) (mBaiduMap.getMaxZoomLevel()*0.75));
mBaiduMap.animateMapStatus(u);
//畫點
BitmapDescriptor stationBitmap = BitmapDescriptorFactory
.fromResource(R.drawable.ic_locate);
OverlayOptions option = new MarkerOptions()
.position(mBusLineResult.getStations().get(position).getLocation()).anchor(0.5f, 1.0f).zIndex(100).icon(stationBitmap);
mBaiduMap.addOverlay(option);
BitmapDescriptor bitmap = BitmapDescriptorFactory
.fromResource(R.drawable.walk_turn);
if(runBusList!=null){
for(Bus bus : runBusList){
OverlayOptions cOption = new MarkerOptions()
.position(new LatLng(bus.getLatitude(),bus.getLongitude())).anchor(0.5f, 1.0f).zIndex(100).icon(bitmap);
mBaiduMap.addOverlay(cOption);
}
}
}
示例7: showMap
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的package包/類
private void showMap(double latitude, double longtitude, String address) {
sendButton.setVisibility(View.GONE);
LatLng llA = new LatLng(latitude, longtitude);
CoordinateConverter converter = new CoordinateConverter();
converter.coord(llA);
converter.from(CoordinateConverter.CoordType.COMMON);
LatLng convertLatLng = converter.convert();
OverlayOptions ooA = new MarkerOptions().position(convertLatLng).icon(BitmapDescriptorFactory
.fromResource(R.drawable.ease_icon_marka))
.zIndex(4).draggable(true);
mBaiduMap.addOverlay(ooA);
MapStatusUpdate u = MapStatusUpdateFactory.newLatLngZoom(convertLatLng, 17.0f);
mBaiduMap.animateMapStatus(u);
}
示例8: onReceiveLocation
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location) {
if (location == null) {
return;
}
Log.d("map", "On location change received:" + location);
Log.d("map", "addr:" + location.getAddrStr());
sendButton.setEnabled(true);
if (progressDialog != null) {
progressDialog.dismiss();
}
if (lastLocation != null) {
if (lastLocation.getLatitude() == location.getLatitude() && lastLocation.getLongitude() == location.getLongitude()) {
Log.d("map", "same location, skip refresh");
// mMapView.refresh(); //need this refresh?
return;
}
}
lastLocation = location;
mBaiduMap.clear();
LatLng llA = new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude());
CoordinateConverter converter = new CoordinateConverter();
converter.coord(llA);
converter.from(CoordinateConverter.CoordType.COMMON);
LatLng convertLatLng = converter.convert();
OverlayOptions ooA = new MarkerOptions().position(convertLatLng).icon(BitmapDescriptorFactory
.fromResource(R.drawable.ease_icon_marka))
.zIndex(4).draggable(true);
mBaiduMap.addOverlay(ooA);
MapStatusUpdate u = MapStatusUpdateFactory.newLatLngZoom(convertLatLng, 17.0f);
mBaiduMap.animateMapStatus(u);
}
示例9: onReceiveLocation
import com.baidu.mapapi.map.MapStatusUpdateFactory; //導入方法依賴的package包/類
/**
* 定位監聽
*
* @param bdLocation
*/
@Override
public void onReceiveLocation(BDLocation bdLocation) {
//如果bdLocation為空或mapView銷毀後不再處理新數據接收的位置
if (bdLocation == null || mBaiduMap == null) {
return;
}
//定位數據
MyLocationData data = new MyLocationData.Builder()
//定位精度bdLocation.getRadius()
.accuracy(bdLocation.getRadius())
//此處設置開發者獲取到的方向信息,順時針0-360
.direction(bdLocation.getDirection())
//經度
.latitude(bdLocation.getLatitude())
//緯度
.longitude(bdLocation.getLongitude())
//構建
.build();
//設置定位數據
mBaiduMap.setMyLocationData(data);
//是否是第一次定位
if (isFirstLoc) {
isFirstLoc = false;
LatLng ll = new LatLng(bdLocation.getLatitude(), bdLocation.getLongitude());
MapStatusUpdate msu = MapStatusUpdateFactory.newLatLngZoom(ll, 18);
mBaiduMap.animateMapStatus(msu);
}
//獲取坐標,待會用於POI信息點與定位的距離
locationLatLng = new LatLng(bdLocation.getLatitude(), bdLocation.getLongitude());
//獲取城市,待會用於POISearch
city = bdLocation.getCity();
//文本輸入框改變監聽,必須在定位完成之後
searchAddress.addTextChangedListener(this);
//創建GeoCoder實例對象
geoCoder = GeoCoder.newInstance();
//發起反地理編碼請求(經緯度->地址信息)
ReverseGeoCodeOption reverseGeoCodeOption = new ReverseGeoCodeOption();
//設置反地理編碼位置坐標
reverseGeoCodeOption.location(new LatLng(bdLocation.getLatitude(), bdLocation.getLongitude()));
geoCoder.reverseGeoCode(reverseGeoCodeOption);
//設置查詢結果監聽者
geoCoder.setOnGetGeoCodeResultListener(this);
}