浏览器版本低!无法浏览完整内容,建议升级或更换浏览器。
绘制面
下载开发文档

面覆盖物支持圆Circle和多边形Polygon两类

圆Circle

示例代码如下:

MapComponent({ onReady: async (err, mapController) => {
if(!err){
this.mapController = mapController;
// 带有描边的圆
let stroke:Stroke = new Stroke({
strokeWidth: 12,
color: '#f00',
strokeStyle: 'square'
});
this.circle = new Circle({
center: new LatLng(39.915935, 116.402119),
fillcolor: 'rgba(200, 120, 56, 0.5)',
radius: 6000,
stroke: stroke
});
this.circle.setCenter(new LatLng(39.916935, 116.372119));
this.circle.setFillcolor('#0ff');
this.mapController?.addOverlay(this.circle);
}
}, mapOptions: this.mapOpt}).width('100%').height('100%')
多边形Polygon

示例代码如下:

MapComponent({ onReady: (err,mapController:MapController) => {
if (mapController) {
this.mapController = mapController;
// 添加多边形覆盖物
let pathArr: LatLng[] = [
new LatLng(39.9122, 116.2575),
new LatLng(40.0191, 116.4624),
new LatLng(39.913506, 116.4955)
];
this.polygon = new Polygon({
points: pathArr,
fillcolor: '#0f0',
stroke: new Stroke({
strokeWidth: 12,
color:'#0f0',
strokeStyle: SysEnum.StrokeStyle.SQUARE
})
});
this.polygon.setPoints(pathArr);
this.polygon.setFillcolor('#f9f');
this.mapController.addOverlay(this.polygon);
}
}, mapOptions: this.mapOpt}).width('100%').height('100%')

上一篇

绘制线

下一篇

绘制文字

本篇文章对您是否有帮助?