面覆盖物支持圆circle和多边形polygon两类
示例代码如下:
mapcomponent({onready:async(err, mapcontroller)=>{if(!err){this.mapcontroller= mapcontroller;// 带有描边的圆letstroke:stroke=newstroke({strokewidth:12,color:'#f00',strokestyle:'square'});this.circle=newcircle({center:newlatlng(39.915935,116.402119),fillcolor:'rgba(200, 120, 56, 0.5)',radius:6000,stroke: stroke});this.circle.setcenter(newlatlng(39.916935,116.372119));this.circle.setfillcolor('#0ff');this.mapcontroller?.addoverlay(this.circle);}},mapoptions:this.mapopt}).width('100%').height('100%')
示例代码如下:
mapcomponent({onready:(err,mapcontroller:mapcontroller)=>{if(mapcontroller){this.mapcontroller= mapcontroller;// 添加多边形覆盖物letpatharr:latlng[]=[newlatlng(39.9122,116.2575),newlatlng(40.0191,116.4624),newlatlng(39.913506,116.4955)];this.polygon=newpolygon({points: patharr,fillcolor:'#0f0',stroke:newstroke({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%')
上一篇
下一篇
本篇文章对您是否有帮助?