当前位置: 首页>>代码示例>>Java>>正文


Java MapStatusUpdateFactory.newLatLngBounds方法代码示例

本文整理汇总了Java中com.baidu.mapapi.map.MapStatusUpdateFactory.newLatLngBounds方法的典型用法代码示例。如果您正苦于以下问题:Java MapStatusUpdateFactory.newLatLngBounds方法的具体用法?Java MapStatusUpdateFactory.newLatLngBounds怎么用?Java MapStatusUpdateFactory.newLatLngBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.baidu.mapapi.map.MapStatusUpdateFactory的用法示例。


在下文中一共展示了MapStatusUpdateFactory.newLatLngBounds方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: zoomByLatLngBounds

import com.baidu.mapapi.map.MapStatusUpdateFactory; //导入方法依赖的package包/类
public static void zoomByLatLngBounds(MapView mapView, LatLngBounds bounds, boolean animated) {
    MapStatusUpdate update = MapStatusUpdateFactory.newLatLngBounds(bounds);
    if (animated)
        mapView.getMap().animateMapStatus(update);
    else
        mapView.getMap().setMapStatus(update);
}
 
开发者ID:iWay7,项目名称:BikeHelper,代码行数:8,代码来源:MapViewUtils.java

示例2: zoomToFit

import com.baidu.mapapi.map.MapStatusUpdateFactory; //导入方法依赖的package包/类
@Override
  public void zoomToFit(List<LatLong> coords) {
      final BaiduMap map = getBaiduMap();
if (map == null) return;

if (!coords.isEmpty()) {
          final List<LatLng> points = new ArrayList<LatLng>();
          for (LatLong coord : coords)
              points.add(MapUtils.coordToBaiduLatLng(coord));

          final LatLngBounds bounds = getBounds(points);

	final Activity activity = getActivity();
	if (activity == null)
		return;

	final View rootView = ((ViewGroup)activity.findViewById(android.R.id.content)).getChildAt(0);
	if (rootView == null)
		return;

	final int height = rootView.getHeight();
	final int width = rootView.getWidth();
	Log.d(TAG, String.format(Locale.US, "Screen W %d, H %d", width, height));
	if (height > 0 && width > 0) {
              MapStatusUpdate animation = MapStatusUpdateFactory.newLatLngBounds(bounds, width, height);
              map.animateMapStatus(animation);
	}
      }
  }
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:30,代码来源:BaiduMapFragment.java

示例3: zoomToFit

import com.baidu.mapapi.map.MapStatusUpdateFactory; //导入方法依赖的package包/类
@Override
public void zoomToFit(List<LatLong> coords) {
    if (!coords.isEmpty()) {
        final List<LatLng> points = new ArrayList<LatLng>();
        for (LatLong coord : coords)
            points.add(DroneHelper.CoordToBaiduLatLang(coord));

        final LatLngBounds bounds = getBounds(points);
        MapStatusUpdate update = MapStatusUpdateFactory.newLatLngBounds(bounds);
        getBaiduMap().animateMapStatus(update);
    }
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:13,代码来源:BaiduMapFragment.java

示例4: onGetSearchResult

import com.baidu.mapapi.map.MapStatusUpdateFactory; //导入方法依赖的package包/类
@Override
public void onGetSearchResult(CloudSearchResult result, int error) {
	if (progress.isShowing()) {
		progress.dismiss();
	}
	if (result != null && result.poiList != null && result.poiList.size() > 0) {
		Log.d(TAG, "onGetSearchResult, result length: " + result.poiList.size());
		mPoiInfos = new ArrayList<CloudPoiInfo>();
		mPoiInfos.addAll(result.poiList);
		// if (mIsUpdatePoi) {
		// String latitude = lastLocation.getLatitude() + "";
		// String longitude = lastLocation.getLongitude() + "";
		// String addrStr = lastLocation.getAddrStr();
		// for (CloudPoiInfo info : mPoiInfos) {
		// Map<String, Object> extras = info.extras;
		//
		// if (info.tags.equals(mUser.getObjectId())) {
		// updatePoi(String.valueOf(info.uid), mUser.getUsername(), addrStr, latitude, longitude, "1", "98950");
		// }
		// }
		// mIsUpdatePoi = false;
		// }
		mBaiduMap.clear();
		BitmapDescriptor bd = BitmapDescriptorFactory.fromResource(R.drawable.icon_geo);
		LatLng ll;
		LatLngBounds.Builder builder = new Builder();
		for (CloudPoiInfo info : mPoiInfos) {
			 if (info.title.equals(mUser.getUsername())) {
				 continue;
			 }
			ll = new LatLng(info.latitude, info.longitude);
			OverlayOptions oo = new MarkerOptions().icon(bd).position(ll).title(info.title);
			mBaiduMap.addOverlay(oo);
			builder.include(ll);
			LatLngBounds bounds = builder.build();
			MapStatusUpdate u = MapStatusUpdateFactory.newLatLngBounds(bounds);
			mBaiduMap.animateMapStatus(u);
		}
	}
}
 
开发者ID:liuyanggithub,项目名称:Hi,代码行数:41,代码来源:NearLocationActivity.java

示例5: drawHistoryTrack

import com.baidu.mapapi.map.MapStatusUpdateFactory; //导入方法依赖的package包/类
/** 绘制历史轨迹
   * 
   * @param points
   */
private void drawHistoryTrack(final List<LatLng> points,final double distance) {
	// 绘制新覆盖物前,清空之前的覆盖物
	
	mBaiduMap.clear();
	
	if(points.size() == 1){
		points.add(points.get(0));
	}
	
	if(points == null || points.size() == 0){
		TrackApplication.showMessage("当前查询无轨迹点");
		resetMarker();
	}else if (points.size() > 1) {
		
		LatLng llc = points.get(0);
		LatLng llD = points.get(points.size() - 1);
		LatLngBounds bounds = new LatLngBounds.Builder()
				.include(llc).include(llD).build();
		
		mapStatusUpdate = MapStatusUpdateFactory.newLatLngBounds(bounds);
		 
		//起点图标
		bmStart = BitmapDescriptorFactory.fromResource(R.drawable.icon_start);
		bmEnd = BitmapDescriptorFactory.fromResource(R.drawable.icon_end);
		
		//添加起点图标
		startMarker = new MarkerOptions()
				.position(points.get(points.size() - 1)).icon(bmStart)
				.zIndex(9).draggable(true);
		
		//添加终点图标
		endMarker = new MarkerOptions().position(points.get(0))
				.icon(bmEnd).zIndex(9).draggable(true);
		
		//添加路线
		polylineOptions = new PolylineOptions().width(10)
				.color(Color.RED).points(points);
		
		markerOptions = new MarkerOptions();
		markerOptions.flat(true);
		markerOptions.anchor(0.5f, 0.5f);
		markerOptions.icon(BitmapDescriptorFactory
				.fromResource(R.drawable.icon_gcoding));
		markerOptions.position(points.get(points.size() - 1));
		
		addMarker();
		
	}
}
 
开发者ID:huazifoothole,项目名称:NikiRun,代码行数:54,代码来源:RunQueryHistoryActivity.java


注:本文中的com.baidu.mapapi.map.MapStatusUpdateFactory.newLatLngBounds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。