Java Code Examples for com.baidu.mapapi.search.geocode.ReverseGeoCodeResult#getPoiList()

The following examples show how to use com.baidu.mapapi.search.geocode.ReverseGeoCodeResult#getPoiList() . 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: MapPickerActivity.java    From o2oa with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void onGetReverseGeoCodeResult(ReverseGeoCodeResult result) {
    if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) {
        // 没有找到检索结果
        status.setText(R.string.picker_internalerror);
        status.setVisibility(View.VISIBLE);
    }
    // 获取反向地理编码结果
    else {
        status.setVisibility(View.GONE);
        // 当前位置信息
        mLoactionLatLng = result.getLocation();
        mAddress = result.getAddress();
        mName = result.getAddressDetail().street;
        mStreet = result.getAddressDetail().street;
        mCity = result.getAddressDetail().city;

        //滑动地图.中间位置坐标记录下来发送.相当于默认点击了一下listView中的第一条
        mLatitude = result.getLocation().latitude;
        mLongitude = result.getLocation().longitude;

        mCurentInfo = new PoiInfo();
        mCurentInfo.address = result.getAddress();
        mCurentInfo.location = result.getLocation();
        mCurentInfo.name = "[当前位置]";
        mInfoList.clear();
        mInfoList.add(mCurentInfo);
        // 将周边信息加入表
        if (result.getPoiList() != null) {
            mInfoList.addAll(result.getPoiList());
        }
        mAdapter.setNotifyTip(0);
        // 通知适配数据已改变
        mAdapter.notifyDataSetChanged();
        loading.setVisibility(View.GONE);

    }
}
 
Example 2
Source File: GeolocationModule.java    From react-native-baidu-map with MIT License 5 votes vote down vote up
@Override
public void onGetReverseGeoCodeResult(ReverseGeoCodeResult result) {
    WritableMap params = Arguments.createMap();
    if (result == null || result.error != SearchResult.ERRORNO.NO_ERROR) {
        params.putInt("errcode", -1);
    }
    else {
        ReverseGeoCodeResult.AddressComponent addressComponent = result.getAddressDetail();
        params.putString("address", result.getAddress());
        params.putString("province", addressComponent.province);
        params.putString("city", addressComponent.city);
        params.putString("district", addressComponent.district);
        params.putString("street", addressComponent.street);
        params.putString("streetNumber", addressComponent.streetNumber);

        WritableArray list = Arguments.createArray();
        List<PoiInfo> poiList = result.getPoiList();
        for (PoiInfo info: poiList) {
            WritableMap attr = Arguments.createMap();
            attr.putString("name", info.name);
            attr.putString("address", info.address);
            attr.putString("city", info.city);
            attr.putDouble("latitude", info.location.latitude);
            attr.putDouble("longitude", info.location.longitude);
            list.pushMap(attr);
        }
        params.putArray("poiList", list);
    }
    sendEvent("onGetReverseGeoCodeResult", params);
}
 
Example 3
Source File: MainActivity.java    From MoveMapLocation with Apache License 2.0 4 votes vote down vote up
@Override
public void onGetReverseGeoCodeResult(ReverseGeoCodeResult reverseGeoCodeResult) {
    List<PoiInfo> poiInfos = reverseGeoCodeResult.getPoiList();
    PoiAdapter poiAdapter = new PoiAdapter(MainActivity.this, poiInfos);
    poisLL.setAdapter(poiAdapter);
}