|
|
@ -1104,8 +1104,32 @@ |
|
|
|
addRadarComShow.value = true; |
|
|
|
} |
|
|
|
// 添加防区, msMapLineHandler标识 后台防区管理调用 |
|
|
|
function addArea(msMapLineHandler = null) { |
|
|
|
function addArea(msMapLineHandler: any = {}) { |
|
|
|
// console.log("添加防区",msMapLineHandler); |
|
|
|
let objConfig: any = {} |
|
|
|
if (typeof msMapLineHandler === 'object' && Object.keys(msMapLineHandler).length != 0 && msMapLineHandler.create){ |
|
|
|
//创建 -后台防区管理调用 |
|
|
|
objConfig.from = "msMapLineHandler.create"; |
|
|
|
} |
|
|
|
else if (typeof msMapLineHandler === 'object' && Object.keys(msMapLineHandler).length != 0) { |
|
|
|
//编辑 -后台防区管理调用 |
|
|
|
//不是空对象,则为编辑状态 |
|
|
|
// console.log("msMapLineHandler",msMapLineHandler); |
|
|
|
let config = { |
|
|
|
id: msMapLineHandler.id, |
|
|
|
name: msMapLineHandler.name, |
|
|
|
sceneId: msMapLineHandler.sceneId, |
|
|
|
// guid: msMapLineHandler.lineCode, |
|
|
|
loop: Boolean(msMapLineHandler.isLoop), |
|
|
|
depthTest: Boolean(msMapLineHandler.isDepthCheck), |
|
|
|
width: msMapLineHandler.width, |
|
|
|
arcType: msMapLineHandler.interpolation, |
|
|
|
positions: JSON.parse(msMapLineHandler.positions), |
|
|
|
material: JSON.parse(msMapLineHandler.material), |
|
|
|
from : "msMapLineHandler.edit" |
|
|
|
} |
|
|
|
return addPolyline(config) |
|
|
|
} |
|
|
|
|
|
|
|
$mitt.emit('drawShapeShow', { show: true, title: '防区创建工具', from: 'addArea' }); |
|
|
|
$mitt.on('addAreaFinished', (t: any) => { |
|
|
@ -1119,15 +1143,15 @@ |
|
|
|
|
|
|
|
if (n == false) { |
|
|
|
//面 |
|
|
|
let positions: any = []; |
|
|
|
// let positions: any = []; |
|
|
|
if (t._polygon) { |
|
|
|
positions = t._polygon._polyline.positions; |
|
|
|
objConfig.positions = t._polygon._polyline.positions; |
|
|
|
} |
|
|
|
//线 |
|
|
|
else if (t._polyline) { |
|
|
|
positions = t._polyline.positions; |
|
|
|
objConfig.positions = t._polyline.positions; |
|
|
|
} else { |
|
|
|
positions = t.positions; |
|
|
|
objConfig.positions = t.positions; |
|
|
|
} |
|
|
|
|
|
|
|
//销毁临时图形 |
|
|
@ -1138,7 +1162,7 @@ |
|
|
|
* |
|
|
|
*/ |
|
|
|
nextTick(() => { |
|
|
|
addPolyline(positions,msMapLineHandler); |
|
|
|
addPolyline(objConfig); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
} |
|
|
@ -1151,9 +1175,8 @@ |
|
|
|
} |
|
|
|
/** |
|
|
|
* @params 需要调用 addArea 方法进行绘图,获取坐标点position |
|
|
|
* @params msMapLineHandler标识 后台防区管理调用 |
|
|
|
*/ |
|
|
|
function addPolyline(positions: any = null, msMapLineHandler:any =null) { |
|
|
|
function addPolyline(objConf: any = null) { |
|
|
|
// console.log('positions', positions); |
|
|
|
|
|
|
|
|
|
|
@ -1163,35 +1186,18 @@ |
|
|
|
const currentModel = new window.XE.Obj.Polyline(window.$earth); |
|
|
|
// 设置配置参数 |
|
|
|
const objConfig: any = { |
|
|
|
positions: positions, |
|
|
|
positions: objConf.positions, |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|
* 后台防区管理调用 |
|
|
|
* */ |
|
|
|
// if (typeof msMapLineHandler === 'object' && Object.keys(msMapLineHandler).length != 0) { |
|
|
|
// console.log("不是空对象,则为编辑状态"); |
|
|
|
// //不是空对象,则为编辑状态 |
|
|
|
// //数据融合 |
|
|
|
// objConfig.loop = msMapLineHandler.isLoop; |
|
|
|
// objConfig.depthTest = msMapLineHandler.isDepthCheck; |
|
|
|
// objConfig.width = msMapLineHandler.width; |
|
|
|
// objConfig.arcType = msMapLineHandler.interpolation; |
|
|
|
// objConfig.positions = JSON.parse(msMapLineHandler.positions); |
|
|
|
// objConfig.material = JSON.parse(msMapLineHandler.material); |
|
|
|
// } |
|
|
|
// 融合数据 |
|
|
|
Object.assign(objConfig, objConf); |
|
|
|
console.log("objConfig",objConfig); |
|
|
|
|
|
|
|
// 插入数据 |
|
|
|
currentModel.xbsjFromJSON(objConfig); |
|
|
|
// console.log('currentModel', currentModel); |
|
|
|
console.log('currentModel', currentModel); |
|
|
|
// 获取地图ui对象 |
|
|
|
const earthUI = window.$uia; |
|
|
|
// console.log("msMapLineHandler",msMapLineHandler); |
|
|
|
//后台防区管理调用,直接return终止 |
|
|
|
if(msMapLineHandler){ |
|
|
|
$mitt.emit('toMsMapLineForm',currentModel) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 打开一个防区编辑ui窗体 |
|
|
|
earthUI.showPropertyWindow(currentModel); |
|
|
|
nextTick(() => { |
|
|
@ -1236,8 +1242,13 @@ |
|
|
|
const xBtn = el.children[1].children[1]; |
|
|
|
// 设置确认按钮点击事件 |
|
|
|
okBtn.onclick = function () { |
|
|
|
// console.log("currentModel",currentModel); |
|
|
|
// return |
|
|
|
|
|
|
|
//后台防区管理调用,直接return终止 |
|
|
|
if(currentModel.from == "msMapLineHandler.edit" || currentModel.from == "msMapLineHandler.create"){ |
|
|
|
$mitt.emit('toMsMapLineForm',currentModel) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 判断所属区域 |
|
|
|
if (!currentModel.sceneId) { |
|
|
|
createMessage.warning('请选择所属区域', 2); |
|
|
@ -1398,6 +1409,11 @@ |
|
|
|
}; |
|
|
|
// 取消按钮 |
|
|
|
cancelBtn.onclick = xBtn.onclick = function () { |
|
|
|
//后台防区管理调用,直接return终止 |
|
|
|
if(currentModel.from == "msMapLineHandler.edit" || currentModel.from == "msMapLineHandler.create"){ |
|
|
|
$mitt.emit('toMsMapLineForm') |
|
|
|
return |
|
|
|
} |
|
|
|
$mitt.off('windowCancel'); |
|
|
|
// 消耗当前窗体的dom节点 |
|
|
|
el.remove(); |
|
|
|