{"version":"0.1.0","code":"0000","result":true,"message":"处理成功","errdetail":"","timestamp":1671508823903,"data":{"id":71713202,"title":"3.4.3 纹理销毁","slug":"fntvog","format":"lake","bookId":26046811,"body":null,"body_draft":null,"body_html":"
卡片提供了纹理销毁接口,如果不销毁纹理可能造成内存泄漏、纹理id超出纹理管理器可容纳的个数导致后续纹理无法添加成功等情况。
void com.autonavi.gbl.map.layer.BaseLayer.removeItem(String itemID)
int com.autonavi.gbl.map.layer.observer.IPrepareLayerStyle.clearLayerItem(BaseLayer pLayer,LayerItem pItem)
int com.autonavi.gbl.card.ITextureManager.destroyCustomTexture(int markerId)
boolean com.autonavi.gbl.map.MapView.destroyTexture(int resId)
说明:函数详情,请复制函数名称到在线API搜索
\npublic class MapPrepareLayerStyle implements IPrepareLayerStyle {\n\t...\t\n\t@Override 图元删除回调\n public void clearLayerItem(BaseLayer pLayer, LayerItem pItem) {\n if (destroyCustomTexture)\n {\n /*< 获取卡片管理器 */\n ITextureManager textureManager;\n ...\n\n /*< 获取要销毁的动态纹理ID */\n int customeTextureId;\n ...\n\n textureManager.destroyCustomTexture(customeTextureId);\n } \n else if (destroyStaticTexture)\n {\n /*< 获取要销毁的静态纹理ID */\n int staticTextureId;\n ...\n\n /*< 获取视图 */\n MapView mMapView;\n ...\n\n mMapView.destroyTexture(staticTextureId);\n }\n\t}\t\n}