本文整理汇总了Java中com.baidu.mapapi.model.LatLngBounds.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java LatLngBounds.Builder方法的具体用法?Java LatLngBounds.Builder怎么用?Java LatLngBounds.Builder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.baidu.mapapi.model.LatLngBounds
的用法示例。
在下文中一共展示了LatLngBounds.Builder方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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()));
}
}
示例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()));
}
}
示例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()));
}
}
示例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()));
}
}
示例5: 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();
}
示例6: 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);
}
}
}
示例7: 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;
}
}