This commit is contained in:
姚宇浩 2024-08-20 13:40:53 +08:00
parent a583794cc5
commit c86f041201
1 changed files with 47 additions and 16 deletions

View File

@ -281,6 +281,7 @@ const cs_un_choose_arr = ref([]); //单点社区其他区块(灰色)
const cs_dd_arr = ref([]); // const cs_dd_arr = ref([]); //
// //
const csqk = ref({}); const csqk = ref({});
// var cssj
// //
const title_choose = ref(""); const title_choose = ref("");
const title_jd = ref(""); const title_jd = ref("");
@ -803,28 +804,45 @@ const initMap = () => {
// //
addJd(); addJd();
}; };
function mercatorToLngLat(mercator) { const getCssj=()=>{
var x = mercator.lng / 20037508.34 * 180; http.get("/api/ggfwyth/regionalDivision/getCsRegionalDivision").then((res) => {
var y = mercator.lat / 20037508.34 * 180; if(res.code == 200){
y = 180 / Math.PI * (2 * Math.atan(Math.exp(y * Math.PI / 180)) - Math.PI / 2); cssj=JSON.parse(res.data);
return { }
lng: x, });
lat: y
};
} }
// var arrJWD = [[[]]];
const openEdit = () => { //bd09bd09
console.log(cs_choose_arr.value[0]); const bd09 = async (x, y) => {
cs_choose_arr.value[0].enableEditing(); var ggPoint = new BMapGL.Point(x, y);
var pointArr = [];
// let a=gcj02towgs84(13275212.822414309,3334688.527092757) pointArr.push(ggPoint);
// console.log(a); var convertor = new BMapGL.Convertor();
convertor.translate(pointArr, COORDINATES_BD09_MC, COORDINATES_BD09, (e) => {
let arr1 = [];
arr1.push(e.points[0].lng);
arr1.push(e.points[0].lat);
console.log('arr1',arr1);
arrJWD[0][0].push(arr1);
});
}; };
//
const openEdit = () => {
cs_choose_arr.value[0].enableEditing();
console.log(cs_choose_arr.value[0]);
// bd09(13274780.785348017,3334646.4713317254);
};
// //
const closeEdit = () => { const closeEdit = () => {
cs_choose_arr.value[0].disableEditing(); cs_choose_arr.value[0].disableEditing();
console.log(cs_choose_arr.value[0]); console.log(cs_choose_arr.value[0]);
cs_choose_arr.value[0].points.forEach((item,index) => {
bd09(item.lng, item.lat,index);
});
console.log("arrJWD", arrJWD);
}; };
// //
const csh = () => { const csh = () => {
@ -2500,7 +2518,7 @@ const createCustomOverlayJd2 = (polygon, indexx) => {
// //
const loadCs = (name) => { const loadCs = (name) => {
xkzCenter.length = 0; xkzCenter.length = 0;
xkzDk.length = 0; xkzDk.length = 0;
cssj.forEach((item, index) => { cssj.forEach((item, index) => {
if (item.name == name) { if (item.name == name) {
csqk.value = item.sj; csqk.value = item.sj;
@ -2626,6 +2644,18 @@ const addCsChoose = () => {
zIndex: 99, zIndex: 99,
}); });
map.addOverlay(cs_choose_arr.value[index]); map.addOverlay(cs_choose_arr.value[index]);
cs_choose_arr.value[index].addEventListener("click", (e) => {
console.log(4444444444, e);
// e.overlay
if (e.overlay && e.overlay.type === "Polygon") {
var vertices = e.overlay.getPath(); //
var coordinates = vertices.map(function (point) {
return { lng: point.lng, lat: point.lat };
});
console.log(coordinates); //
}
});
} }
}); });
}; };
@ -3021,6 +3051,7 @@ onMounted(async () => {
getData(); getData();
BMAP(); BMAP();
getFwq(); getFwq();
// getCssj();
await getDataBq(); await getDataBq();
loadingss.value = false; loadingss.value = false;
}); });