当前位置: 首页>>代码示例>>Java>>正文


Java GeoCodeResult类代码示例

本文整理汇总了Java中com.baidu.mapapi.search.geocode.GeoCodeResult的典型用法代码示例。如果您正苦于以下问题:Java GeoCodeResult类的具体用法?Java GeoCodeResult怎么用?Java GeoCodeResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GeoCodeResult类属于com.baidu.mapapi.search.geocode包,在下文中一共展示了GeoCodeResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onGetGeoCodeResult

import com.baidu.mapapi.search.geocode.GeoCodeResult; //导入依赖的package包/类
public void onGetGeoCodeResult(GeoCodeResult result) {
    if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) {
        Toast.makeText(TrackActivity.this, "抱歉,未能找到结果", Toast.LENGTH_LONG)
                .show();
        return;
    }
    mBaiduMap.clear();
    //定位
    String strInfo = String.format("纬度:%f 经度:%f",
            result.getLocation().latitude, result.getLocation().longitude);
    Toast.makeText(TrackActivity.this, strInfo, Toast.LENGTH_LONG).show();
    //click()


    //result保存地理编码的结果 城市-->坐标
}
 
开发者ID:InnoFang,项目名称:ChangTu,代码行数:17,代码来源:TrackActivity.java

示例2: onGetGeoCodeResult

import com.baidu.mapapi.search.geocode.GeoCodeResult; //导入依赖的package包/类
@Override
public void onGetGeoCodeResult(GeoCodeResult result) {
	if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) {
		Toast.makeText(GeoCoderActivity.this, "抱歉,未能找到结果",
				Toast.LENGTH_LONG).show();
		return;
	}
	if (mMarkerB != null) {
		mMarkerB.remove();
	}
	mMarkerB = MyUtils.addOverLayToMap(
			BitmapDescriptorFactory.fromResource(R.drawable.icon_markb),
			result.getLocation(), mBaiduMap);

	mBaiduMap.setMapStatus(MapStatusUpdateFactory.newLatLng(result
			.getLocation()));

	String strInfo = String.format("纬度:%.1f 经度:%.1f",
			result.getLocation().latitude, result.getLocation().longitude);
	Toast.makeText(GeoCoderActivity.this, strInfo, Toast.LENGTH_LONG)
			.show();

	getDistance(mCenterLatLng, result.getLocation());

}
 
开发者ID:JohnNiuNiu,项目名称:HaHaMap,代码行数:26,代码来源:GeoCoderActivity.java

示例3: onGetGeoCodeResult

import com.baidu.mapapi.search.geocode.GeoCodeResult; //导入依赖的package包/类
@Override
public void onGetGeoCodeResult(GeoCodeResult result) {
    if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) {
        DialogUtils.dissmissLoadDialog();
        Toast.makeText(GeoCodeActivity.this, "抱歉,未能找到结果", Toast.LENGTH_LONG).show();
        return;
    }
    mBaiduMap.clear();
    mBaiduMap.addOverlay(new MarkerOptions().position(result.getLocation()).icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_marka)));
    mBaiduMap.setMapStatus(MapStatusUpdateFactory.newLatLng(result.getLocation()));
    mBaiduMap.setMapStatus(MapStatusUpdateFactory.newMapStatus(new MapStatus.Builder().zoom(15).build()));
    String strInfo = String.format("查找成功!\n纬度:%f 经度:%f", result.getLocation().latitude, result.getLocation().longitude);
    DialogUtils.dissmissLoadDialog();
    Toast.makeText(GeoCodeActivity.this, strInfo, Toast.LENGTH_LONG).show();
}
 
开发者ID:shenhuanet,项目名称:AndroidOpen,代码行数:16,代码来源:GeoCodeActivity.java

示例4: onGetGeoCodeResult

import com.baidu.mapapi.search.geocode.GeoCodeResult; //导入依赖的package包/类
@Override
public void onGetGeoCodeResult(GeoCodeResult result) {
	if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) {
		Toast.makeText(RoadNAVActivity.this, "抱歉,未能找到结果,请重新输入", Toast.LENGTH_LONG)
				.show();
		return;
	}
	else {

	}
	String strInfo = String.format("纬度:%f 经度:%f",
			result.getLocation().latitude, result.getLocation().longitude);
	Toast.makeText(RoadNAVActivity.this,"输入位置可导", Toast.LENGTH_LONG).show();


	if (type==1){
		sLat=result.getLocation().latitude;
		sLng=result.getLocation().longitude;
		Log.e("ggggggg", String.valueOf(sLat));
		Log.e("ddddddd", String.valueOf(sLng));

	}else if(type==2) {
		eLat=result.getLocation().latitude;
		eLng=result.getLocation().longitude;
		Log.e("bbbbbbb", String.valueOf(eLat));
		Log.e("aaaaaaa", String.valueOf(eLng));

	}
	else {
		dLat=result.getLocation().latitude;
		dLng=result.getLocation().longitude;
		Log.e("ppppppp", String.valueOf(dLat));
		Log.e("ccccccc", String.valueOf(dLng));

	}

}
 
开发者ID:BeckNiu,项目名称:MyCar,代码行数:38,代码来源:RoadNAVActivity.java

示例5: onGetGeoCodeResult

import com.baidu.mapapi.search.geocode.GeoCodeResult; //导入依赖的package包/类
/**
    * 地理编码到位置 获得经纬度
    */
   @Override
public void onGetGeoCodeResult(GeoCodeResult result) {
	if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) {
		Log.i(TAG+" onGetGeoCodeResult", "Error: "+result.error.toString());
		return;
	}
	if (result.error == GeoCodeResult.ERRORNO.AMBIGUOUS_ROURE_ADDR) {
		Toast.makeText(this, "AMBIGUOUS_ROURE_ADDR", Toast.LENGTH_SHORT).show();
	}
	currentGeoResult = result.getLocation();
}
 
开发者ID:Mrsunsunshine,项目名称:FrontOne,代码行数:15,代码来源:RoutePlanActivity.java

示例6: initStartAddress

import com.baidu.mapapi.search.geocode.GeoCodeResult; //导入依赖的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

示例7: onGetGeoCodeResult

import com.baidu.mapapi.search.geocode.GeoCodeResult; //导入依赖的package包/类
/**
 * 搜索(根据实地信息-->经纬坐标)
 * @param geoCodeResult
 */
@Override
public void onGetGeoCodeResult(GeoCodeResult geoCodeResult) {

}
 
开发者ID:littleRich,项目名称:VirtualLocation,代码行数:9,代码来源:GeoCoderListener.java

示例8: initLocationAndSearch

import com.baidu.mapapi.search.geocode.GeoCodeResult; //导入依赖的package包/类
private void initLocationAndSearch() {

        //location
        mLocationClient = new LocationClient(getApplicationContext());     //声明LocationClient类
        mLocationClient.registerLocationListener(this);    //注册监听函数
        LocationClientOption option = new LocationClientOption();
        option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy
        );//可选,默认高精度,设置定位模式,高精度,低功耗,仅设备
        option.setCoorType("bd09ll");//可选,默认gcj02,设置返回的定位结果坐标系
        int span = 1000;
        option.setScanSpan(span);//可选,默认0,即仅定位一次,设置发起定位请求的间隔需要大于等于1000ms才是有效的
        option.setIsNeedAddress(true);//可选,设置是否需要地址信息,默认不需要
        option.setOpenGps(true);//可选,默认false,设置是否使用gps
        option.setLocationNotify(true);//可选,默认false,设置是否当GPS有效时按照1S/1次频率输出GPS结果
        option.setIsNeedLocationDescribe(true);//可选,默认false,设置是否需要位置语义化结果,可以在BDLocation.getLocationDescribe里得到,结果类似于“在北京天安门附近”
        option.setIsNeedLocationPoiList(true);//可选,默认false,设置是否需要POI结果,可以在BDLocation.getPoiList里得到
        option.setIgnoreKillProcess(false);//可选,默认true,定位SDK内部是一个SERVICE,并放到了独立进程,设置是否在stop的时候杀死这个进程,默认不杀死
        option.SetIgnoreCacheException(false);//可选,默认false,设置是否收集CRASH信息,默认收集
        option.setEnableSimulateGps(false);//可选,默认false,设置是否需要过滤GPS仿真结果,默认需要
        mLocationClient.setLocOption(option);
        //search

        mPoiSearch = PoiSearch.newInstance();
        mPoiSearch.setOnGetPoiSearchResultListener(new MyPoiSearchListener());
        mNearbySearchOption = new PoiNearbySearchOption()
                .radius(5000)
                .pageNum(1)
                .pageCapacity(20)
                .sortType(PoiSortType.distance_from_near_to_far);


        ////////////////
        mGeoCoder = GeoCoder.newInstance();
        mGeoCoder.setOnGetGeoCodeResultListener(new OnGetGeoCoderResultListener() {
            @Override
            public void onGetGeoCodeResult(GeoCodeResult geoCodeResult) {
                Log.e(TAG, "onGetGeoCodeResult: " + geoCodeResult.toString());
            }

            @Override
            public void onGetReverseGeoCodeResult(ReverseGeoCodeResult reverseGeoCodeResult) {
                Log.e(TAG, "onGetReverseGeoCodeResult: " + reverseGeoCodeResult.toString());
            }
        });


    }
 
开发者ID:REBOOTERS,项目名称:AndroidAnimationExercise,代码行数:48,代码来源:FakeWeiBoActivity.java

示例9: onGetGeoCodeResult

import com.baidu.mapapi.search.geocode.GeoCodeResult; //导入依赖的package包/类
@Override
public void onGetGeoCodeResult(GeoCodeResult geoCodeResult) {
}
 
开发者ID:iWay7,项目名称:BikeHelper,代码行数:4,代码来源:AddressQuerier.java

示例10: onGetGeoCodeResult

import com.baidu.mapapi.search.geocode.GeoCodeResult; //导入依赖的package包/类
@Override
    public void onGetGeoCodeResult(GeoCodeResult result) {
        if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) {
//            Toast.makeText(this,
//                    getResources().getString(R.string.sorry_not_find), Toast.LENGTH_LONG)
//                    .show();


            //可能存在定位失败,找不到经纬度,那么这里就在网络请求一次定位接口,通过传入的城市来获取到经纬度
            String url = HttpUrlPath.GET_LON_AND_LAT + cityName1;

            OkGo.get(url)
                    .getCall(StringConvert.create(), RxAdapter.<String>create())
                    .doOnSubscribe(() -> {
                    })
                    .observeOn(AndroidSchedulers.mainThread())
                    .subscribe(s -> {
                        Type type = new TypeToken<ALCity>() {
                        }.getType();
                        ALCity alCity = new Gson().fromJson(s, type);
                        mLatitude = alCity.getLat();
                        mLongitude = alCity.getLon();
                    }, throwable -> {
                    });

            // return;
        } else {
            mLatitude = result.getLocation().latitude;
            BigDecimal la = new BigDecimal(mLatitude);
            mLatitude = la.setScale(6, BigDecimal.ROUND_HALF_UP).doubleValue();
            mLongitude = result.getLocation().longitude;
            BigDecimal lo = new BigDecimal(mLongitude);
            mLongitude = lo.setScale(6, BigDecimal.ROUND_HALF_UP).doubleValue();

        }
        EventBus.getDefault().post(new LocationEvent(cityName1, mLatitude, mLongitude));
        PreferencesUtils.saveCityName(CityActivity.this, cityName1);
        Intent intent = new Intent();
        setResult(100, intent); //返回数据
        finish();

        Log.d(TAG, "mLatitude:" + mLatitude +
                " mLongitude:" + mLongitude);
        // Toast.makeText(this, "mLatitude:" + mLatitude +
        //         " mLongitude:" + mLongitude, Toast.LENGTH_SHORT).show();
    }
 
开发者ID:wuyinlei,项目名称:TravelAround,代码行数:47,代码来源:CityActivity.java

示例11: onGetGeoCodeResult

import com.baidu.mapapi.search.geocode.GeoCodeResult; //导入依赖的package包/类
@Override
public void onGetGeoCodeResult(GeoCodeResult arg0) {
	// TODO Auto-generated method stub
	
}
 
开发者ID:JasonGaoH,项目名称:enjoychat,代码行数:6,代码来源:LocationActivity.java

示例12: onGetGeoCodeResult

import com.baidu.mapapi.search.geocode.GeoCodeResult; //导入依赖的package包/类
@Override
public void onGetGeoCodeResult(GeoCodeResult arg0) {
	// TODO Auto-generated method stub

}
 
开发者ID:nEdAy,项目名称:XPPLE_IM,代码行数:6,代码来源:LocationActivity.java

示例13: onGetGeoCodeResult

import com.baidu.mapapi.search.geocode.GeoCodeResult; //导入依赖的package包/类
@Override
		public void onGetGeoCodeResult(GeoCodeResult result) {
			// TODO Auto-generated method stub
			int sX=0, sY=0, eX=0, eY=0;
			Location location=new Location();
			if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) {
				Toast.makeText(NavigationFragment.this.getActivity(), "抱歉,未能找到结果", Toast.LENGTH_LONG).show();
				return;
			}
			
			String strInfo = String.format("start纬度:%f start经度:%f",result.getLocation().latitude, result.getLocation().longitude);
			Toast.makeText(NavigationFragment.this.getActivity(), strInfo, Toast.LENGTH_LONG).show();
			
			location.setLatitude(result.getLocation().latitude);
			location.setLongitude(result.getLocation().longitude);
			locations.add(location);
////			Log.i("aaaaaaaaaaa", "aaaaaaaaaaaa  b"+locations.size());
//			if(locations.size()>=2){
//				Location start=locations.get(0);
//				Location end=locations.get(1);
//				sX = (int) (start.getLatitude()* 1e5);
//				sY = (int) (start.getLongitude()* 1e5);
//				eX = (int) (end.getLatitude()* 1e5);
//				eY = (int) (end.getLongitude()* 1e5);
//				
//				
//				//起点
//				RoutePlanNode startNode = new RoutePlanNode(sX, sY, RoutePlanNode.FROM_MAP_POINT, "华侨城", "华侨城");
////				Log.i("AAAAAAAAAAA", "aaaaaaaaa5  "+locations.size());
//				//终点
//				RoutePlanNode endNode = new RoutePlanNode(eX, eY, RoutePlanNode.FROM_MAP_POINT, "滨海苑", "滨海苑");
////				Log.i("AAAAAAAAAAA", "aaaaaaaaa6  "+locations.size());
//				
//				
//				//将起终点添加到nodeList
//				ArrayList<RoutePlanNode> nodeList = new ArrayList<RoutePlanNode>(2);
////				Log.i("AAAAAAAAAAA", "aaaaaaaaa7  "+locations.size());
//				nodeList.add(startNode);
//				nodeList.add(endNode);
////				Log.i("AAAAAAAAAAA", "aaaaaaaaa8  "+locations.size());
//				
//				
//				BNRoutePlaner.getInstance().setObserver(new RoutePlanObserver(NavigationFragment.this.getActivity(), null));
////				Log.i("AAAAAAAAAAA", "aaaaaaaaa9  "+locations.size());
//				//设置算路方式
//				BNRoutePlaner.getInstance().setCalcMode(NE_RoutePlan_Mode.ROUTE_PLAN_MOD_MIN_TIME);
////				Log.i("AAAAAAAAAAA", "aaaaaaaaa10  "+locations.size());
//				// 设置算路结果回调
//				BNRoutePlaner.getInstance().setRouteResultObserver(mRouteResultObserver);
////				Log.i("AAAAAAAAAAA", "aaaaaaaaa11  "+locations.size());
//				// 设置起终点并算路
//				boolean ret = BNRoutePlaner.getInstance().setPointsToCalcRoute(nodeList, NL_Net_Mode.NL_Net_Mode_OnLine);
//				if(!ret){
//					Toast.makeText(NavigationFragment.this.getActivity(), "规划失败", Toast.LENGTH_SHORT).show();
//				}
//			
//			}
		}
 
开发者ID:haiyangxue,项目名称:EasyTracker,代码行数:59,代码来源:NavigationFragment.java

示例14: onGetGeoCodeResult

import com.baidu.mapapi.search.geocode.GeoCodeResult; //导入依赖的package包/类
@Override
public void onGetGeoCodeResult(GeoCodeResult arg0) {
}
 
开发者ID:hanks-zyh,项目名称:Conquer,代码行数:4,代码来源:LocationActivity.java

示例15: onGetGeoCodeResult

import com.baidu.mapapi.search.geocode.GeoCodeResult; //导入依赖的package包/类
@Override
public void onGetGeoCodeResult(GeoCodeResult arg0) {
    // TODO Auto-generated method stub

}
 
开发者ID:klob,项目名称:Diandi1.20,代码行数:6,代码来源:LocationActivity.java


注:本文中的com.baidu.mapapi.search.geocode.GeoCodeResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。