Merge branch 'main' of https://git.cityme.com.cn/xiangshan/ggfwjsc
This commit is contained in:
commit
9e90543007
|
@ -922,6 +922,9 @@ const getCssj = async () => {
|
|||
}
|
||||
});
|
||||
};
|
||||
/**
|
||||
* 地块编辑
|
||||
*/
|
||||
//移动模式
|
||||
const movemode = () => {
|
||||
drawing.value = true;
|
||||
|
@ -954,25 +957,26 @@ const polyLayer = new BMapGL.GeoJSONLayer("poly", {
|
|||
polygonStyle: normalStyle,
|
||||
});
|
||||
const setActiveStyle = (overlay) => {
|
||||
polyLayer.resetStyle();
|
||||
overlay.setOptions(activeStyle);
|
||||
// polyLayer.resetStyle();
|
||||
// overlay.setOptions(activeStyle);
|
||||
};
|
||||
//监听事件
|
||||
const clickHandler = (e) => {
|
||||
console.log(5555);
|
||||
console.log(5555, e);
|
||||
let target = polyLayer.pickOverlays(e.target);
|
||||
if (target && target[0]) {
|
||||
selectedOverlay = target[0];
|
||||
console.log("5-1", selectedOverlay);
|
||||
// nextTick(() => {
|
||||
setActiveStyle(selectedOverlay);
|
||||
movepoy.open(selectedOverlay);
|
||||
// });
|
||||
// setActiveStyle(selectedOverlay);
|
||||
movepoy.open(selectedOverlay, call());
|
||||
} else {
|
||||
console.log("5-2");
|
||||
|
||||
polyLayer.resetStyle();
|
||||
}
|
||||
};
|
||||
const call = () => {
|
||||
console.log("执行");
|
||||
};
|
||||
//开始平移
|
||||
const moveEdit = () => {
|
||||
console.log(11111, cs_choose_arr.value[0]);
|
||||
|
@ -980,28 +984,31 @@ const moveEdit = () => {
|
|||
if (currentMarker !== null) {
|
||||
map.removeOverlay(currentMarker);
|
||||
}
|
||||
//初始化
|
||||
selectedOverlay = null;
|
||||
sceneMove = null;
|
||||
movepoy = null;
|
||||
select = null;
|
||||
|
||||
map.addGeoJSONLayer(polyLayer);
|
||||
polyLayer.addOverlay(cs_choose_arr.value[0]);
|
||||
sceneMove = new DrawScene(map);
|
||||
movepoy = new PolygonMove(sceneMove);
|
||||
|
||||
movepoy.setCurrentModel(PolygonMove.MODEL.MOVE);
|
||||
select = new Select(sceneMove, {
|
||||
type: DrawingType.DRAWING_POINT,
|
||||
});
|
||||
select.open();
|
||||
// select = new Select(sceneMove, {
|
||||
// type: DrawingType.DRAWING_POINT,
|
||||
// });
|
||||
// select.open();
|
||||
polyLayer.resetStyle();
|
||||
sceneMove.addEventListener(OperateEventType.CLICK, clickHandler);
|
||||
};
|
||||
//取消移动
|
||||
const moveCancel = () => {
|
||||
movepoy.close();
|
||||
sceneMove.removeEventListener(OperateEventType.CLICK, clickHandler);
|
||||
polyLayer.resetStyle();
|
||||
//取消第二次点击时,移动问题
|
||||
polyLayer.removeOverlay(cs_choose_arr.value[0]);
|
||||
map.removeGeoJSONLayer(polyLayer);
|
||||
//-------
|
||||
cs_choose_arr.value.forEach((item, index) => {
|
||||
map.removeOverlay(cs_choose_arr.value[index]);
|
||||
});
|
||||
|
@ -1009,12 +1016,11 @@ const moveCancel = () => {
|
|||
};
|
||||
//保存移动
|
||||
const moveSave = () => {
|
||||
console.log(22222, cs_choose_arr.value[0]);
|
||||
// select.close();
|
||||
// movepoy.close(selectedOverlay);
|
||||
polyLayer.resetStyle();
|
||||
arrJWD = [[[]]];
|
||||
movepoy.close();
|
||||
sceneMove.removeEventListener(OperateEventType.CLICK, clickHandler);
|
||||
polyLayer.removeOverlay(cs_choose_arr.value[0]);
|
||||
map.removeGeoJSONLayer(polyLayer);
|
||||
cs_choose_arr.value[0].points.forEach((item, index) => {
|
||||
let arr1 = [];
|
||||
arr1.push(item?.latLng.lng);
|
||||
|
@ -1028,12 +1034,14 @@ const moveSave = () => {
|
|||
//退出移动模式
|
||||
const moveBack = () => {
|
||||
// select.close();
|
||||
movepoy.close();
|
||||
sceneMove.removeEventListener(OperateEventType.CLICK, clickHandler);
|
||||
polyLayer.resetStyle();
|
||||
// cs_choose_arr.value.forEach((item, index) => {
|
||||
// map.removeOverlay(cs_choose_arr.value[index]);
|
||||
// });
|
||||
// addCsChoose();
|
||||
polyLayer.removeOverlay(cs_choose_arr.value[0]);
|
||||
map.removeGeoJSONLayer(polyLayer);
|
||||
cs_choose_arr.value.forEach((item, index) => {
|
||||
map.removeOverlay(cs_choose_arr.value[index]);
|
||||
});
|
||||
addCsChoose();
|
||||
move_mode.value = false;
|
||||
drawing.value = false;
|
||||
};
|
||||
|
@ -1370,6 +1378,9 @@ const addBack = () => {
|
|||
map.removeOverlay(currentMarker);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* 地图编辑结束
|
||||
*/
|
||||
//点击龙游县初始化
|
||||
const csh = () => {
|
||||
clear();
|
||||
|
|
Loading…
Reference in New Issue