This commit is contained in:
parent
e97173cf1d
commit
668ad34ea2
|
@ -1161,7 +1161,7 @@ const getData = async (i, e) => {
|
|||
"100nlPercent",
|
||||
];
|
||||
if (res.data.ageGroupsPercent) {
|
||||
console.log(PopulationRatio.value[0].progress);
|
||||
// console.log(PopulationRatio.value[0].progress);
|
||||
agename.forEach((key, index) => {
|
||||
if (PopulationRatio.value[index]) {
|
||||
PopulationRatio.value[index].progress =
|
||||
|
@ -1309,7 +1309,6 @@ const getDatas = async (e, i) => {
|
|||
"100nlPercent",
|
||||
];
|
||||
if (res.data.ageGroupsPercent) {
|
||||
console.log(PopulationRatio.value[0].progress);
|
||||
agename.forEach((key, index) => {
|
||||
if (PopulationRatio.value[index]) {
|
||||
PopulationRatio.value[index].progress =
|
||||
|
@ -1391,7 +1390,6 @@ const getDatas2 = async (e, i, cs) => {
|
|||
"100nlPercent",
|
||||
];
|
||||
if (res.data.ageGroupsPercent) {
|
||||
console.log(PopulationRatio.value[0].progress);
|
||||
agename.forEach((key, index) => {
|
||||
if (PopulationRatio.value[index]) {
|
||||
PopulationRatio.value[index].progress =
|
||||
|
@ -1742,7 +1740,6 @@ const to_jd = (item_name) => {
|
|||
//详情
|
||||
const open_detail = () => {
|
||||
dialogShow.value = true;
|
||||
console.log(1111111111, dialogShow.value);
|
||||
};
|
||||
const close = () => {
|
||||
dialogShow.value = false;
|
||||
|
@ -1826,20 +1823,65 @@ const addggfwq = () => {
|
|||
const average = sum / numericCoordinates.length; // 计算平均值
|
||||
return parseFloat(average.toFixed(5)); // 保留5位小数并转换为数字
|
||||
}
|
||||
|
||||
data.fwqCoordinates1 = calculateAverage(data.fwqCoordinates1);
|
||||
data.fwqCoordinates2 = calculateAverage(data.fwqCoordinates2);
|
||||
|
||||
drawACircle();
|
||||
let distances = []; // 初始化距离数组
|
||||
fwqList.value.forEach((item) => {
|
||||
let distance = algorithm(
|
||||
(item.point[0] = Number(item.point[0].replace(/[^0-9.-]/g, ""))),
|
||||
(item.point[1] = Number(item.point[1].replace(/[^0-9.-]/g, ""))),
|
||||
data.fwqCoordinates1,
|
||||
data.fwqCoordinates2
|
||||
);
|
||||
distances.push(distance); // 将距离存入数组
|
||||
});
|
||||
let maxDistance = Math.max(...distances); // 找到最大距离
|
||||
maxDistance = Math.ceil(maxDistance * 1.8); // 向上取整
|
||||
if (maxDistance < 100) {
|
||||
maxDistance = 150; // 如果小于 100,则赋值为 150
|
||||
}
|
||||
console.log("最大距离:", maxDistance);
|
||||
drawACircle(maxDistance);
|
||||
} else {
|
||||
ElMessage.warning("无数据");
|
||||
}
|
||||
};
|
||||
//计算两点之间直线距离
|
||||
const algorithm = (point1, point2, point3, point4) => {
|
||||
// console.log(point1, point2, point3, point4, 5555);
|
||||
let [x1, y1] = [point1, point2];
|
||||
let [x2, y2] = [point3, point4];
|
||||
let Lat1 = rad(x1); // 纬度
|
||||
let Lat2 = rad(x2);
|
||||
let a = Lat1 - Lat2; // 两点纬度之差
|
||||
let b = rad(y1) - rad(y2); // 经度之差
|
||||
let s =
|
||||
2 *
|
||||
Math.asin(
|
||||
Math.sqrt(
|
||||
Math.pow(Math.sin(a / 2), 2) +
|
||||
Math.cos(Lat1) * Math.cos(Lat2) * Math.pow(Math.sin(b / 2), 2)
|
||||
)
|
||||
);
|
||||
// 计算两点距离的公式
|
||||
s = s * 6378137.0; // 弧长等于弧度乘地球半径(半径为米)
|
||||
s = Math.round(s * 10000) / 10000; // 精确距离的数值
|
||||
return s;
|
||||
};
|
||||
|
||||
// 角度转换成弧度
|
||||
const rad = (d) => {
|
||||
return (d * Math.PI) / 180.0;
|
||||
};
|
||||
|
||||
// 添加服务圈
|
||||
const drawACircle = (v) => {
|
||||
const drawACircle = (maxDistance) => {
|
||||
// console.log("经纬度1", data.fwqCoordinates1, data.fwqCoordinates2);
|
||||
if (!circle) {
|
||||
var point = new BMapGL.Point(data.fwqCoordinates1, data.fwqCoordinates2);
|
||||
circle = new BMapGL.Circle(point, 1000, {
|
||||
circle = new BMapGL.Circle(point, maxDistance, {
|
||||
strokeColor: "yellow",
|
||||
strokeWeight: 2,
|
||||
strokeOpacity: 0.8,
|
||||
|
@ -2185,7 +2227,6 @@ const createCustomOverlayJd2 = (polygon, indexx) => {
|
|||
}
|
||||
let num = "";
|
||||
if (choose.value.person == "6666") {
|
||||
console.log(1);
|
||||
num = "swrs";
|
||||
} else if (
|
||||
choose.value.person == "cjr" ||
|
||||
|
@ -2249,7 +2290,7 @@ const loadCs = (name) => {
|
|||
};
|
||||
//添加村社区块
|
||||
const addPolygonCountyCs = () => {
|
||||
console.log(11111111111111, xkzDk);
|
||||
// console.log(11111111111111, xkzDk);
|
||||
xkzDk.map((item, index) => {
|
||||
let num = index % 9;
|
||||
let fillColor = colorList[num].bg;
|
||||
|
|
Loading…
Reference in New Issue