ly-front/src/components/map.js

27 lines
576 B
JavaScript

let geojson = [];
//绘制点、线、面、矩形
export function Drawarectangle(type, layer, style) {
// 启动绘制功能
layer.startDraw({
id: type,
// maxPointNum: 2,
type: type,
style: style,
allowDrillPick: false,
clustering: {
clampToGround: true
},
success: function (graphic) {
geojson.push(graphic);
if (type === "rectangle") {
//矩形
} else if (type === "polygon") {
//多边形
} else if (type === "circle") {
//圆
}
window.geojson = geojson;
}
});
}