<template>
|
<div class="p-events-auto">
|
<el-button type="info" icon="Memo" plain @click="drawGrid">
|
绘制网格
|
</el-button>
|
</div>
|
</template>
|
<script setup>
|
import calculate from '@/utils/map/calculate';
|
import grid from '@/utils/map/grid';
|
import { gridData } from '../../../test/grid_test_data';
|
|
function drawGrid() {
|
// const points = gridData.map((v) => {
|
// return calculate.wgs84_To_Gcj02(v[0], v[1]);
|
// });
|
// const p1 = points[0];
|
// const p2 = points[1];
|
// const diffLng = Math.abs(p1[0] - p2[0]);
|
// const diffLat = Math.abs(p1[1] - p2[1]);
|
// const bounds = points.map((v) => {
|
// return {
|
// // 东经,北纬情况下
|
// lb: [v[0] - diffLng, v[1] - diffLat],
|
// rt: [v[0] + diffLng, v[1] - diffLat],
|
// c: v
|
// };
|
// });
|
|
const bounds = [
|
{
|
lb: [121.360898, 31.222733],
|
rt: [121.364898, 31.226733],
|
c: [121.362898, 31.224733]
|
}
|
];
|
|
grid.drawRectangle(bounds);
|
}
|
</script>
|