|
|
第1行: |
第1行: |
− | {{androidarsdk-sidebar}}
| |
| | | |
− | == AR识楼 ==
| |
− |
| |
− | Android AR识别SDK提供周边楼块AR展示接口,开发者仅需调用API接口,就可以直接使用地图楼块信息数据,Android AR识别SDK会根据使用者当前位置,对周边楼块进行AR展示。 用户可以点击楼块气泡,获取点击回调。<br/>示例代码如下:
| |
− | <pre class="prettyprint codestyle">// 获取地图ArSdkManager管理类
| |
− | ArSdkManager mArSdkManager = ArSdkManager.getInstance();
| |
− | // 调用地图ArSdk获取楼块信息
| |
− | mArSdkManager.searchBuildingInfo();
| |
− | // 调用类实现OnGetDataResultListener监听,用于接地图ArSdk回调数据信息
| |
− | /**
| |
− | * 返回楼块数据,跳转到识楼Activity
| |
− | * @param arResponse
| |
− | */
| |
− | @Override
| |
− | public void onGetBuildingResult(ArBuildingResponse arResponse) {
| |
− | }
| |
− |
| |
− | // 获取景区信息后跳转到景区展示Activity,展现Activity实现传感器监听,进行渲染
| |
− |
| |
− | private class HoldPositionListenerImp implements SimpleSensor.OnHoldPositionListener {
| |
− | @Override
| |
− | public void onOrientationWithRemap(float[] remapValue) {
| |
− | if (mCamGLView != null && mArPoiItemRl != null && arBuildingResponse != null) {
| |
− | if (arBuildingResponse.getBuildings() == null) {
| |
− | mArPoiItemRl.setVisibility(View.GONE);
| |
− | // mMessageTv.setText("附近没有可识别的楼宇");
| |
− | } else {
| |
− | mCamGLView.setBaseArSensorState(remapValue, getLayoutInflater(), mMessageTv,
| |
− | mArPoiItemRl, BuildingArActivity.this, arBuildingResponse.getBuildings(),
| |
− | BuildingArActivity.this);
| |
− | mArPoiItemRl.setVisibility(View.VISIBLE);
| |
− | }
| |
− | }
| |
− | }
| |
− | }
| |
− | </pre>
| |
− |
| |
− | 效果展示如下:<br/>http://mapopen-pub-androidsdk.cdn.bcebos.com/ar/images/aboutfloor2.jpg
| |