android绘制矢量图地图,绘制矢量图形-矢量图形-示例中心-JS API 2.0 示例 | 高德地图API...

html,

body,

#container {

width: 100%;

height: 100%;

}

椭圆的绘制和编辑
利用mouseTool绘制覆盖物

绘制线段

绘制多边形

绘制矩形

绘制圆形

var map = new AMap.Map("container", {

center: [116.434381, 39.898515],

zoom: 14

});

var mouseTool = new AMap.MouseTool(map)

function drawPolyline () {

mouseTool.polyline({

strokeColor: "#3366FF",

strokeOpacity: 1,

strokeWeight: 6,

// 线样式还支持 'dashed'

strokeStyle: "solid",

// strokeStyle是dashed时有效

// strokeDasharray: [10, 5],

})

}

function drawPolygon () {

mouseTool.polygon({

strokeColor: "#FF33FF",

strokeOpacity: 1,

strokeWeight: 6,

strokeOpacity: 0.2,

fillColor: '#1791fc',

fillOpacity: 0.4,

// 线样式还支持 'dashed'

strokeStyle: "solid",

// strokeStyle是dashed时有效

// strokeDasharray: [30,10],

})

}

function drawRectangle () {

mouseTool.rectangle({

strokeColor:'red',

strokeOpacity:0.5,

strokeWeight: 6,

fillColor:'blue',

fillOpacity:0.5,

// strokeStyle还支持 solid

strokeStyle: 'solid',

// strokeDasharray: [30,10],

})

}

function drawCircle () {

mouseTool.circle({

strokeColor: "#FF33FF",

strokeOpacity: 1,

strokeWeight: 6,

strokeOpacity: 0.2,

fillColor: '#1791fc',

fillOpacity: 0.4,

strokeStyle: 'solid',

// 线样式还支持 'dashed'

// strokeDasharray: [30,10],

})

}

mouseTool.on('draw', function(event) {

// event.obj 为绘制出来的覆盖物对象

log.info('覆盖物对象绘制完成')

})

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值