{"version":"0.1.0","code":"0000","result":true,"message":"处理成功","errdetail":"","timestamp":1671516357188,"data":{"id":71712566,"title":"6.3.3.1点图元","slug":"uwk3lb","format":"lake","bookId":26046811,"body":null,"body_draft":null,"body_html":"

场景图

\"image.png\"

    \"image.png\"


说明:点图元PointLayerItem是基础图层中的基础元素之一,本身派生于基础图元LayerItem,同时所有扎点类业务图元,如巡航拥堵气泡、巡航交通事件、自定义扎点、终点等等扎点类业务图元都派生自点图元PointLayerItem

时序图


核心参数

字段

含义

com.autonavi.gbl.map.layer.BaseLayer

基础图层,item必须附加在Layer上

com.autonavi.gbl.map.layer.PointLayerItem

点图元

com.autonavi.gbl.map.layer.model.LayerItemType.LayerItemPointType

图元类型:点类型

com.autonavi.gbl.map.layer.model.LayerItemPoiAnimation具体常量值

public final class LayerItemPoiAnimation {\n\tpublic final static int AUTO_UNKNOWN_ERROR = Integer.MIN_VALUE;\t\t/*< 非法操作错误 */\n\tpublic final static int LayerItemPOIAnimationNone = 0;\t\t\t\t/*< 无动画 */\n\tpublic final static int LayerItemPOIAnimationDrop = 1;\t\t\t\t/*< 掉落动画 */\n\tpublic final static int LayerItemPOIAnimationGrow = 2;\t\t\t\t/*< 长出动画 */\n\tpublic final static int LayerItemPOIAnimationBounce = 3;\t\t\t    /*< 弹跳 */\n\tpublic final static int LayerItemPOIAnimationDropAndOverShoot = 4;\t/*< 奚落刷出动画 */\n\tpublic final static int LayerItemPOIAnimationDoubleRaise = 5;\t\t/*< 弹跳两下 */\n\tpublic final static int LayerItemPOIAnimationFade = 6;\t\t\t\t/*< 淡入淡出动画 */\n\tpublic final static int LayerItemPOIAnimationPopOut = 7;\t\t\t\t/*< 跳出动画,放大的同时上升,然后下落, 然后挤压回弹 */\n\tpublic final static int LayerItemPOIAnimationExpandLong = 8;\t\t\t/*< 连续放大缩小,共5段 */\n\tpublic final static int LayerItemPOIAnimationExpandShort = 9;\t\t/*< 连续放大缩小,共3段 */\n\tpublic final static int LayerItemPOIAnimationShrink = 10;\t\t\t/*< 缩放为0 */\n}

核心接口

void com.autonavi.gbl.map.layer.PointLayerItem.setVisible3V(Visible3V visible3V)

void com.autonavi.gbl.map.layer.PointLayerItem.setBillboard(boolean isBillboard)

     void com.autonavi.gbl.map.layer.PointLayerItem.setPosition3D(Coord3DDouble pos)

void com.autonavi.gbl.map.layer.PointLayerItem.setPosition(Coord3DDouble pos)

void com.autonavi.gbl.map.layer.PointLayerItem.setScale(ScalePriority priority, ScaleInfo3D scale)

void com.autonavi.gbl.map.layer.LayerItem.setAnimation(LayerItemPoiAnimation animation,int duration)

LayerItemType com.autonavi.gbl.map.layer.PointLayerItem.getItemType()


     等等诸多核心接口能力,不再逐一列举。

说明:函数详情,请复制函数名称到在线API搜索

代码示例

...\n    \n/**< 更新点数据信息 */\npublic void updatePointInfo(ArrayList<BizPointBusinessInfo> pointList) {\n    ...\n        ArrayList<LayerItem> items = new ArrayList<>();\n    for (int i = 0; i < pointList.size(); i++) {\n        PointLayerItem item = new PointLayerItem();\n        if (item != null) {\n            String id = pointList.get(i).id;\n            if (id.isEmpty()) {\n                id = String.valueOf(i);\n            }\n            item.setID(id); //id必须唯一\n            item.setBusinessType(BusinessTypePointXXX); // 由客户端定义的点业务类型\n            item.setPriority(i);\n            item.setPosition(pointList.get(i).mPos3D);\n            items.add(item);\n        }\n    }\n    \n    mBaseLayer.addItems(items)\n    ...\n}\n\n/* 回调获取点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.LayerItemPointType:\n                ... // 按需对businessType进行判断,获取指定的json串\n\t\t\t\tstrStyleJson = getStyleBeanJson("point_layer_item_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.LayerItemPointType:\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\n...

JSON配置

关键字说明

设置项

函数

说明

优先级

priority

默认值为0,值越大在同个图层内,显示优先级越高

旋转角度

angle

默认值为0.0,值越大旋转角度越大,取值范围[0,360]

显示状态

is_billboard

1:直立(默认)

0:趴下

状态

normal_style普通态

focus_style焦点态

poi_marker_id       点图元纹理名称

poi_marker_info    点图元纹理属性描述

bg_marker_id        背景纹理名称

bg_marker_info     背景纹理属性描述

bubble_marker_id  气泡纹理名称

bubble_marker_info气泡纹理属性描述

poi_texture            点图元纹理信息

bg_texture            背景纹理信息

bubble_texture      气泡纹理信息

碰撞区域

collision_region

碰撞矩形区域配置,如[0,0,100,100]

可忽略区域

ignore_region

可设置忽略矩形区域,点击不可响应 如[0,80,268,100]

json全量配置(各字段说明)

{\n    "point_layer_item_style":\n    {\n        "priority":0,                           //优先级,可不设\n        "angle":0.0,                            //绘制的旋转角度,取值范围为[0,360],可不设\n        "is_billboard":1,                       //1直立(效果为贴在屏幕上) 0趴下(效果为贴在地图上),可不设\n        "normal_style":                         //普通态相关\n        {\n            "poi_marker_id":"poi_normal",       //点图元纹理\n            "poi_marker_info":"",               //点图元纹理属性描述,一般用于描述纹理加载要用的信息(如锚点相关),可不设\n            "bg_marker_id":"bg_normal",         //背景纹理,可不设\n            "bg_marker_info":"",                //背景纹理属性描述,一般用于描述纹理加载要用的信息(如锚点相关),可不设\n            "bubble_marker_id":"bubble_normal", //气泡纹理,可不设\n            "bubble_marker_info":"",            //气泡纹理属性描述,一般用于描述纹理加载要用的信息(如锚点相关),可不设\n            "poi_texture":                      //点图元纹理信息:纹理坐标+缩放值,可不设,不设置则默认使用整张图片\n            {\n                "x1":0.0,   \t\t                //纹理信息左上角x值,屏幕坐标系\n                "y1":0.0,\t\t                    //纹理信息左上角y值,屏幕坐标系\n                "x2":1.0,\t                      //纹理信息右下角x值,屏幕坐标系\n                "y2":1.0,                       //纹理信息右下角y值,屏幕坐标系\n                "scale":1.0                     //纹理缩放值\n            },\n            "bg_texture":                       //背景纹理纹理信息:纹理坐标+缩放值,可不设,不设置则默认使用整张图片\n            {\n                "x1":0.0,\t\t\t\t\t              //纹理信息左上角x值,屏幕坐标系\n                "y1":0.0,\t\t                    //纹理信息左上角y值,屏幕坐标系\n                "x2":1.0,\t                      //纹理信息右下角x值,屏幕坐标系\n                "y2":1.0,                       //纹理信息右下角y值,屏幕坐标系\n                "scale":1.0                     //纹理缩放值\n            },\n            "bubble_texture":                   //气泡纹理纹理信息:纹理坐标+缩放值,可不设,不设置则默认使用整张图片\n            {\n                "x1":0.0,\t\t\t\t\t              //纹理信息左上角x值,屏幕坐标系\n                "y1":0.0,\t\t                    //纹理信息左上角y值,屏幕坐标系\n                "x2":1.0,\t                      //纹理信息右下角x值,屏幕坐标系\n                "y2":1.0,                       //纹理信息右下角y值,屏幕坐标系\n                "scale":1.0                     //纹理缩放值\n            },\n            "poi_show_rect":                    //点图元纹理可视范围,可不设\n            {\n                "x1":0.0,                       //纹理信息左上角x值,屏幕坐标系\n                "y1":0.0,                       //纹理信息左上角y值,屏幕坐标系\n                "x2":1.0,                       //纹理信息右下角x值,屏幕坐标系\n                "y2":1.0                        //纹理信息右下角y值,屏幕坐标系\n            },\n            "bg_show_rect":                     //背景纹理可视范围,可不设\n            {\n                "x1":0.0,                       //纹理信息左上角x值,屏幕坐标系\n                "y1":0.0,                       //纹理信息左上角y值,屏幕坐标系\n                "x2":1.0,                       //纹理信息右下角x值,屏幕坐标系\n                "y2":1.0                        //纹理信息右下角y值,屏幕坐标系\n            },\n            "bubble_show_rect":                 //气泡纹理可视范围,可不设\n            {\n                "x1":0.0,                       //纹理信息左上角x值,屏幕坐标系\n                "y1":0.0,                       //纹理信息左上角y值,屏幕坐标系\n                "x2":1.0,                       //纹理信息右下角x值,屏幕坐标系\n                "y2":1.0                        //纹理信息右下角y值,屏幕坐标系\n            }\n        },\n        "focus_style":                          //焦点态相关,不设置则点击后的焦点态效果与普通态一致\n        {\n            "poi_marker_id":"poi_focus",        //点图元纹理\n            "poi_marker_info":"",               //点图元纹理属性描述,一般用于描述纹理加载要用的信息(如锚点相关),可不设\n            "bg_marker_id":"bg_focus",          //背景纹理,可不设\n            "bg_marker_info":"",                //背景纹理属性描述,一般用于描述纹理加载要用的信息(如锚点相关),可不设\n            "bubble_marker_id":"bubble_focus",  //气泡纹理,可不设\n            "bubble_marker_info":"",            //气泡纹理属性描述,一般用于描述纹理加载要用的信息(如锚点相关),可不设\n            "poi_texture":                      //点图元纹理信息:纹理坐标+缩放值,可不设,不设置则默认使用整张图片\n            {\n                "x1":0.0,                       //纹理信息左上角x值,屏幕坐标系\n                "y1":0.0,                       //纹理信息左上角y值,屏幕坐标系\n                "x2":1.0,                       //纹理信息右下角x值,屏幕坐标系\n                "y2":1.0,                       //纹理信息右下角y值,屏幕坐标系\n                "scale":1.0\n            },\n            "bg_texture":                       //背景纹理纹理信息:纹理坐标+缩放值,可不设,不设置则默认使用整张图片\n            {\n                "x1":0.0,                       //纹理信息左上角x值,屏幕坐标系\n                "y1":0.0,                       //纹理信息左上角y值,屏幕坐标系\n                "x2":1.0,                       //纹理信息右下角x值,屏幕坐标系\n                "y2":1.0,                       //纹理信息右下角y值,屏幕坐标系\n                "scale":1.0\n            },\n            "bubble_texture":                   //气泡纹理纹理信息:纹理坐标+缩放值,可不设,不设置则默认使用整张图片\n            {\n                "x1":0.0,                       //纹理信息左上角x值,屏幕坐标系\n                "y1":0.0,                       //纹理信息左上角y值,屏幕坐标系\n                "x2":1.0,                       //纹理信息右下角x值,屏幕坐标系\n                "y2":1.0,                       //纹理信息右下角y值,屏幕坐标系\n                "scale":1.0\n            },\n            "poi_show_rect":                    //点图元纹理可视范围,可不设\n            {\n                "x1":0.0,                       //纹理信息左上角x值,屏幕坐标系\n                "y1":0.0,                       //纹理信息左上角y值,屏幕坐标系\n                "x2":1.0,                       //纹理信息右下角x值,屏幕坐标系\n                "y2":1.0                        //纹理信息右下角y值,屏幕坐标系\n            },\n            "bg_show_rect":                     //背景纹理可视范围,可不设\n            {\n                "x1":0.0,                       //纹理信息左上角x值,屏幕坐标系\n                "y1":0.0,                       //纹理信息左上角y值,屏幕坐标系\n                "x2":1.0,                       //纹理信息右下角x值,屏幕坐标系\n                "y2":1.0                        //纹理信息右下角y值,屏幕坐标系\n            },\n            "bubble_show_rect":                 //气泡纹理可视范围,可不设\n            {\n                "x1":0.0,                       //纹理信息左上角x值,屏幕坐标系\n                "y1":0.0,                       //纹理信息左上角y值,屏幕坐标系\n                "x2":1.0,                       //纹理信息右下角x值,屏幕坐标系\n                "y2":1.0                        //纹理信息右下角y值,屏幕坐标系\n            }\n        },\n        "collision_region":                     //碰撞区域配置,可不设\n        {\n            "x":0,                              //碰撞区域左上角x值,屏幕坐标系\n            "y":0,                              //碰撞区域左上角y值,屏幕坐标系\n            "width":100,                        //碰撞区域宽度,屏幕坐标系\n            "height":100                        //碰撞区域高度,屏幕坐标系\n        },\n        "ignore_region":                        //忽略区域配置,可不设\n        {\n            "ignore_type":0,                    //忽略区域类型\n            "x":0,                              //忽略区域左上角x值,屏幕坐标系\n            "y":0,                              //忽略区域左上角y值,屏幕坐标系\n            "width":100,                        //忽略区域宽度,屏幕坐标系\n            "height":100                        //忽略区域宽度,屏幕坐标系\n        }\n    }\n}

精简版示例(只绘制一张纹理)

    "point_click":{\n        "point_layer_item_style":{\n            "normal_style":{\n                "poi_marker_id":"global_image_bubble_child_day_night"\n            }\n        }\n    }

举例1:沿途某天气类型点扎标的json配置

 ...   \n"point_route_weather_300_301_302": {\n      "point_layer_item_style": {\n        "normal_style": {\n          "poi_marker_id": "global_image_default_path_weather_300_301_302_normal",\n          "poi_marker_info": "path_weather_x_y",\n          "bg_marker_id": "global_image_default_path_weather_leftup_day"\n        },\n        "focus_style": {\n          "poi_marker_id": "id_dynamic_focus"\n        }\n      }\n    },\n\t\t"path_weather_x_y": {\n            "anchor": 9,\n            "x_ratio": 0.87,\n            "y_ratio": 0.88\n        },\n...

其中"poi_marker_info"对应的内容会出现在IPrepareLayerStyle.getMarkerId回调中,由HMI解析,用于添加纹理接口MapView.addLayerTexture的传参

"poi_marker_id"与"poi_marker_info"配对,"bg_marker_id"与"bg_marker_info"配对


举例2:如终点区域父POI点扎标Json配置

...\n"point_end_area_parent_point": {\n      "point_layer_item_style": {\n        "priority": 0,\n        "angle": 0.0,\n        "is_billboard": 1,\n        "normal_style": {\n          "bubble_marker_id": 2006,\n          "poi_texture": {\n            "x1": 0.0,\n            "y1": 0.0,\n            "x2": 1.0,\n            "y2": 1.0,\n            "scale": 1.0\n          },\n          "bg_texture": {\n            "x1": 0.5,\n            "y1": 0.5,\n            "x2": 1.0,\n            "y2": 1.0,\n            "scale": 1.0\n          },\n          "bubble_texture": {\n            "x1": 0.0,\n            "y1": 0.0,\n            "x2": 1.0,\n            "y2": 1.0,\n            "scale": 1.0\n          }\n        },\n        "collision_region": {\n          "x": 0,\n          "y": 0,\n          "width": 100,\n          "height": 100\n        }\n      }\n    },\n...


","body_lake":null,"pub_level":null,"status":"0","updated_at":"2022-04-06 07:03:46","deleted_at":null,"nameSpace":"mnlcaa/v610","browseCount":153,"collectCount":0,"estimateDate":27,"docStatus":0,"permissions":true,"overView":false}}