use of com.baidu.mapapi.map.MapStatusUpdate in project SmartCampus by Vegen.
the class EaseBaiduMapActivity method showMap.
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);
}
use of com.baidu.mapapi.map.MapStatusUpdate in project SmartCampus by Vegen.
the class EaseBaiduMapActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
instance = this;
// initialize SDK with context, should call this before setContentView
SDKInitializer.initialize(getApplicationContext());
setContentView(R.layout.ease_activity_baidumap);
mMapView = (MapView) findViewById(R.id.bmapView);
sendButton = (Button) findViewById(R.id.btn_location_send);
Intent intent = getIntent();
double latitude = intent.getDoubleExtra("latitude", 0);
LocationMode mCurrentMode = LocationMode.NORMAL;
mBaiduMap = mMapView.getMap();
MapStatusUpdate msu = MapStatusUpdateFactory.zoomTo(15.0f);
mBaiduMap.setMapStatus(msu);
initMapView();
if (latitude == 0) {
mMapView = new MapView(this, new BaiduMapOptions());
mBaiduMap.setMyLocationConfigeration(new MyLocationConfiguration(mCurrentMode, true, null));
showMapWithLocationClient();
} else {
double longtitude = intent.getDoubleExtra("longitude", 0);
String address = intent.getStringExtra("address");
LatLng p = new LatLng(latitude, longtitude);
mMapView = new MapView(this, new BaiduMapOptions().mapStatus(new MapStatus.Builder().target(p).build()));
showMap(latitude, longtitude, address);
}
IntentFilter iFilter = new IntentFilter();
iFilter.addAction(SDKInitializer.SDK_BROADTCAST_ACTION_STRING_PERMISSION_CHECK_ERROR);
iFilter.addAction(SDKInitializer.SDK_BROADCAST_ACTION_STRING_NETWORK_ERROR);
mBaiduReceiver = new BaiduSDKReceiver();
registerReceiver(mBaiduReceiver, iFilter);
}
use of com.baidu.mapapi.map.MapStatusUpdate in project KL2 by jweihao.
the class BaiduActivity method navigateTo.
private void navigateTo(BDLocation location) {
if (isFirstLocate) {
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
MapStatusUpdate update = MapStatusUpdateFactory.newLatLng(latLng);
mBaiduMap.animateMapStatus(update);
update = MapStatusUpdateFactory.zoomTo(16f);
mBaiduMap.animateMapStatus(update);
isFirstLocate = false;
}
MyLocationData.Builder locationBuilder = new MyLocationData.Builder();
locationBuilder.latitude(location.getLatitude());
locationBuilder.longitude(location.getLatitude());
MyLocationData myLocationData = locationBuilder.build();
mBaiduMap.setMyLocationData(myLocationData);
}
use of com.baidu.mapapi.map.MapStatusUpdate in project AndroidStudy by tinggengyan.
the class BaiduMapUtil method setZoom.
public void setZoom(float zoom) {
if (zoom < minZoom | zoom > maxZoom) {
return;
}
MapStatus currentMapStatus = this.mBaiduMap.getMapStatus();
float currentZoom = currentMapStatus.zoom;
if (currentZoom != zoom) {
MapStatus.Builder builder = new MapStatus.Builder();
MapStatus mapStatus = builder.zoom(zoom).build();
MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.newMapStatus(mapStatus);
this.mBaiduMap.animateMapStatus(mapStatusUpdate);
}
}
use of com.baidu.mapapi.map.MapStatusUpdate in project wechat by motianhuo.
the class BaiduMapActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
instance = this;
// 在使用SDK各组件之前初始化context信息,传入ApplicationContext
// 注意该方法要再setContentView方法之前实现
SDKInitializer.initialize(getApplicationContext());
setContentView(R.layout.activity_baidumap);
mMapView = (MapView) findViewById(R.id.bmapView);
txt_right = (TextView) findViewById(R.id.txt_right);
txt_right.setText("发送");
txt_right.setVisibility(View.VISIBLE);
txt_title = (TextView) findViewById(R.id.txt_title);
txt_title.setText("位置");
img_back = (ImageView) findViewById(R.id.img_back);
img_back.setVisibility(View.VISIBLE);
Intent intent = getIntent();
double latitude = intent.getDoubleExtra("latitude", 0);
mCurrentMode = LocationMode.NORMAL;
mBaiduMap = mMapView.getMap();
mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL);
mBaiduMap.setMyLocationEnabled(true);
MapStatusUpdate msu = MapStatusUpdateFactory.zoomTo(15.0f);
mBaiduMap.setMapStatus(msu);
initMapView();
if (latitude == 0) {
BaiduMapOptions mapoption = new BaiduMapOptions();
mMapView = new MapView(this, mapoption);
mBaiduMap.setMyLocationConfigeration(new MyLocationConfiguration(mCurrentMode, true, null));
showMapWithLocationClient();
} else {
double longtitude = intent.getDoubleExtra("longitude", 0);
String address = intent.getStringExtra("address");
LatLng p = new LatLng(latitude, longtitude);
mMapView = new MapView(this, new BaiduMapOptions().mapStatus(new MapStatus.Builder().target(p).build()));
showMap(latitude, longtitude, address);
}
// 注册 SDK 广播监听者
IntentFilter iFilter = new IntentFilter();
iFilter.addAction(SDKInitializer.SDK_BROADTCAST_ACTION_STRING_PERMISSION_CHECK_ERROR);
iFilter.addAction(SDKInitializer.SDK_BROADCAST_ACTION_STRING_NETWORK_ERROR);
mBaiduReceiver = new BaiduSDKReceiver();
registerReceiver(mBaiduReceiver, iFilter);
initClick();
}
Aggregations