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


Java BDLocation.setLongitude方法代碼示例

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


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

示例1: updateMap

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
private void updateMap(List<String> idList) {
    List<BDLocation> locationsList = new ArrayList<BDLocation>();
    for (String id : idList) {
        Venue venue = ReadVenue.requestVenue(id, null);
        BDLocation location = new BDLocation();
        VenueIOSession io = venue.getIOSession();
        try {
            location.setLatitude(io.getLatitude());
            location.setLongitude(io.getLongitude());
        } finally {
            io.close();
        }
        locationsList.add(location);
    }
    mCallback.addVenueLocations(locationsList);
}
 
開發者ID:cuipengpeng,項目名稱:p1-android,代碼行數:17,代碼來源:VenueListFragment.java

示例2: setAddress

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
public void setAddress(Address address) {
    if (address != null) {
        mAddress = address.clone();
        BDLocation bdLocation = new BDLocation();
        bdLocation.setLatitude(mAddress.getLatitude());
        bdLocation.setLongitude(mAddress.getLongitude());
        bdLocation = LocationClient.getBDLocationInCoorType(bdLocation, BDLocation.BDLOCATION_BD09LL_TO_GCJ02);
        mAddress.setLatitude(bdLocation.getLatitude());
        mAddress.setLongitude(bdLocation.getLongitude());
    }
    Log.i("LingJu", "LocationAccessAdapter setAddress() 最終位置:>> " + mAddress);
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:13,代碼來源:LocationAccessAdapter.java

示例3: toHomeNavi

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void toHomeNavi() {
    BDLocation bl = new BDLocation();
    bl.setLatitude(address.getLatitude());
    bl.setLongitude(address.getLongitude());
    // bl = LocationClient.getBDLocationInCoorType(bl, BDLocation.BDLOCATION_GCJ02_TO_BD09LL);
    double dt = DistanceUtil.getDistance(new LatLng(bl.getLatitude(), bl.getLongitude()), new LatLng(homeAddress.getLatitude(), homeAddress.getLongitude()));
    if (dt < 50) {
        mSetPointView.showSnackBar(mAppConfig.getResources().getString(R.string.inHome));
        // Toast.makeText(mContext, mAppConfig.getResources().getString(R.string.inHome), Toast.LENGTH_SHORT).show();
    }//else if(dt>100000){
    //            Toast.makeText(mContext, mAppConfig.getResources().getString(R.string.tooLongForCalculate), Toast.LENGTH_SHORT).show();
    //        }
    else {
        //沒有網絡進行提示
        if (NetUtil.getInstance(mContext).getCurrentNetType().equals(NetUtil.NetType.NETWORK_TYPE_NONE)) {
            final CommonDialog commonDialog = new CommonDialog(mContext, "網絡錯誤", "網絡狀態不佳,請檢查網絡設置", "確定");
            commonDialog.setOnConfirmListener(new CommonDialog.OnConfirmListener() {
                @Override
                public void onConfirm() {
                    commonDialog.cancel();
                }
            }).show();
            return;
        }
        Intent intent = new Intent(mContext, NaviSetLineActivity.class);
        intent.putExtra("latitude", homeAddress.getLatitude());
        intent.putExtra("longitude", homeAddress.getLongitude());
        intent.putExtra("address", homeAddress.getName());
        mContext.startActivity(intent);
        mContext.goInto();
    }
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:34,代碼來源:NaviSetPointPresenter.java

示例4: toCompanyNavi

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void toCompanyNavi() {
    BDLocation bl = new BDLocation();
    bl.setLatitude(address.getLatitude());
    bl.setLongitude(address.getLongitude());
    // bl = LocationClient.getBDLocationInCoorType(bl, BDLocation.BDLOCATION_GCJ02_TO_BD09LL);
    double dt = DistanceUtil.getDistance(new LatLng(bl.getLatitude(), bl.getLongitude()), new LatLng(companyAddress.getLatitude(), companyAddress.getLongitude()));
    if (dt < 50) {
        mSetPointView.showSnackBar(mAppConfig.getResources().getString(R.string.inCompany));
        //  Toast.makeText(mContext, mAppConfig.getResources().getString(R.string.inCompany), Toast.LENGTH_SHORT).show();

    } else {
        //沒有網絡進行提示
        if (NetUtil.getInstance(mContext).getCurrentNetType().equals(NetUtil.NetType.NETWORK_TYPE_NONE)) {
            final CommonDialog commonDialog = new CommonDialog(mContext, "網絡錯誤", "網絡狀態不佳,請檢查網絡設置", "確定");
            commonDialog.setOnConfirmListener(new CommonDialog.OnConfirmListener() {
                @Override
                public void onConfirm() {
                    commonDialog.cancel();
                }
            }).show();
            return;
        }
        Intent intent = new Intent(mContext, NaviSetLineActivity.class);
        intent.putExtra("latitude", companyAddress.getLatitude());
        intent.putExtra("longitude", companyAddress.getLongitude());
        intent.putExtra("address", companyAddress.getName());
        mContext.startActivity(intent);
        mContext.goInto();
    }

}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:33,代碼來源:NaviSetPointPresenter.java

示例5: setCGJ02

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
/**
 * 將百度坐標轉換成國測局坐標
 **/
public void setCGJ02() {
    BDLocation bl = new BDLocation();
    bl.setLatitude(this.latitude);
    bl.setLongitude(this.longitude);
    bl = LocationClient.getBDLocationInCoorType(bl, BDLocation.BDLOCATION_BD09LL_TO_GCJ02);
    this.latitude = bl.getLatitude();
    this.longitude = bl.getLongitude();
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:12,代碼來源:BaiduAddress.java

示例6: setBD09LL

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
public void setBD09LL() {
    BDLocation bl = new BDLocation();
    bl.setLatitude(this.latitude);
    bl.setLongitude(this.longitude);
    bl = LocationClient.getBDLocationInCoorType(bl, BDLocation.BDLOCATION_GCJ02_TO_BD09LL);
    this.latitude = bl.getLatitude();
    this.longitude = bl.getLongitude();
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:9,代碼來源:BaiduAddress.java

示例7: onClick

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@OnClick({R.id.ancp_back_bt, R.id.ancp_map_locate_bt, R.id.ancp_zoom_in_bt, R.id.ancp_zoom_out_bt,
        R.id.ancp_poi_detial_pre_bt, R.id.ancp_poi_detial_next_bt, R.id.ancp_map_its_bt})
public void onClick(View view) {
    switch (view.getId()) {
        case R.id.ancp_back_bt:
            onBackPressed();
            break;
        case R.id.ancp_map_locate_bt:
            /* 封裝定位信息 */
            BDLocation location = new BDLocation();
            location.setLatitude(address.getLatitude());
            location.setLongitude(address.getLongitude());
            location.setRadius(address.getRadius());
            location.setSpeed(address.getSpeed());
            location.setSatelliteNumber(address.getSatelliteNumber());
            location = LocationClient.getBDLocationInCoorType(location, BDLocation.BDLOCATION_GCJ02_TO_BD09LL);
            /* 開啟定位圖層 */
            baiduMap.setMyLocationEnabled(true);
            // 設置定位圖層的配置(定位模式,是否允許方向信息,用戶自定義定位圖標)
            baiduMap.setMyLocationConfigeration(new MyLocationConfiguration(MyLocationConfiguration.LocationMode.FOLLOWING, true, null));
            /* 構造定位數據並設置 */
            baiduMap.setMyLocationData(new MyLocationData.Builder().latitude(location.getLatitude())
                    .longitude(location.getLongitude())
                    .accuracy(location.getRadius())
                    .direction(location.getDirection())
                    .satellitesNum(location.getSatelliteNumber())
                    .speed(location.getSpeed())
                    .build());
            break;
        case R.id.ancp_zoom_in_bt:
            baiduMap.setMapStatus(MapStatusUpdateFactory.zoomIn());
            break;
        case R.id.ancp_zoom_out_bt:
            baiduMap.setMapStatus(MapStatusUpdateFactory.zoomOut());
            break;
        case R.id.ancp_poi_detial_pre_bt:
            if (mAncpPoiDetailPager.getCurrentItem() > 0 && mAncpPoiDetailPager.getCurrentItem() < list.size()) {
                showPoiDetail(mAncpPoiDetailPager.getCurrentItem() - 1);
            }
            break;
        case R.id.ancp_poi_detial_next_bt:
            if (mAncpPoiDetailPager.getCurrentItem() >= 0 && mAncpPoiDetailPager.getCurrentItem() < list.size() - 1) {
                showPoiDetail(mAncpPoiDetailPager.getCurrentItem() + 1);
            }
            break;
        case R.id.ancp_map_its_bt:
            if (baiduMap.isTrafficEnabled()) {
                baiduMap.setTrafficEnabled(false);
                ((ImageButton) view).setImageResource(R.drawable.bnav_common_ic_map_its_off);
            } else {
                baiduMap.setTrafficEnabled(true);
                ((ImageButton) view).setImageResource(R.drawable.bnav_common_ic_map_its_on);
            }
            break;
    }
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:57,代碼來源:NaviConfirmPointActivity.java

示例8: setRouteModeDetail

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void setRouteModeDetail(int index) {
    calculateScheme = index;
    cancelCountDownTimer();
    /* 設置指定路線 */
    BNRoutePlanerProxy.getInstance().selectRoute(index);
    BNRoutePlanerProxy.getInstance().setCalculateScheme(index);
    RouteModel.setCalculateScheme(index);
    /* 獲取指定算路偏好的指定路線 */
    RoutePlanModelProxy mRoutePlanModel = BNRoutePlanerProxy.getInstance().routePlans.get(calculatePreference).get(index);
    /* 綁定視圖數據 */
    mSetLineView.updateRouteDetailList(mRoutePlanModel.getRouteNodeData());
    mSetLineView.setLineMsg(mRoutePlanModel);
    mSetLineView.setLineMsg(mRoutePlanModel);
    /* 設置導航路線圖層 */
    BNMapControllerProxy.getInstance().setLayerMode(
            MapParams.LayerMode.MAP_LAYER_MODE_ROUTE_DETAIL_FOR_NAVI);
    BNMapControllerProxy.getInstance().updateLayer(MapParams.LayerType.MAP_LAYER_TYPE_ROUTE);
    //rLineDetailListBox.setVisibility(View.VISIBLE);

    for (int i = 0; i < 3; i++) {
        if (i == index) {   //選中路線
            mSetLineView.setRouteLineModeStyle(i, true);
        } else {            //其他導航路線
            mSetLineView.setRouteLineModeStyle(i, false);
        }
    }
    //上傳導航引擎對象
    com.lingju.context.entity.Address startAddress = getAddress(routeInputs.get(0));
    com.lingju.context.entity.Address endAddress = getAddress(routeInputs.get(routeInputs.size() - 1));
    List<com.lingju.context.entity.Address> passPoints = new ArrayList<>();
    for (int i = 1; i < routeInputs.size() - 1; i++) {
        passPoints.add(getAddress(routeInputs.get(i)));
    }
    RouteModel routeModel = RouteModel.getCurrent();
    Route route = getRoute(mRoutePlanModel, startAddress, endAddress, passPoints, routeModel, calculateScheme);
    mNavigation.setRoute(route);
    mNavigation.setNaviplan(calculateScheme + 1);
    mNavigation.setIscongestion(NavigatorService.get().isCongestion() ? "ON" : "OFF");
    mNavigation.setStatus(RobotConstant.NaviStatus.PLAN.toString());
    uploadNavigation();
    keepNavigation();
    Log.i(TAG, "第一段路名:" + mRoutePlanModel.getFirstRoadName() + ",時間:" + mRoutePlanModel.getTotalTime() + ",花費:" + mRoutePlanModel.getTollFees() + ",routeNum:" + mRoutePlanModel.getNodeNum() + ",主要道路:" + mRoutePlanModel.getMainRoads());
    ArrayList<RoutePlanResultItemProxy> rList = mRoutePlanModel.getRouteNodeData();
    BDLocation tt = new BDLocation();
    for (RoutePlanResultItemProxy ri : rList) {
        tt.setLatitude(ri.getLatitude() / 1e5);
        tt.setLongitude(ri.getLongitude() / 1e5);
        tt = LocationClient.getBDLocationInCoorType(tt, BDLocation.BDLOCATION_GCJ02_TO_BD09LL);
        System.out.println(ri.getNextRoadName() + ",condition=" + ri.getRoadCondition() + ",coordinate=[" + tt.getLongitude() + "," + tt.getLatitude() + "]");
    }
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:53,代碼來源:NaviSetLinePresenter.java

示例9: initStartAddress

import com.baidu.location.BDLocation; //導入方法依賴的package包/類
@Override
public void initStartAddress() {
    BDLocation location = new BDLocation();
    location.setLatitude(address.getLatitude());
    location.setLongitude(address.getLongitude());
    location.setRadius(address.getRadius());
    location.setSpeed(address.getSpeed());
    location.setSatelliteNumber(address.getSatelliteNumber());
    // location = LocationClient.getBDLocationInCoorType(location, BDLocation.BDLOCATION_GCJ02_TO_BD09LL);

    //更新家和公司視圖
    updateCompany();
    updateHome();
    final GeoCoder geoCoder = GeoCoder.newInstance();
    /* 設置地理編碼查詢監聽者 */
    final BDLocation finalLocation = location;
    geoCoder.setOnGetGeoCodeResultListener(new OnGetGeoCoderResultListener() {
        @Override
        public void onGetGeoCodeResult(GeoCodeResult geoCodeResult) {

        }

        @Override
        public void onGetReverseGeoCodeResult(ReverseGeoCodeResult r) {
            List<PoiInfo> ls = r.getPoiList();
            if (ls != null && ls.size() > 0) {
                initAddress = new BaiduAddress();
                // String myLocation;
                setBaiduAddressFromPoiInfo(initAddress, ls.get(0));
                // myLocation = initAddress.getName();
                initAddress.setAddress(address.getAddressDetail());
                initAddress.setLatitude(finalLocation.getLatitude());
                initAddress.setLongitude(finalLocation.getLongitude());
                if (TextUtils.isEmpty(initAddress.getCity()))
                    initAddress.setCity(address.getCity());
                BaiduAddress myStartAddr = new BaiduAddress();
                myStartAddr.setLatitude(initAddress.getLatitude());
                myStartAddr.setLongitude(initAddress.getLongitude());
                myStartAddr.setName("我的位置" + "(" + initAddress.getName() + ")" + "附近");
                if (mSetPointView.getStartAddrText().startsWith("我的位置")) {
                    myStartAddr.setRemark("出發地");
                    myStartAddr.setId(null);
                    myStartAddr.setFavoritedTime(null);
                    mAppConfig.startAddress = myStartAddr;
                }
                //設置默認回家和去公司的出發地址
                // mAppConfig.myAddress = myLocation;
                //                    updateCompany();
                //                    updateHome();
                //由init進入該方法時不觸發導航
                updateStart(false);
                updateEnd(false);
                updateHistoryList();
                geoCoder.destroy();
            }
        }
    });
    geoCoder.reverseGeoCode(new ReverseGeoCodeOption().
            location(new LatLng(location.getLatitude(), location.getLongitude())));
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:61,代碼來源:NaviSetPointPresenter.java


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