This commit is contained in:
姚宇浩 2024-07-24 15:50:55 +08:00
parent fd53ee78bf
commit 97c8e04edc
1 changed files with 60 additions and 22 deletions

View File

@ -341,7 +341,7 @@ const BMAP = () => {
// console.log(e.point.latLng.lng,e.point.latLng.lat, 666); // console.log(e.point.latLng.lng,e.point.latLng.lat, 666);
// var pt = e.point; // // var pt = e.point; //
map.addOverlay(marker); map.addOverlay(marker);
var marker = new BMapGL.Marker(new BMapGL.Point(e.point.lng,e.point.lat)); // var marker = new BMapGL.Marker(new BMapGL.Point(e.point.lng, e.point.lat)); //
// var marker = new BMapGL.Marker(pt); // // var marker = new BMapGL.Marker(pt); //
map.addOverlay(marker); // map.addOverlay(marker); //
}); });
@ -385,6 +385,7 @@ const addPolygonCounty = () => {
map.clearOverlays(); map.clearOverlays();
let fillColor = "#ffffff"; let fillColor = "#ffffff";
mapTownDataDK.map((item) => { mapTownDataDK.map((item) => {
item.leg = 0;
// //
let points = []; let points = [];
item.point.map((p) => points.push(new BMapGL.Point(...p))); item.point.map((p) => points.push(new BMapGL.Point(...p)));
@ -397,33 +398,37 @@ const addPolygonCounty = () => {
fillColor: fillColor, fillColor: fillColor,
fillOpacity: 0.7, fillOpacity: 0.7,
name: item.name, name: item.name,
zIndex: 92,
}); });
map.addOverlay(polygon); map.addOverlay(polygon);
polygon.addEventListener("click", () => { polygon.addEventListener("click", () => {
console.log(item.name); console.log(item.name);
let jdCenter = []; if (title_choose.value.includes("溪口镇")) {
if (item.name == "溪口镇") {
if (!title_choose.value.includes("溪口镇")) {
title_choose.value = title_choose.value + `>${item.name}`;
}
loadCs();
addPolygonCountyCs();
mapTownCount.map((item) => {
if (item.name == "溪口镇") {
jdCenter = item.center;
}
});
addCs();
goMapCenter(jdCenter, 13);
} else { } else {
title_choose.value='龙游县' let jdCenter = [];
cs_qk_arr.value.forEach((item, index) => { if (item.name == "溪口镇") {
map.removeOverlay(cs_qk_arr.value[index]); if (!title_choose.value.includes("溪口镇")) {
}); title_choose.value = title_choose.value + `>${item.name}`;
cs_name_arr.value.forEach((item, index) => { }
map.removeOverlay(cs_name_arr.value[index]); loadCs();
}); addPolygonCountyCs();
mapTownCount.map((item) => {
if (item.name == "溪口镇") {
jdCenter = item.center;
}
});
addCs();
goMapCenter(jdCenter, 13);
} else {
title_choose.value = "龙游县";
cs_qk_arr.value.forEach((item, index) => {
map.removeOverlay(cs_qk_arr.value[index]);
});
cs_name_arr.value.forEach((item, index) => {
map.removeOverlay(cs_name_arr.value[index]);
});
}
} }
}); });
} }
@ -484,8 +489,35 @@ const addPolygonCountyCs = () => {
fillColor: fillColor, fillColor: fillColor,
fillOpacity: 0.7, fillOpacity: 0.7,
name: item.name, name: item.name,
zIndex: 99,
}); });
map.addOverlay(cs_qk_arr.value[index]); map.addOverlay(cs_qk_arr.value[index]);
cs_qk_arr.value[index].addEventListener("click", () => {
console.log(111);
// let jdCenter = [];
// if (item.name == "") {
// if (!title_choose.value.includes("")) {
// title_choose.value = title_choose.value + `>${item.name}`;
// }
// loadCs();
// addPolygonCountyCs();
// mapTownCount.map((item) => {
// if (item.name == "") {
// jdCenter = item.center;
// }
// });
// addCs();
// goMapCenter(jdCenter, 13);
// } else {
// title_choose.value = "";
// cs_qk_arr.value.forEach((item, index) => {
// map.removeOverlay(cs_qk_arr.value[index]);
// });
// cs_name_arr.value.forEach((item, index) => {
// map.removeOverlay(cs_name_arr.value[index]);
// });
// }
});
} }
}); });
}; };
@ -935,6 +967,12 @@ const changeRs = (id) => {
cs_name_arr.value.length = 0; cs_name_arr.value.length = 0;
addCs2(); addCs2();
} }
if (jdm_number_arr.value?.length) {
jdm_number_arr.value.forEach((item, index) => {
map.removeOverlay(jdm_number_arr.value[index]);
});
jdm_number_arr.value.length = 0;
}
addJd2(); addJd2();
// removeAllPolygon("person"); // removeAllPolygon("person");
// xuanran(); // xuanran();