本文整理匯總了Java中com.baidu.location.BDLocation.getDerect方法的典型用法代碼示例。如果您正苦於以下問題:Java BDLocation.getDerect方法的具體用法?Java BDLocation.getDerect怎麽用?Java BDLocation.getDerect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.baidu.location.BDLocation
的用法示例。
在下文中一共展示了BDLocation.getDerect方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onReceiveLocation
import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location) {
if (location == null)
return ;
Intent intent = new Intent();
intent.setAction("com.hit.changyou");
intent.putExtra("city",location.getCity() );
BaiduMapActivity.this.sendBroadcast(intent);
locData.latitude = location.getLatitude();
locData.longitude = location.getLongitude();
locData.accuracy = location.getRadius();
locData.direction = location.getDerect();
myLocationOverlay.setData(locData);
mMapView.refresh();
Log.i("yxy", locData.latitude+";"+locData.longitude);
//定位預留
if (app.cityString.equals("")) {
mMapController.animateTo(new GeoPoint((int)(locData.latitude* 1e6), (int)(locData.longitude * 1e6)));
}
}
示例2: onReceiveLocation
import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location) {
if (location == null)
return ;
locData.latitude = location.getLatitude();
locData.longitude = location.getLongitude();
//如果不顯示定位精度圈,將accuracy賦值為0即可
locData.accuracy = location.getRadius();
locData.direction = location.getDerect();
//更新圖層數據執行刷新後生效
mMapView.refresh();
}
示例3: onReceiveLocation
import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location) {
// TODO Auto-generated method stub
if (location == null)
return;
StringBuffer sb = new StringBuffer(256);
sb.append("time : ");
sb.append(location.getTime());
sb.append("\nerror code : ");
sb.append(location.getLocType());
sb.append("\nlatitude : ");
sb.append(location.getLatitude());
sb.append("\nlontitude : ");
sb.append(location.getLongitude());
sb.append("\nradius : ");
sb.append(location.getRadius());
if (location.getLocType() == BDLocation.TypeGpsLocation) {
sb.append("\nspeed : ");
sb.append(location.getSpeed());
sb.append("\nsatellite : ");
sb.append(location.getSatelliteNumber());
} else if (location.getLocType() == BDLocation.TypeNetWorkLocation) {
sb.append("\naddr : ");
sb.append(location.getAddrStr());
}
Log.d("lbs message:", sb.toString());
mywd = location.getLatitude();
myjd = location.getLongitude();
locData.latitude = location.getLatitude();
locData.longitude = location.getLongitude();
// �������ʾ��λ����Ȧ����accuracy��ֵΪ0����
locData.accuracy = location.getRadius();
// �˴��������� locData�ķ�����Ϣ, �����λ SDK δ���ط�����Ϣ���û������Լ�ʵ�����̹�����ӷ�����Ϣ��
locData.direction = location.getDerect();
// locData.direction = 2.0f;
// ���¶�λ����
myLocationOverlay.setData(locData);
// ����ͼ������ִ��ˢ�º���Ч
mMapView.refresh();
// ���ֶ�����������״ζ�λʱ���ƶ�����λ��
if (isRequest || isFirstLoc) {
// �ƶ���ͼ����λ��
Log.d("LocationOverlay", "receive location, animate to it");
mMapController.animateTo(new GeoPoint(
(int) (locData.latitude * 1e6),
(int) (locData.longitude * 1e6)));
isRequest = false;
myLocationOverlay.setLocationMode(LocationMode.FOLLOWING);
}
// �״ζ�λ���
isFirstLoc = false;
}
示例4: onReceiveLocation
import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location) {
// TODO Auto-generated method stub
if (location == null)
return;
StringBuffer sb = new StringBuffer(256);
sb.append("time : ");
sb.append(location.getTime());
sb.append("\nerror code : ");
sb.append(location.getLocType());
sb.append("\nlatitude : ");
sb.append(location.getLatitude());
sb.append("\nlontitude : ");
sb.append(location.getLongitude());
sb.append("\nradius : ");
sb.append(location.getRadius());
if (location.getLocType() == BDLocation.TypeGpsLocation) {
sb.append("\nspeed : ");
sb.append(location.getSpeed());
sb.append("\nsatellite : ");
sb.append(location.getSatelliteNumber());
} else if (location.getLocType() == BDLocation.TypeNetWorkLocation) {
sb.append("\naddr : ");
sb.append(location.getAddrStr());
}
Log.d("lbs message:", sb.toString());
locData.latitude = location.getLatitude();
locData.longitude = location.getLongitude();
addr = location.getAddrStr();
// �������ʾ��λ����Ȧ����accuracy��ֵΪ0����
locData.accuracy = location.getRadius();
// �˴��������� locData�ķ�����Ϣ, �����λ SDK δ���ط�����Ϣ���û������Լ�ʵ�����̹�����ӷ�����Ϣ��
locData.direction = location.getDerect();
// locData.direction = 2.0f;
// ���¶�λ����
myLocationOverlay.setData(locData);
// ����ͼ������ִ��ˢ�º���Ч
mMapView.refresh();
// ���ֶ�����������״ζ�λʱ���ƶ�����λ��
if (isRequest || isFirstLoc) {
// �ƶ���ͼ����λ��
Log.d("LocationOverlay", "receive location, animate to it");
mMapController.animateTo(new GeoPoint(
(int) (locData.latitude * 1e6),
(int) (locData.longitude * 1e6)));
isRequest = false;
myLocationOverlay.setLocationMode(LocationMode.FOLLOWING);
}
// �״ζ�λ���
isFirstLoc = false;
}
示例5: onReceiveLocation
import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location) {
if (location == null)
return;
// locData.latitude = location.getLatitude();
// locData.longitude = location.getLongitude();
// // 如果不顯示定位精度圈,將accuracy賦值為0即可
// locData.accuracy = location.getRadius();
// // 此處可以設置 locData的方向信息, 如果定位 SDK
// // 未返回方向信息,用戶可以自己實現羅盤功能添加方向信息。
// locData.direction = location.getDerect();
// // 更新定位數據
// myLocationOverlay.setData(locData);
// // 更新圖層數據執行刷新後生效
// mMapView.refresh();
// // 是手動觸發請求或首次定位時,移動到定位點
// // if (isFirstLoc){
// // 移動地圖到定位點
// Log.d("LocationOverlay", "receive location, animate to it");
// locationPoint = new GeoPoint((int) (locData.latitude * 1e6),
// (int) (locData.longitude * 1e6));
// mMapView.getController().animateTo(locationPoint);
// mSearch.reverseGeocode(locationPoint);
locData.latitude = location.getLatitude();
locData.longitude = location.getLongitude();
//如果不顯示定位精度圈,將accuracy賦值為0即可
locData.accuracy = location.getRadius();
// 此處可以設置 locData的方向信息, 如果定位 SDK 未返回方向信息,用戶可以自己實現羅盤功能添加方向信息。
locData.direction = location.getDerect();
double tmpLongtitude = location.getLongitude();
double tmpLatitude = location.getLatitude();
longtitude = tmpLongtitude;
latitude = tmpLatitude;
//更新定位數據
myLocationOverlay.setData(locData);
//更新圖層數據執行刷新後生效
mMapView.refresh();
//是手動觸發請求或首次定位時,移動到定位點
locationPoint = new GeoPoint((int)(locData.latitude* 1e6), (int)(locData.longitude * 1e6));
if (isRequest || isFirstLoc){
//移動地圖到定位點
Log.d("LocationOverlay", "receive location, animate to it");
mMapController.animateTo(locationPoint);
isRequest = false;
myLocationOverlay.setLocationMode(LocationMode.FOLLOWING);
// myLocationOverlay.setData(locData);
mSearch.reverseGeocode(locationPoint);
}
mSearch.reverseGeocode(locationPoint);
//首次定位完成
isFirstLoc = false;
// }
// 首次定位完成
// isFirstLoc = false;
}