Java Code Examples for com.baidu.mapapi.utils.CoordinateConverter#from()

The following examples show how to use com.baidu.mapapi.utils.CoordinateConverter#from() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EaseBaiduMapActivity.java    From Social with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 2
Source File: EaseBaiduMapActivity.java    From Social with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceiveLocation(BDLocation location) {
	if (location == null) {
		return;
	}
	Log.d("map", "On location change received:" + location);
	Log.d("map", "addr:" + location.getAddrStr());
	sendButton.setEnabled(true);
	if (progressDialog != null) {
		progressDialog.dismiss();
	}

	if (lastLocation != null) {
		if (lastLocation.getLatitude() == location.getLatitude() && lastLocation.getLongitude() == location.getLongitude()) {
			Log.d("map", "same location, skip refresh");
			// mMapView.refresh(); //need this refresh?
			return;
		}
	}
	lastLocation = location;
	mBaiduMap.clear();
	LatLng llA = new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude());
	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);
}
 
Example 3
Source File: EaseBaiduMapActivity.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 4
Source File: EaseBaiduMapActivity.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceiveLocation(BDLocation location) {
	if (location == null) {
		return;
	}
	Log.d("map", "On location change received:" + location);
	Log.d("map", "addr:" + location.getAddrStr());
	sendButton.setEnabled(true);
	if (progressDialog != null) {
		progressDialog.dismiss();
	}

	if (lastLocation != null) {
		if (lastLocation.getLatitude() == location.getLatitude() && lastLocation.getLongitude() == location.getLongitude()) {
			Log.d("map", "same location, skip refresh");
			// mMapView.refresh(); //need this refresh?
			return;
		}
	}
	lastLocation = location;
	mBaiduMap.clear();
	LatLng llA = new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude());
	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);
}
 
Example 5
Source File: GeolocationModule.java    From react-native-baidu-map with MIT License 5 votes vote down vote up
/**
 *
 * @param sourceLatLng
 * @return
 */
protected LatLng getBaiduCoorFromGPSCoor(LatLng sourceLatLng) {
    CoordinateConverter converter = new CoordinateConverter();
    converter.from(CoordinateConverter.CoordType.GPS);
    converter.coord(sourceLatLng);
    LatLng desLatLng = converter.convert();
    return desLatLng;

}
 
Example 6
Source File: BaiduMapActivity.java    From FanXin-based-HuanXin with GNU General Public License v2.0 5 votes vote down vote up
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.icon_marka))
			.zIndex(4).draggable(true);
	mBaiduMap.addOverlay(ooA);
	MapStatusUpdate u = MapStatusUpdateFactory.newLatLngZoom(convertLatLng, 17.0f);
	mBaiduMap.animateMapStatus(u);
}
 
Example 7
Source File: BaiduMapActivity.java    From FanXin-based-HuanXin with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onReceiveLocation(BDLocation location) {
	if (location == null) {
		return;
	}
	Log.d("map", "On location change received:" + location);
	Log.d("map", "addr:" + location.getAddrStr());
	sendButton.setEnabled(true);
	if (progressDialog != null) {
		progressDialog.dismiss();
	}

	if (lastLocation != null) {
		if (lastLocation.getLatitude() == location.getLatitude() && lastLocation.getLongitude() == location.getLongitude()) {
			Log.d("map", "same location, skip refresh");
			// mMapView.refresh(); //need this refresh?
			return;
		}
	}
	lastLocation = location;
	mBaiduMap.clear();
	LatLng llA = new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude());
	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.icon_marka))
			.zIndex(4).draggable(true);
	mBaiduMap.addOverlay(ooA);
	MapStatusUpdate u = MapStatusUpdateFactory.newLatLngZoom(convertLatLng, 17.0f);
	mBaiduMap.animateMapStatus(u);
}