111
This commit is contained in:
parent
4bcc4eaf5d
commit
09dc8f40f5
|
@ -954,25 +954,28 @@ const polyLayer = new BMapGL.GeoJSONLayer("poly", {
|
||||||
polygonStyle: normalStyle,
|
polygonStyle: normalStyle,
|
||||||
});
|
});
|
||||||
const setActiveStyle = (overlay) => {
|
const setActiveStyle = (overlay) => {
|
||||||
polyLayer.resetStyle();
|
// polyLayer.resetStyle();
|
||||||
overlay.setOptions(activeStyle);
|
// overlay.setOptions(activeStyle);
|
||||||
};
|
};
|
||||||
|
//监听事件
|
||||||
const clickHandler = (e) => {
|
const clickHandler = (e) => {
|
||||||
console.log(5555);
|
console.log(5555,e);
|
||||||
let target = polyLayer.pickOverlays(e.target);
|
let target = polyLayer.pickOverlays(e.target);
|
||||||
if (target && target[0]) {
|
if (target && target[0]) {
|
||||||
selectedOverlay = target[0];
|
selectedOverlay = target[0];
|
||||||
console.log("5-1", selectedOverlay);
|
console.log("5-1", selectedOverlay);
|
||||||
// nextTick(() => {
|
// setActiveStyle(selectedOverlay);
|
||||||
setActiveStyle(selectedOverlay);
|
movepoy.open(selectedOverlay,call());
|
||||||
movepoy.open(selectedOverlay);
|
|
||||||
// });
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
console.log("5-2");
|
console.log("5-2");
|
||||||
|
|
||||||
polyLayer.resetStyle();
|
polyLayer.resetStyle();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const call=()=>{
|
||||||
|
console.log('执行');
|
||||||
|
|
||||||
|
}
|
||||||
//开始平移
|
//开始平移
|
||||||
const moveEdit = () => {
|
const moveEdit = () => {
|
||||||
console.log(11111, cs_choose_arr.value[0]);
|
console.log(11111, cs_choose_arr.value[0]);
|
||||||
|
@ -980,28 +983,27 @@ const moveEdit = () => {
|
||||||
if (currentMarker !== null) {
|
if (currentMarker !== null) {
|
||||||
map.removeOverlay(currentMarker);
|
map.removeOverlay(currentMarker);
|
||||||
}
|
}
|
||||||
|
//初始化
|
||||||
selectedOverlay = null;
|
selectedOverlay = null;
|
||||||
sceneMove = null;
|
sceneMove = null;
|
||||||
movepoy = null;
|
movepoy = null;
|
||||||
select = null;
|
select = null;
|
||||||
|
|
||||||
map.addGeoJSONLayer(polyLayer);
|
map.addGeoJSONLayer(polyLayer);
|
||||||
polyLayer.addOverlay(cs_choose_arr.value[0]);
|
polyLayer.addOverlay(cs_choose_arr.value[0]);
|
||||||
sceneMove = new DrawScene(map);
|
sceneMove = new DrawScene(map);
|
||||||
movepoy = new PolygonMove(sceneMove);
|
movepoy = new PolygonMove(sceneMove);
|
||||||
|
|
||||||
movepoy.setCurrentModel(PolygonMove.MODEL.MOVE);
|
movepoy.setCurrentModel(PolygonMove.MODEL.MOVE);
|
||||||
select = new Select(sceneMove, {
|
// select = new Select(sceneMove, {
|
||||||
type: DrawingType.DRAWING_POINT,
|
// type: DrawingType.DRAWING_POINT,
|
||||||
});
|
// });
|
||||||
select.open();
|
// select.open();
|
||||||
polyLayer.resetStyle();
|
polyLayer.resetStyle();
|
||||||
sceneMove.addEventListener(OperateEventType.CLICK, clickHandler);
|
sceneMove.addEventListener(OperateEventType.CLICK, clickHandler);
|
||||||
};
|
};
|
||||||
//取消移动
|
//取消移动
|
||||||
const moveCancel = () => {
|
const moveCancel = () => {
|
||||||
|
movepoy.close();
|
||||||
sceneMove.removeEventListener(OperateEventType.CLICK, clickHandler);
|
sceneMove.removeEventListener(OperateEventType.CLICK, clickHandler);
|
||||||
polyLayer.resetStyle();
|
|
||||||
cs_choose_arr.value.forEach((item, index) => {
|
cs_choose_arr.value.forEach((item, index) => {
|
||||||
map.removeOverlay(cs_choose_arr.value[index]);
|
map.removeOverlay(cs_choose_arr.value[index]);
|
||||||
});
|
});
|
||||||
|
@ -1009,11 +1011,8 @@ const moveCancel = () => {
|
||||||
};
|
};
|
||||||
//保存移动
|
//保存移动
|
||||||
const moveSave = () => {
|
const moveSave = () => {
|
||||||
console.log(22222, cs_choose_arr.value[0]);
|
|
||||||
// select.close();
|
|
||||||
// movepoy.close(selectedOverlay);
|
|
||||||
polyLayer.resetStyle();
|
|
||||||
arrJWD = [[[]]];
|
arrJWD = [[[]]];
|
||||||
|
movepoy.close();
|
||||||
sceneMove.removeEventListener(OperateEventType.CLICK, clickHandler);
|
sceneMove.removeEventListener(OperateEventType.CLICK, clickHandler);
|
||||||
cs_choose_arr.value[0].points.forEach((item, index) => {
|
cs_choose_arr.value[0].points.forEach((item, index) => {
|
||||||
let arr1 = [];
|
let arr1 = [];
|
||||||
|
@ -1028,12 +1027,13 @@ const moveSave = () => {
|
||||||
//退出移动模式
|
//退出移动模式
|
||||||
const moveBack = () => {
|
const moveBack = () => {
|
||||||
// select.close();
|
// select.close();
|
||||||
|
movepoy.close();
|
||||||
sceneMove.removeEventListener(OperateEventType.CLICK, clickHandler);
|
sceneMove.removeEventListener(OperateEventType.CLICK, clickHandler);
|
||||||
polyLayer.resetStyle();
|
// polyLayer.resetStyle();
|
||||||
// cs_choose_arr.value.forEach((item, index) => {
|
cs_choose_arr.value.forEach((item, index) => {
|
||||||
// map.removeOverlay(cs_choose_arr.value[index]);
|
map.removeOverlay(cs_choose_arr.value[index]);
|
||||||
// });
|
});
|
||||||
// addCsChoose();
|
addCsChoose();
|
||||||
move_mode.value = false;
|
move_mode.value = false;
|
||||||
drawing.value = false;
|
drawing.value = false;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue