{"version":"0.1.0","code":"0000","result":true,"message":"处理成功","errdetail":"","timestamp":1671516359675,"data":{"id":71712574,"title":"6.3.3.4扇形(圆)图元","slug":"cxwng3","format":"lake","bookId":26046811,"body":null,"body_draft":null,"body_html":"

场景图

\"image.png\"

说明:扇形(圆)图元SectorLayerItem是基础图层中的基础元素之一,本身派生于基础图元LayerItem,可以用于绘制扇形或圆形,SectorLayerItem还派生了CustomCircleLayerItem自定义扇形(圆)图元供客户端个性化场景下使用特别的,目前仅支持颜色的配置。


时序图


核心参数

字段

含义

com.autonavi.gbl.map.layer.BaseLayer

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

com.autonavi.gbl.map.layer.SectorLayerItem

扇形(圆)图元

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

扇形(圆)图元类型

核心接口

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


void com.autonavi.gbl.map.layer.SectorLayerItem.setRadius(double radius)


double com.autonavi.gbl.map.layer.SectorLayerItem.getRadius()

 

void com.autonavi.gbl.map.layer.SectorLayerItem.setSectorAngles(SectorAngles sectorAngles)


SectorAngles com.autonavi.gbl.map.layer.SectorLayerItem.getSectorAngles()


void  com.autonavi.gbl.map.layer.SectorLayerItem.updateStyle()


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

 

void com.autonavi.gbl.map.layer.SectorLayerItem.setColor(long color)


long com.autonavi.gbl.map.layer.SectorLayerItem.getColor()


其他核心接口能力,继承自基础图元LayerItem,不再逐一列举。

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

代码示例

 ...\n \n /**<  添加扇形(圆)图元 */\npublic void addCircleLayerItem() {\n\n\tSectorLayerItem sectorItem = new SectorLayerItem();\n\tsectorItem.setID("id5");\n\tsectorItem.setPriority(5);\n\tsectorItem.setBusinessType(BusinessTypeCircleXXX); // 可以为客户端定义的扇形(圆)业务类型常量\n\tCoord3DDouble center = new Coord3DDouble(116.475064,39.995137, 0.0);\n\tsectorItem.setRadius(500.0);\n\tsectorItem.setPosition(center);\n\tSectorAngles angles = new SectorAngles();\n\tangles.startAngle = 0.0;\n\tangles.endAngle = 360.0;\n\tangles.stepAngle = 1.0;\n\tsectorItem.setSectorAngles(angles);\n\tmBaseLayer.addItem(sectorItem);\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.LayerItemSectorType:\n                ... // 按需对businessType进行判断,获取指定的json串\n\t\t\t\tstrStyleJson = getStyleBeanJson("sector_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}\n\n...


JSON配置

关键字说明

设置项

函数

说明

优先级

priority

如果没有指定优先级,使用默认优先级(非必填)

颜色

color

RGBA颜色值,如0x7700ab81,紫色

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

{\n    "sector_layer_item_style":{\n        "priority":0,           //优先级,可不设\n        "color":"0x770f0b01"    //颜色\n    }\n}

精简版示例(只配置颜色)

    "sector_demo_style":{\n        "sector_layer_item_style":{\n            "color":"0x5990b8f5"\n        }\n    }


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