本文整理汇总了Java中com.baidu.mapapi.map.MapStatus.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java MapStatus.Builder方法的具体用法?Java MapStatus.Builder怎么用?Java MapStatus.Builder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.baidu.mapapi.map.MapStatus
的用法示例。
在下文中一共展示了MapStatus.Builder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cancelBook
import com.baidu.mapapi.map.MapStatus; //导入方法依赖的package包/类
private void cancelBook() {
countDownTimer.cancel();
bike_layout.setVisibility(View.GONE);
bike_info_layout.setVisibility(View.GONE);
confirm_cancel_layout.setVisibility(View.GONE);
prompt.setVisibility(View.GONE);
bike_distance_layout.setVisibility(View.VISIBLE);
bike_distance_layout.setVisibility(View.VISIBLE);
book_bt.setVisibility(View.VISIBLE);
if (routeOverlay != null)
routeOverlay.removeFromMap();
MapStatus.Builder builder = new MapStatus.Builder();
//地图缩放比设置为18
builder.target(currentLL).zoom(18.0f);
mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
}
示例2: onReceiveLocation
import com.baidu.mapapi.map.MapStatus; //导入方法依赖的package包/类
@Override
public void onReceiveLocation(BDLocation location) {
// map view 销毁后不在处理新接收的位置
if (location == null || mMapView == null) {
return;
}
mCurrentLat = location.getLatitude();
mCurrentLon = location.getLongitude();
mCurrentAccracy = location.getRadius();
locData = new MyLocationData.Builder()
.accuracy(location.getRadius())
// 此处设置开发者获取到的方向信息,顺时针0-360
.direction(mCurrentDirection).latitude(location.getLatitude())
.longitude(location.getLongitude()).build();
mBaiduMap.setMyLocationData(locData);
if (isFirstLoc) {
isFirstLoc = false;
LatLng ll = new LatLng(location.getLatitude(),
location.getLongitude());
MapStatus.Builder builder = new MapStatus.Builder();
builder.target(ll).zoom(18.0f);
mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
}
}
示例3: onCreate
import com.baidu.mapapi.map.MapStatus; //导入方法依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_routeplan);
mTvtitle = (TextView) findViewById(R.id.tv_topbar_title);
mTvtitle.setText("财神谷地址");
ImageView img = (ImageView) findViewById(R.id.img_topbar_back);
img.setImageResource(R.mipmap.icon_back);
img.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
RoutePlanDemo.this.finish();
}
});
// mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);//获取传感器管理服务
// 初始化地图
mMapView = (MapView) findViewById(R.id.map);
mBaidumap = mMapView.getMap();
MapStatus.Builder builder = new MapStatus.Builder();
builder.zoom(18.0f);
builder.target(new LatLng(29.184662, 121.305024));
mMapStatusUpdate = MapStatusUpdateFactory.newMapStatus(builder.build());
mBaidumap.setMapStatus(mMapStatusUpdate);
MarkerOptions ooA = new MarkerOptions().position(GEO_NINGBO).icon(bdA)
.zIndex(9).draggable(true);
mBaidumap.addOverlay(ooA);
mBaidumap.setTrafficEnabled(true);
findViewById(R.id.lin_action_route).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
go2ThirdMap();
}
});
}
示例4: cancelBook
import com.baidu.mapapi.map.MapStatus; //导入方法依赖的package包/类
private void cancelBook() {
if (isNeedLogin) {
mLogin.setVisibility(View.VISIBLE);
} else {
mLogin.setVisibility(View.GONE);
}
mBikeInfoBoard.setVisibility(View.GONE);
countDownTimer.cancel();
mBikeOrderBoard.setVisibility(View.GONE);
// confirm_cancel_layout.setVisibility(View.GONE);
// prompt.setVisibility(View.GONE);
// bike_distance_layout.setVisibility(View.VISIBLE);
// bike_distance_layout.setVisibility(View.VISIBLE);
mBtLoginOrorder.setVisibility(View.VISIBLE);
if (routeOverlay != null)
routeOverlay.removeFromMap();
MapStatus.Builder builder = new MapStatus.Builder();
//地图缩放比设置为18
builder.target(currentLL).zoom(18.0f);
baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
}
示例5: onReceiveLocation
import com.baidu.mapapi.map.MapStatus; //导入方法依赖的package包/类
@Override
public void onReceiveLocation(BDLocation location) {
// map view 销毁后不在处理新接收的位置
if (location == null || mMapView == null) {
return;
}
MyLocationData locData = new MyLocationData.Builder()
.accuracy(location.getRadius())
// 此处设置开发者获取到的方向信息,顺时针0-360
.direction(100).latitude(location.getLatitude())
.longitude(location.getLongitude()).build();
mBaiduMap.setMyLocationData(locData);
if (isFirstLoc) {
isFirstLoc = false;
LatLng ll = new LatLng(location.getLatitude(),
location.getLongitude());
applicate=(Myapplication)getApplication();
applicate.setLon(location.getLongitude());
applicate.setLat(location.getLatitude());
MapStatus.Builder builder = new MapStatus.Builder();
builder.target(ll).zoom(18.0f);
mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
}
}
示例6: setMapView
import com.baidu.mapapi.map.MapStatus; //导入方法依赖的package包/类
private void setMapView() {
BaiduMapOptions options = new BaiduMapOptions();
options.compassEnabled(false);
options.overlookingGesturesEnabled(false);
options.rotateGesturesEnabled(false);
options.scaleControlEnabled(true);
options.zoomControlsEnabled(false);
MapStatus.Builder status = new MapStatus.Builder();
if (Config.Zoom > Float.NEGATIVE_INFINITY)
status.zoom(Config.Zoom);
if (Config.Latitude > Double.NEGATIVE_INFINITY && Config.Longitude > Double.NEGATIVE_INFINITY)
status.target(new LatLng(Config.Latitude, Config.Longitude));
options.mapStatus(status.build());
mMapView = new MapView(this, options);
mMapView.getMap().setMyLocationEnabled(true);
mMapView.getMap().setBuildingsEnabled(false);
mMapView.getMap().setOnMapStatusChangeListener(this);
MapViewUtils.initViewPositions(mMapView);
MapViewUtils.addMapView(this, mMapView);
}
示例7: loadCameraPosition
import com.baidu.mapapi.map.MapStatus; //导入方法依赖的package包/类
@Override
public void loadCameraPosition() {
final BaiduMap map = getBaiduMap();
if (map == null) return;
final SharedPreferences settings = mAppPrefs.prefs;
final MapStatus.Builder camera = new MapStatus.Builder();
camera.rotate(settings.getFloat(PREF_BEA, DEFAULT_BEARING));
camera.overlook(settings.getFloat(PREF_TILT, DEFAULT_TILT));
camera.zoom(settings.getFloat(PREF_ZOOM, DEFAULT_ZOOM_LEVEL));
camera.target(new LatLng(settings.getFloat(PREF_LAT, DEFAULT_LATITUDE),
settings.getFloat(PREF_LNG, DEFAULT_LONGITUDE)));
map.setMapStatus(MapStatusUpdateFactory.newMapStatus(camera.build()));
}
示例8: onReceiveLocation
import com.baidu.mapapi.map.MapStatus; //导入方法依赖的package包/类
@Override
public void onReceiveLocation(BDLocation location) {
// map view 销毁后不在处理新接收的位置
if (location == null || mapView == null) {
return;
}
tvLocation.setText(location.getAddrStr());
MyLocationData locData = new MyLocationData.Builder()
.accuracy(location.getRadius())
// 此处设置开发者获取到的方向信息,顺时针0-360
.direction(100).latitude(location.getLatitude())
.longitude(location.getLongitude()).build();
mBaiduMap.setMyLocationData(locData);
if (isFirstLoc) {
isFirstLoc = false;
LatLng ll = new LatLng(location.getLatitude(),
location.getLongitude());
MapStatus.Builder builder = new MapStatus.Builder();
builder.target(ll).zoom(18.0f);
mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
}
}
示例9: changeRouteIcon
import com.baidu.mapapi.map.MapStatus; //导入方法依赖的package包/类
/**
* 切换路线图标,刷新地图使其生效
* 注意: 起终点图标使用中心对齐.
*/
public void changeRouteIcon(View v) {
if (useDefaultIcon) {
((Button) v).setText("跟随");
follow=true;
LatLng ll = new LatLng(nowLocation.getLatitude(),
nowLocation.getLongitude());
MapStatus.Builder builder = new MapStatus.Builder();
builder.target(ll).zoom(21.0f);
mBaidumap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
} else {
((Button) v).setText("不跟随");
follow=false;
}
useDefaultIcon = !useDefaultIcon;
/*
routeOverlay.removeFromMap();
routeOverlay.addToMap();*/
}
示例10: onReceiveLocation
import com.baidu.mapapi.map.MapStatus; //导入方法依赖的package包/类
@Override
public void onReceiveLocation(BDLocation bdLocation) {
// map view 销毁后不在处理新接收的位置
if (bdLocation == null || mMapView == null) {
return;
}
MyLocationData locData = new MyLocationData.Builder()
.accuracy(bdLocation.getRadius())
.direction(mCurrentX)//设定图标方向 // 此处设置开发者获取到的方向信息,顺时针0-360
.latitude(bdLocation.getLatitude())
.longitude(bdLocation.getLongitude()).build();
mBaiduMap.setMyLocationData(locData);
currentLatitude = bdLocation.getLatitude();
currentLongitude = bdLocation.getLongitude();
current_addr.setText(bdLocation.getAddrStr());
currentLL = new LatLng(bdLocation.getLatitude(),
bdLocation.getLongitude());
LocationManager.getInstance().setCurrentLL(currentLL);
LocationManager.getInstance().setAddress(bdLocation.getAddrStr());
startNodeStr = PlanNode.withLocation(currentLL);
//option.setScanSpan(5000),每隔5000ms这个方法就会调用一次,而有些我们只想调用一次,所以要判断一下isFirstLoc
if (isFirstLoc) {
isFirstLoc = false;
LatLng ll = new LatLng(bdLocation.getLatitude(),
bdLocation.getLongitude());
MapStatus.Builder builder = new MapStatus.Builder();
//地图缩放比设置为18
builder.target(ll).zoom(18.0f);
mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
changeLatitude = bdLocation.getLatitude();
changeLongitude = bdLocation.getLongitude();
if (!isServiceLive) {
addOverLayout(currentLatitude, currentLongitude);
}
}
}
示例11: setPoiPosition
import com.baidu.mapapi.map.MapStatus; //导入方法依赖的package包/类
/**
* 设置地图比例,保证所有poi点可视
**/
private void setPoiPosition() {
if (aList.size() == 0 || poiOverlay == null)
return;
if (aList.size() == 1) {
MapStatus.Builder builder = new MapStatus.Builder();
builder.target(new LatLng(aList.get(0).getLatitude(), aList.get(0).getLongitude()))
.targetScreen(new Point(baiduMap.getMapStatus().targetScreen.x, baiduMap.getMapStatus().targetScreen.y / 4))
.zoom(17F);
baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
} else
poiOverlay.zoomToSpan();
}
示例12: setPoiPosition
import com.baidu.mapapi.map.MapStatus; //导入方法依赖的package包/类
/**
* 设置检索结果显示索引(若有多个结果则地图缩放到保证所有结果可见)
**/
private void setPoiPosition() {
if (aList.size() == 0 || poiOverlay == null)
return;
if (aList.size() == 1) {
MapStatus.Builder builder = new MapStatus.Builder();
builder.target(new LatLng(aList.get(0).getLatitude(), aList.get(0).getLongitude()))
.targetScreen(new Point(baiduMap.getMapStatus().targetScreen.x, baiduMap.getMapStatus().targetScreen.y / 4))
.zoom(17F);
baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
} else
poiOverlay.zoomToSpan();
}
示例13: setPoiPosition
import com.baidu.mapapi.map.MapStatus; //导入方法依赖的package包/类
private void setPoiPosition() {
if (aList.size() == 0 || poiOverlay == null)
return;
if (aList.size() == 1) {
MapStatus.Builder builder = new MapStatus.Builder();
builder.target(new LatLng(aList.get(0).getLatitude(), aList.get(0).getLongitude()))
.targetScreen(new Point(baiduMap.getMapStatus().targetScreen.x, baiduMap.getMapStatus().targetScreen.y / 4))
.zoom(17F);
baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
} else
poiOverlay.zoomToSpan();
}
示例14: onReceiveLocation
import com.baidu.mapapi.map.MapStatus; //导入方法依赖的package包/类
@Override
public void onReceiveLocation(BDLocation location) {
if (null != location && location.getLocType() != BDLocation.TypeServerError) {
mLatitude = location.getLatitude();
mLongitude = location.getLongitude();
mNearbyPersonPresenter.getNearbyPersons(mUserId,String.valueOf(mLongitude),String.valueOf(mLatitude),mSex);
mBaiduMap.clear();
mBaiduMap.setMyLocationEnabled(false);
//停止定位服务
mLocationService.stop();
//需要将mitems中的数据清空
if (mItems != null && mItems.size() > 0) {
mItems.clear();
}
//第一次定位到当前的位置
// 显示到定位的地方
//为了取消定位蓝点,设置了setMyLocationEnabled(false),所以下面的代码实际上不起作用
LatLng ll = new LatLng(location.getLatitude(),
location.getLongitude());
MapStatus.Builder builder = new MapStatus.Builder();
builder.target(ll).zoom(16.0f);
mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()), 300);
} else {
//定位失败就不继续定位了
// Toast.makeText(getActivity(), "定位失败,失败码是:" + location.getLocType(), Toast.LENGTH_SHORT).show();
Log.d("----", "onReceiveLocation: 定位失败,失败码是:"+location.getLocType());
}
}
示例15: onReceiveLocation
import com.baidu.mapapi.map.MapStatus; //导入方法依赖的package包/类
@Override
public void onReceiveLocation(BDLocation bdLocation) {
if (bdLocation == null || baiduMap == null) {
return;
}
mBDLocation = bdLocation;
MyLocationData locData = new MyLocationData.Builder()
.accuracy(bdLocation.getRadius())
.direction(mCurrentX)//设定图标方向 // 此处设置开发者获取到的方向信息,顺时针0-360
.latitude(bdLocation.getLatitude())
.longitude(bdLocation.getLongitude()).build();
if (isNeedCurrentlocation)
baiduMap.setMyLocationData(locData);
currentLatitude = bdLocation.getLatitude();
currentLongitude = bdLocation.getLongitude();
mTvLocationInfo.setText(bdLocation.getAddrStr());
currentLL = new LatLng(bdLocation.getLatitude(),
bdLocation.getLongitude());
MyLocationManager.getInstance().setCurrentLL(currentLL);
MyLocationManager.getInstance().setAddress(bdLocation.getAddrStr());
startNodeStr = PlanNode.withLocation(currentLL);
//option.setScanSpan(5000),每隔5000ms这个方法就会调用一次,而有些我们只想调用一次,所以要判断一下isFirstLoc
if (isFirstLocation) {
isFirstLocation = false;
LatLng ll = new LatLng(bdLocation.getLatitude(),
bdLocation.getLongitude());
MapStatus.Builder builder = new MapStatus.Builder();
//地图缩放比设置为18
builder.target(ll).zoom(18.0f);
baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
changeLatitude = bdLocation.getLatitude();
changeLongitude = bdLocation.getLongitude();
if (!isServiceLive) {
addOverLayout(currentLatitude, currentLongitude);
}
}
}