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


Java LatLngBounds类代码示例

本文整理汇总了Java中com.baidu.mapapi.model.LatLngBounds的典型用法代码示例。如果您正苦于以下问题:Java LatLngBounds类的具体用法?Java LatLngBounds怎么用?Java LatLngBounds使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: zoomToSpan

import com.baidu.mapapi.model.LatLngBounds; //导入依赖的package包/类
/**
 * 缩放地图,使所有Overlay都在合适的视野内
 * <p>
 * 注: 该方法只对Marker类型的overlay有效
 * </p>
 * 
 */
public void zoomToSpan() {
    if (mBaiduMap == null) {
        return;
    }
    if (mOverlayList.size() > 0) {
        LatLngBounds.Builder builder = new LatLngBounds.Builder();
        for (Overlay overlay : mOverlayList) {
            // polyline 中的点可能太多,只按marker 缩放
            if (overlay instanceof Marker) {
                builder.include(((Marker) overlay).getPosition());
            }
        }
        mBaiduMap.setMapStatus(MapStatusUpdateFactory
                .newLatLngBounds(builder.build()));
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:OverlayManager.java

示例2: zoomToSpan

import com.baidu.mapapi.model.LatLngBounds; //导入依赖的package包/类
/**
 * 缩放地图,使所有Overlay都在合适的视野内
 * <p>
 * 注: 该方法只对Marker类型的overlay有效
 * </p>
 */
public void zoomToSpan() {
    if (mBaiduMap == null) {
        return;
    }
    if (mOverlayList.size() > 0) {
        LatLngBounds.Builder builder = new LatLngBounds.Builder();
        for (Overlay overlay : mOverlayList) {
            // polyline 中的点可能太多,只按marker 缩放
            if (overlay instanceof Marker) {
                builder.include(((Marker) overlay).getPosition());
            }
        }
        mBaiduMap.setMapStatus(MapStatusUpdateFactory
                .newLatLngBounds(builder.build()));
    }
}
 
开发者ID:shenhuanet,项目名称:AndroidOpen,代码行数:23,代码来源:OverlayManager.java

示例3: zoomToSpan

import com.baidu.mapapi.model.LatLngBounds; //导入依赖的package包/类
/**
 * ���ŵ�ͼ��ʹ����Overlay���ں��ʵ���Ұ��
 * <p>
 * ע�� �÷���ֻ��Marker���͵�overlay��Ч
 * </p>
 * 
 */
public void zoomToSpan() {
    if (mBaiduMap == null) {
        return;
    }
    if (mOverlayList.size() > 0) {
        LatLngBounds.Builder builder = new LatLngBounds.Builder();
        for (Overlay overlay : mOverlayList) {
        	 // polyline �еĵ����̫�ֻ࣬��marker ����
            if (overlay instanceof Marker) {
                builder.include(((Marker) overlay).getPosition());
            }
        }
        mBaiduMap.setMapStatus(MapStatusUpdateFactory
                .newLatLngBounds(builder.build()));
    }
}
 
开发者ID:ContentCoderJian,项目名称:SmartTransXA,代码行数:24,代码来源:OverlayManager.java

示例4: zoomToSpan

import com.baidu.mapapi.model.LatLngBounds; //导入依赖的package包/类
/**
 * 缩放地图,使所有Overlay都在合适的视野内
 * <p>
 * 注: 该方法只对Marker类型的overlay有效
 * </p>
 *
 */
public void zoomToSpan() {
    if (mBaiduMap == null) {
        return;
    }
    if (mOverlayList.size() > 0) {
        LatLngBounds.Builder builder = new LatLngBounds.Builder();
        for (Overlay overlay : mOverlayList) {
            // polyline 中的点可能太多,只按marker 缩放
            if (overlay instanceof Marker) {
                builder.include(((Marker) overlay).getPosition());
            }
        }
        mBaiduMap.setMapStatus(MapStatusUpdateFactory
                .newLatLngBounds(builder.build()));
    }
}
 
开发者ID:CrazyRunning,项目名称:MyStudyHelper,代码行数:24,代码来源:OverlayManager.java

示例5: zoomByLatLngBounds

import com.baidu.mapapi.model.LatLngBounds; //导入依赖的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

示例6: zoomToFit

import com.baidu.mapapi.model.LatLngBounds; //导入依赖的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

示例7: getBounds

import com.baidu.mapapi.model.LatLngBounds; //导入依赖的package包/类
private LatLngBounds getBounds(List<LatLng> pointsList) {
    LatLngBounds.Builder builder = new LatLngBounds.Builder();
    for (LatLng point : pointsList) {
        builder.include(point);
    }
    return builder.build();
}
 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:8,代码来源:BaiduMapFragment.java

示例8: zoomToFit

import com.baidu.mapapi.model.LatLngBounds; //导入依赖的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

示例9: onGetSearchResult

import com.baidu.mapapi.model.LatLngBounds; //导入依赖的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

示例10: calcRadius

import com.baidu.mapapi.model.LatLngBounds; //导入依赖的package包/类
private void calcRadius() {
	LatLngBounds bounds = mBaiduMap.getMapStatus().bound;
	LatLng NE = bounds.northeast;
	LatLng SW = bounds.southwest;
	double neDis = DistanceUtil.getDistance(curMapCenterLatLng, NE);
	double swDis = DistanceUtil.getDistance(curMapCenterLatLng, SW);
	radius = Math.min(neDis, swDis);
}
 
开发者ID:poomoo,项目名称:eDao,代码行数:9,代码来源:MapActivity.java

示例11: onClick

import com.baidu.mapapi.model.LatLngBounds; //导入依赖的package包/类
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.back:
            onBackPressed();
            break;
        case R.id.share:
            View view = getLayoutInflater().inflate(R.layout.dialog_share, null);
            view.findViewById(R.id.share_weixin).setOnClickListener(this);
            view.findViewById(R.id.share_pengyouquan).setOnClickListener(this);
            AlertDialog.Builder builder = new Builder(this);
            builder.setTitle(R.string.share_to);
            builder.setView(view);
            builder.setPositiveButton(R.string.cancel, null);
            mDialog = builder.show();
            break;
        case R.id.share_weixin:
            shareBitmap(R.id.share_weixin);
            mDialog.dismiss();
            break;
        case R.id.share_pengyouquan:
            shareBitmap(R.id.share_pengyouquan);
            mDialog.dismiss();
            break;
        case R.id.zoom_in:
            if (mMapView.getMap().getMapStatus().zoom != mMapView.getMap().getMaxZoomLevel())
                mMapView.getMap().animateMapStatus(MapStatusUpdateFactory.zoomIn());
            break;
        case R.id.zoom_out:
            if (mMapView.getMap().getMapStatus().zoom != mMapView.getMap().getMinZoomLevel())
                mMapView.getMap().animateMapStatus(MapStatusUpdateFactory.zoomOut());
            break;
        case R.id.view_all:
            if (mBounds == null) {
                LatLngBounds.Builder boundsBuilder = new LatLngBounds.Builder();
                for (LatLng latLng : mRoutePoints) {
                    boundsBuilder.include(latLng);
                }
                mBounds = boundsBuilder.build();
            }
            MapViewUtils.zoomByLatLngBounds(mMapView, mBounds, true);
            break;
        case R.id.go_start:
            MapViewUtils.moveToLatLng(mMapView, mRouteData.getBeginLatlng(), true);
            break;
        case R.id.go_end:
            MapViewUtils.moveToLatLng(mMapView, mRouteData.getEndLatlng(), true);
            break;
    }
}
 
开发者ID:iWay7,项目名称:BikeHelper,代码行数:50,代码来源:RouteViewActivity.java

示例12: drawHistoryTrack

import com.baidu.mapapi.model.LatLngBounds; //导入依赖的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

示例13: isMarkerInBounds

import com.baidu.mapapi.model.LatLngBounds; //导入依赖的package包/类
public static Boolean isMarkerInBounds(LatLng latLng, LatLngBounds bounds) {
	if (bounds.contains(latLng))
		return true;
	return false;
}
 
开发者ID:poomoo,项目名称:eDao,代码行数:6,代码来源:Utity.java


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