當前位置: 首頁>>代碼示例>>Java>>正文


Java BDLocation.getLatitude方法代碼示例

本文整理匯總了Java中com.baidu.location.BDLocation.getLatitude方法的典型用法代碼示例。如果您正苦於以下問題:Java BDLocation.getLatitude方法的具體用法?Java BDLocation.getLatitude怎麽用?Java BDLocation.getLatitude使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.baidu.location.BDLocation的用法示例。


在下文中一共展示了BDLocation.getLatitude方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: navigateTo

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
/**
 * des:地圖跳到指定位置
 *
 * @param location
 */
private void navigateTo(BDLocation location) {
    if (isFirstLocation) {
        LatLng ll = new LatLng(location.getLatitude(), location.getLongitude());
        MapStatusUpdate update = MapStatusUpdateFactory.newLatLng(ll);
        baiduMap.animateMapStatus(update);
        update = MapStatusUpdateFactory.zoomTo(18f);
        baiduMap.animateMapStatus(update);
        isFirstLocation = false;
    }
    MyLocationData.Builder builder = new MyLocationData.Builder();
    builder.latitude(location.getLatitude());
    builder.longitude(location.getLongitude());
    MyLocationData data = builder.build();
    baiduMap.setMyLocationData(data);
}
 
開發者ID:yiwent,項目名稱:Mobike,代碼行數:21,代碼來源:MainActivity.java

示例2: navigateTo

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
public void navigateTo(BDLocation location){
    if(isFirstLocate){
        LatLng latLng=new LatLng(location.getLatitude(),location.getLongitude());
        showToast("定位到當前位置已執行");

        MapStatusUpdate    update=MapStatusUpdateFactory.zoomTo(8f);
        baiduMap.animateMapStatus(update);
        update= MapStatusUpdateFactory.newLatLng(latLng);
        baiduMap.animateMapStatus(update);

       isFirstLocate=false;
    }
    MyLocationData.Builder locationBuilder=new MyLocationData.Builder();
    locationBuilder.latitude(location.getLatitude());
    locationBuilder.longitude(location.getLongitude());
    baiduMap.setMyLocationData(locationBuilder.build());

}
 
開發者ID:MoonRiser,項目名稱:MaterialLearning,代碼行數:19,代碼來源:BaiduMapActivity.java

示例3: onReceiveLocation

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation bdLocation) {
    mLastLocationData=bdLocation;
    MyLocationData myLocationData=new MyLocationData.Builder()
            .accuracy(bdLocation.getRadius())
            .latitude(bdLocation.getLatitude())
            .longitude(bdLocation.getLongitude())
            .build();
    mBaiduMap.setMyLocationData(myLocationData);
    MapStatusUpdate msu1 = MapStatusUpdateFactory.zoomTo(15.0f);
    mBaiduMap.setMapStatus(msu1);

    if(isFirstIn){
        LatLng ll=new LatLng(bdLocation.getLatitude(),bdLocation.getLongitude());
        MapStatusUpdate msu=MapStatusUpdateFactory.newLatLng(ll);
        mBaiduMap.setMapStatus(msu);
        isFirstIn=false;
    }
}
 
開發者ID:organizationAllink,項目名稱:wzyx-android-user,代碼行數:20,代碼來源:BaiduMapActivity.java

示例4: onReceiveLocation

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location){
    latitude = location.getLatitude();
    longitude = location.getLongitude();
    Log.d(TAG, "onReceiveLocation: "+latitude+" "+longitude);
    city = location.getCity();
    if(city != null){
        Log.d(TAG, city);
        //更新定位狀態
        mCityAdapter.updateLocateState(LocateState.SUCCESS,city.substring(0,city.length()-1));
        locateSuccess = true;
    }else {
        mCityAdapter.updateLocateState(LocateState.FAILED,null);
        locateSuccess = false;
    }

}
 
開發者ID:organizationAllink,項目名稱:wzyx-android-user,代碼行數:18,代碼來源:CityPickerActivity.java

示例5: onReceiveLocation

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location){
    lat = location.getLatitude();
    lng = location.getLongitude();
    city = location.getCity();
    if(city != null){
        Log.d(TAG, city);
        if(!city.isEmpty()){
            //定位成功,更新定位狀態
            tvPosition.setText(city.substring(0,city.length()-1));
            showAndHideActivityList(SHOW);
            if(isFirstLoading){
                getActivityList(lat,lng);
                isFirstLoading = false;
            }else {
                getActivityListByType(mSelectedActivityType,mSelectedRankingType,lat,lng);
            }
        }else {
            tvPosition.setText(getResources().getString(R.string.locate));
            //定位失敗
            showAndHideActivityList(HIDE);
        }
    }


}
 
開發者ID:organizationAllink,項目名稱:wzyx-android-user,代碼行數:27,代碼來源:NearFragment.java

示例6: onReceiveLocation

import com.baidu.location.BDLocation; //導入方法依賴的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()));
    }
}
 
開發者ID:Jacklni,項目名稱:MapLocation,代碼行數:25,代碼來源:MainActivity.java

示例7: isLocationValid

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
public static boolean isLocationValid(BDLocation location) {
    if (location == null)
        return false;
    if (location.getLongitude() <= 73)
        return false;
    if (location.getLongitude() >= 136)
        return false;
    if (location.getLatitude() <= 3)
        return false;
    if (location.getLatitude() >= 54)
        return false;
    if (location.getRadius() == 0)
        return false;
    if (location.getRadius() == 2000)
        return false;
    if (location.getLocType() == BDLocation.TypeCacheLocation)
        return true;
    if (location.getLocType() == BDLocation.TypeGpsLocation)
        return true;
    if (location.getLocType() == BDLocation.TypeNetWorkLocation)
        return true;
    if (location.getLocType() == BDLocation.TypeOffLineLocation)
        return true;
    return false;
}
 
開發者ID:iWay7,項目名稱:BikeHelper,代碼行數:26,代碼來源:LocationUtils.java

示例8: getCity

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
private void getCity() {
    mListener = new BDLocationListener(){

        @Override
        public void onReceiveLocation(BDLocation location) {
            if (null != location && location.getLocType() != BDLocation.TypeServerError){
                city=location.getCity();
                location_city.setText(location.getCity());
                addess=location.getAddrStr();
                Lat=location.getLatitude();
                Lng=location.getLongitude();
                Log.e("Address", addess);
                Log.e("CCCC",city);
                getDate();
            }

        }
    };


}
 
開發者ID:BeckNiu,項目名稱:MyCar,代碼行數:22,代碼來源:RoadFragment.java

示例9: onReceiveLocation

import com.baidu.location.BDLocation; //導入方法依賴的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()));
    }
}
 
開發者ID:ByteJump,項目名稱:MyApp,代碼行數:23,代碼來源:fragment1.java

示例10: updateBDMapStatus

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
private void updateBDMapStatus(BDLocation location) {
    final BaiduMap map = getBaiduMap();
    final BaiduMapPrefFragment provider = (BaiduMapPrefFragment)(getProvider().getMapProviderPreferences());
    final Context context = getActivity().getApplicationContext();

    int mapType = provider.getMapType(context);
    map.setMapType(mapType);

    MyLocationData locData = new MyLocationData.Builder()
            .accuracy(location.getRadius())
            .latitude(location.getLatitude())
            .longitude(location.getLongitude()).build();
    map.setMyLocationData(locData);

    LatLng ll = new LatLng(location.getLatitude(), location.getLongitude());
    MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(ll);
    map.animateMapStatus(u);
}
 
開發者ID:mxiao6,項目名稱:Tower-develop,代碼行數:19,代碼來源:BaiduMapFragment.java

示例11: onReceiveLocation

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location) {
    MyLocationData data = new MyLocationData.Builder()
            .direction(100)//方向
            .accuracy(location.getRadius())//精度
            .latitude(location.getLatitude())//緯度
            .longitude(location.getLongitude()).build();//經度
    mBaiduMap.setMyLocationData(data);
    MyLocationConfiguration config =
            new MyLocationConfiguration(null, true, null);
    mBaiduMap.setMyLocationConfigeration(config);
    //更新經緯度
    mLatitude = location.getLatitude();
    mLongtitude = location.getLongitude();
    if (isFirstIn) {
        LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
        MapStatusUpdate msu = MapStatusUpdateFactory.newLatLng(latLng);
        mBaiduMap.animateMapStatus(msu);
        isFirstIn = false;
    }
}
 
開發者ID:PengZhiPeng,項目名稱:Mooc-map,代碼行數:22,代碼來源:MyLocationListener.java

示例12: onReceiveLocation

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location) {
    MyLocationData data = new MyLocationData.Builder()
            .direction(mCurrentX)//更新當前方向
            .accuracy(400.0f)//精度
            .latitude(location.getLatitude())//緯度
            .longitude(location.getLongitude()).build();//經度
    mBaiduMap.setMyLocationData(data);
    //可在第三個參數設置自定義圖標
    MyLocationConfiguration config =
            new MyLocationConfiguration(mLocationMode, true, null);
    mBaiduMap.setMyLocationConfigeration(config);
    //更新經緯度
    mLatitude = location.getLatitude();
    mLongtitude = location.getLongitude();
    mCity = location.getCity();
    if (isFirstIn) {
        LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
        MapStatusUpdate msu = MapStatusUpdateFactory.newLatLng(latLng);
        mBaiduMap.animateMapStatus(msu);
        isFirstIn = false;
        Toast.makeText(context, location.getAddrStr(), Toast.LENGTH_SHORT).show();
    }
}
 
開發者ID:PengZhiPeng,項目名稱:Mooc-map,代碼行數:25,代碼來源:MainActivity.java

示例13: onReceiveLocation

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location) {
	MyLocationData data = new MyLocationData.Builder()
			.accuracy(location.getRadius())//精度
			.latitude(location.getLatitude())//緯度
			.longitude(location.getLongitude()).build();//經度
	mBaiduMap.setMyLocationData(data);
	//可在第三個參數設置自定義圖標
	MyLocationConfiguration config =
			new MyLocationConfiguration(null, true, null);
	mBaiduMap.setMyLocationConfigeration(config);
	//更新經緯度
	mLatitude = location.getLatitude();
	mLongtitude = location.getLongitude();
	if (isFirstIn) {
		LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
		MapStatusUpdate msu = MapStatusUpdateFactory.newLatLng(latLng);
		mBaiduMap.animateMapStatus(msu);
		isFirstIn = false;
	}
}
 
開發者ID:PengZhiPeng,項目名稱:Mooc-map,代碼行數:22,代碼來源:BusLineSearch.java

示例14: onReceiveLocation

import com.baidu.location.BDLocation; //導入方法依賴的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());
                MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(ll);
                mBaiduMap.animateMapStatus(u);
//                StringBuffer U = new StringBuffer(256);
//                U.append(location.getLatitude());
//                U.append(location.getLongitude());
            }
        }
 
開發者ID:amazingokc,項目名稱:BMap,代碼行數:23,代碼來源:MainActivity.java

示例15: onReceiveLocation

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void onReceiveLocation(BDLocation location) {
    L.i(location.getLocType() + "," + +location.getOperators() + "," + location.getLatitude() + ","
            + location.getLongitude() + "," + location.getAddrStr());
    // 成功定位
    if (location.getLocType() == 161 || location.getLocType() == 61) {
        lastPoint = new LocationInfo(location.getLongitude(), location.getLatitude(),
                location.getAddrStr());
    } else {// 定位失敗
        lastPoint = new LocationInfo(0, 0, "定位失敗");
    }
    // 停止定位
    mLocationClient.stop();
    if (listener != null) {
        listener.onLocateCompleted(lastPoint);
    }
}
 
開發者ID:hanks-zyh,項目名稱:Conquer,代碼行數:18,代碼來源:LocationService.java


注:本文中的com.baidu.location.BDLocation.getLatitude方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。