/** * 网格绘制 */ import { map } from './index_old'; export default { /** * 绘制网格风险图 * @param {*} points */ drawRectangle: function (points) { const gridViews = []; points.forEach((p) => { const { lb, rt, c } = p; // eslint-disable-next-line no-undef let pList = [lb, rt].map((v) => new AMap.LngLat(v[0], v[1])); // eslint-disable-next-line no-undef var bounds = new AMap.Bounds(...pList); // eslint-disable-next-line no-undef var rectangle = new AMap.Rectangle({ bounds: bounds, // strokeColor: '#ffffffff', strokeWeight: 0, strokeOpacity: 0, // strokeStyle还支持 solid strokeStyle: 'solid', fillColor: '990D0D', fillOpacity: 0.8, cursor: 'pointer', zIndex: 50 }); // var text = new AMap.Text({ // text: p.value, // anchor: 'center', // 设置文本标记锚点 // draggable: false, // style: { // 'background-color': 'transparent', // 'border-width': 0, // 'text-align': 'center', // 'font-size': '12px', // color: 'white' // }, // position: c // }); gridViews.push(rectangle); // that.textView.push(text); }); map.add(gridViews); } };