{"version":"0.1.0","code":"0000","result":true,"message":"处理成功","errdetail":"","timestamp":1671516362002,"data":{"id":71712589,"title":"6.3.3.7 2D矢量大图图元","slug":"eiu447","format":"lake","bookId":26046811,"body":null,"body_draft":null,"body_html":"
2D矢量路口大图图元(VectorCrossLayerItem)是将2D矢量数据绘制在屏幕指定区域的一种LayerItem,目前应用场景为2D矢量路口大图。
字段 | 含义 |
com.autonavi.gbl.map.layer.VectorCrossLayerItem | 2D矢量路口大图图元 |
com.autonavi.gbl.map.layer.model.LayerItemType.LayerItemVectorCrossType | 矢量路口 |
/* 回调获取2D矢量路口大图json串 */\nString com.autonavi.gbl.map.layer.observer.IPrepareLayerStyle.getLayerStyle(BaseLayer pLayer, LayerItem pItem, boolean forJava)\n\n/* 回调获取纹理id */\nint com.autonavi.gbl.map.layer.observer.IPrepareLayerStyle.getMarkerId(BaseLayer pLayer, LayerItem pItem, String strMarkerId, String strMarkerInfo)\n\n/* 加载纹理 */\nboolean com.autonavi.gbl.map.MapView.addLayerTexture(LayerTexture texture)\n\n/* 更新样式 */\nvoid com.autonavi.gbl.map.layer.VectorCrossLayerItem.updateStyle()\n\n/* 显示2D矢量路口大图数据 */\nint com.autonavi.gbl.map.layer.VectorCrossLayerItem.showVectorCross(byte[] pBuffer)\n\n/* 设置车标信息 */\nvoid com.autonavi.gbl.map.layer.VectorCrossLayerItem.setVectorCar(Coord3DDouble pos, int angle)
说明:函数详情,请复制函数名称到在线API搜索
...\n/*< 创建VectorCrossLayer图层 */\nVectorCrossLayerItem pItem = new VectorCrossLayerItem(); // 创建VectorCrossLayerItem\npItem.setStyle(prepareLayerStyle); // 设置样式回调\npItem.setBusinessType(BizRoadCrossType.BizRoadCrossTypeVector); // 设置业务类型\npLayer.showVectorCross(buffer); // 显示2D矢量路口大图数据\n\n/* 回调获取2D矢量路口大图json,回调获取markerID */\npublic class MapPrepareLayerStyle implements IPrepareLayerStyle {\n\t...\n\t@Override\n public String getLayerStyle(final BaseLayer pLayer, LayerItem layerItem, boolean b) {\n\t\tString strStyleJson = "";\n\t\tint itemType = layerItem.getItemType();\n int businessType = layerItem.getBusinessType();\n\t\tswitch (itemType) {\n\t\t\tcase LayerItemType.LayerItemVectorCrossType:\n ... // 按需对businessType进行判断,获取指定的json串\n\t\t\t\tstrStyleJson = getStyleBeanJson("vector_cross_layer_style");\n\t\t\t\tbreak;\n\t\t\tcase LayerItemType.xxx:\n\t\t\t\tbreak;\n\t\t}\n\t\treturn strStyleJson;\n\t}\t\n\t...\t\n\t@Override\n public int getMarkerId(BaseLayer pLayer, LayerItem pItem, String strMarkerId, String strMarkerInfo) {\n int markerId = -1;\n strMarkerId = strMarkerId.trim();\n if (strMarkerId.isEmpty()) {\n return markerId;\n } \n ...\n int itemType = layerItem.getItemType();\n int businessType = layerItem.getBusinessType();\n\t\t\n\t\tswitch (itemType) {\n\t\t\tcase LayerItemType.LayerItemVectorCrossType:\n ... // 按需对businessType进行判断\n //判断纹理信息,若未加载则通过addLayerTexture加载纹理\n\t\t\t\tmarkerId = addLayerTexture(texture);\n\t\t\t\tbreak;\n\t\t\tcase LayerItemType.xxx:\n\t\t\t\tmarkerId = -1;\n break;\n\t\t}\n\t\treturn markerId;\n\t}\t\n}
{\n "vector_cross_marker" // 矢量路口大图资源id\n {\n "bg_marker_id":"-1", // 背景资源id\n "bg_marker_info":"",\n "arrow_outer_marker_id":"-1", // 箭头外边线资源id\n "arrow_outer_marker_info":"",\n "arrow_inner_marker_id":"-1", // 箭头内边线资源id\n "arrow_inner_marker_info":"",\n "arrow_3d_marker_id":"-1", // 三维场景箭头资源id,可与"arrow_inner_marker_id"一致\n "arrow_3d_marker_info":"",\n "car_marker_id":"-1", // 车标的资源id\n "car_marker_info":""\n },\n "vector_cross_attr": // 矢量路口大图属性\n {\n "day_mode":"0", // 白天黑夜模式\n "use_style_configure":"1", // 是否使用样式配置(引擎的样式文件)\n "arrow_border_width":"0.0f", // 箭头边线宽度\n "arrow_line_width":"0.0f", // 箭头内部宽度\n "arrow_border_color": // 箭头边线颜色\n {\n "r":"0.0f",\n "g":"0.0f",\n "b":"0.0f",\n "a":"0.0f"\n },\n "arrow_line_color": // 箭头内部颜色\n {\n "r":"0.0f",\n "g":"0.0f",\n "b":"0.0f",\n "a":"0.0f"\n },\n "arrow_line_cap_texture": // 箭头线冒纹理坐标\n {\n "x1":"0.0f",\n "x2":"0.0f",\n "y1":"0.0f",\n "y2":"0.0f"\n },\n "arrow_header_cap_texture": // 箭头头部纹理坐标\n {\n "x1":"0.0f",\n "x2":"0.0f",\n "y1":"0.0f",\n "y2":"0.0f"\n },\n "arrow_line_texture": // 箭头纹理坐标\n {\n "x1":"0.0f",\n "x2":"0.0f",\n "y1":"0.0f",\n "y2":"0.0f",\n "texture_len":"0.0f" // 纹理长度,仅在绘制虚线线型时设置\n },\n "rect": // 背景区域\n {\n "x_min":"0.0f",\n "y_min":"0.0f",\n "x_max":"0.0f",\n "y_max":"0.0f"\n }\n }\n}
"vector_cross_marker"的内容为2D矢量路口大图资源
"vector_cross_attr"的内容为2D矢量路口大图属性
VectorCrossLayerItem的ItemType为LayerItemVectorCrossType
2.1、矢量路口大图(离线场景):调整图层的json文件达到颜色配置
2.1.1、"arrow_inner_marker_id"和"arrow_outer_marker_id"决定箭头纹理
2.1.2、“arrow_line_color”和“arrow_border_color”的内容决定箭头颜色。
2.1.3、"arrow_3d_marker_id"为三维场景下的箭头纹理(可与"arrow_inner_marker_id"一致)
2.2、矢量路口大图(在线场景):由渲染引擎的style样式文件控制,需UED调整样式文件。