当前位置: 首页>>代码示例>>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;未经允许,请勿转载。