當前位置: 首頁>>代碼示例>>Java>>正文


Java MapStatusUpdateFactory.newLatLngZoom方法代碼示例

本文整理匯總了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;
}
 
開發者ID:bitkylin,項目名稱:MapForTour,代碼行數:27,代碼來源:MapFragment.java

示例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);
}
 
開發者ID:Qinlong275,項目名稱:AndroidBookTest,代碼行數:14,代碼來源:MainActivity.java

示例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);
}
 
開發者ID:turoDog,項目名稱:KTalk,代碼行數:15,代碼來源:EaseBaiduMapActivity.java

示例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);
}
 
開發者ID:turoDog,項目名稱:KTalk,代碼行數:34,代碼來源:EaseBaiduMapActivity.java

示例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 - 設置一次位置");
}
 
開發者ID:bitkylin,項目名稱:MapForTour,代碼行數:10,代碼來源:MapFragment.java

示例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);
		}
	}

}
 
開發者ID:Mrsunsunshine,項目名稱:FrontOne,代碼行數:37,代碼來源:BusLineActivity.java

示例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);
}
 
開發者ID:nggirl,項目名稱:EaseChatDemo,代碼行數:15,代碼來源:EaseBaiduMapActivity.java

示例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);
}
 
開發者ID:nggirl,項目名稱:EaseChatDemo,代碼行數:34,代碼來源:EaseBaiduMapActivity.java

示例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);
}
 
開發者ID:scp504677840,項目名稱:MoveMapLocation,代碼行數:57,代碼來源:MainActivity.java


注:本文中的com.baidu.mapapi.map.MapStatusUpdateFactory.newLatLngZoom方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。