{"version":"0.1.0","code":"0000","result":true,"message":"处理成功","errdetail":"","timestamp":1671508802364,"data":{"id":71712807,"title":"2.4.1 设备创建销毁","slug":"seqg5p","format":"lake","bookId":26046811,"body":null,"body_draft":null,"body_html":"
说明:
MapDevice,为AutoSDK抽象出来的地图设备的概念,用于和surfaceview进行绑定。一个surfaceview同一时刻只能绑定一个MapDevice。
com.autonavi.gbl.map.model.EGLDeviceID赋值导
com.autonavi.gbl.map.model.DeviceAttribute.uiTaskDeviceId字段,未赋值多屏会出现异常。
取值 | 含义 |
EGLDeviceIDDefault | 默认显示屏幕,主屏 |
EGLDeviceIDExternal1 | 扩展屏幕(第1个) |
... | |
EGLDeviceIDExternal8 | 扩展屏幕(第8个) |
com.autonavi.gbl.map.model.DeviceAttribute.isNeedAntialias
取值 | 含义 |
true | 开 |
false | 关 |
com.autonavi.gbl.map.model.DeviceAttribute.samples
取值 | 含义 |
2 | 2倍抗锯齿 |
4 | 4倍抗锯齿 |
其余值 | 需要系统支持,并不一定能设置成功 |
com.autonavi.gbl.map.model.DeviceAttribute.deviceWorkMode
取值 | 含义 |
com.autonavi.gbl.map.model.EGLDeviceWorkMode.EGLDeviceWorkMode_WithThreadWithEGLContextDrawIn | Auto SDK创建EGL环境,有帧率控制线程,HMI无需关注EGL相关创建流程,在Android上较为适用,建议外部设置此模式。 |
com.autonavi.gbl.map.model.EGLDeviceWorkMode.EGLDeviceWorkMode_WithoutThreadWithEGLContextDrawNotIn | Auto SDK创建EGL环境,无帧率控制线程,目前适用IOS平台,不建议外部设置此模式。 |
com.autonavi.gbl.map.model.EGLDeviceWorkMode.EGLDeviceWorkMode_WithThreadWithoutEGLContextDrawNotIn | HMI创建EGL环境,有帧率控制线程,目前适用于Liunx平台,和Windows平台,不建议外部设置此模式。 |
// 创建\nMapDevice com.autonavi.gbl.map.MapService.createDevice(\n @EGLDeviceID.EGLDeviceID1 int shareDeviceId,\n\tDeviceAttribute deviceAttr,\n\tIDeviceObserver pIDeviceObserver \n)\n\n// 销毁\nboolean com.autonavi.gbl.map.MapService.destroyDevice(MapDevice pIMapDevice)
说明:函数详情,请复制函数名称到在线API搜索
// 创建\nMapDevice mapDevice;\nDeviceAttribute devAttribute = new DeviceAttribute();\ndevAttribute.isNeedAntialias = true;\ndevAttribute.samples = 4;\ndevAttribute.uiTaskDeviceId = 0;\ndevAttribute.deviceWorkMode = EGLDeviceWorkMode_WithThreadWithEGLContextDrawIn;\nmapDevice = mapService.createDevice(EGLDeviceID.EGLDeviceIDDefault, devAttribute, this);\nServiceMgr.getServiceMgrInstance().setUiLooper(0, Looper.getMainLooper());\nmapDevice.addDeviceObserver(this); //地图设备观察者\n\n// 销毁\nif (mapDevice != null) {\n mapDevice.removeDeviceObserver(this);\n}\nmapService.destroyDevice(mapDevice);\nmapDevice = null;