|
@ -25,12 +25,17 @@ const earthUI = window.$uia // 获取地图ui对象 |
|
|
|
|
|
|
|
|
//绘画图形初始化
|
|
|
//绘画图形初始化
|
|
|
export async function drawInit() { |
|
|
export async function drawInit() { |
|
|
|
|
|
// console.log("sceneId",userStore.userInfo?.sceneId);
|
|
|
|
|
|
/** |
|
|
|
|
|
* listBySceneId 查询 SceneId以及SceneId为空的列表 |
|
|
|
|
|
*/ |
|
|
defHttp.get({ |
|
|
defHttp.get({ |
|
|
url: '/military/dtMapDraw/list', |
|
|
url: '/military/dtMapDraw/listBySceneId', |
|
|
params: { |
|
|
params: { |
|
|
sceneId: userStore.userInfo?.sceneId |
|
|
sceneId: userStore.userInfo?.sceneId |
|
|
} |
|
|
} |
|
|
}, { isTransformResponse: false }).then((res) => { |
|
|
}, { isTransformResponse: false }).then((res) => { |
|
|
|
|
|
// console.log("listBySceneId",res);
|
|
|
res.result.records.forEach((res) => { |
|
|
res.result.records.forEach((res) => { |
|
|
let item = res; |
|
|
let item = res; |
|
|
let config = JSON.parse(item.drawData); |
|
|
let config = JSON.parse(item.drawData); |
|
@ -138,10 +143,14 @@ export function drawShow(obj: any, config: any, state: Number) { |
|
|
obj.showProperty = (cancel: Function = () => { }, ok: Function = () => { }, cancelText = "取消", okText = "确认",) => { |
|
|
obj.showProperty = (cancel: Function = () => { }, ok: Function = () => { }, cancelText = "取消", okText = "确认",) => { |
|
|
return popup("属性", [h(basicEditing, { obj: obj, cancel: cancel, ok: ok, cancelText: cancelText, okText: okText })], "basicEditing"); |
|
|
return popup("属性", [h(basicEditing, { obj: obj, cancel: cancel, ok: ok, cancelText: cancelText, okText: okText })], "basicEditing"); |
|
|
} |
|
|
} |
|
|
|
|
|
//状态为0,保存
|
|
|
if (state == 0) { |
|
|
if (state == 0) { |
|
|
saveInStore(obj) |
|
|
saveInStore(obj) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//添加鼠标事件 ,双击结束创建/编辑
|
|
|
|
|
|
listenMouseHandler(obj) |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 由于返回具有 `primitive` 属性的对象,该属性包含场景中特定窗口坐标处的第一个(顶部)图元, |
|
|
* 由于返回具有 `primitive` 属性的对象,该属性包含场景中特定窗口坐标处的第一个(顶部)图元, |
|
|
* 如果该位置没有任何内容,则返回未定义的对象。其他属性可能会根据基元的类型进行设置,并可用于进一步识别拾取的对象。 |
|
|
* 如果该位置没有任何内容,则返回未定义的对象。其他属性可能会根据基元的类型进行设置,并可用于进一步识别拾取的对象。 |
|
@ -150,7 +159,7 @@ export function drawShow(obj: any, config: any, state: Number) { |
|
|
*/ |
|
|
*/ |
|
|
nextTick(() => { |
|
|
nextTick(() => { |
|
|
if (obj._polygon) { |
|
|
if (obj._polygon) { |
|
|
obj._polygon.customProp = { |
|
|
obj._polygon.customProp = { |
|
|
id: obj.id, |
|
|
id: obj.id, |
|
|
drawType: obj.customProp.drawType, |
|
|
drawType: obj.customProp.drawType, |
|
|
remark: obj.customProp.remark, |
|
|
remark: obj.customProp.remark, |
|
@ -162,12 +171,12 @@ export function drawShow(obj: any, config: any, state: Number) { |
|
|
// Object.assign(obj._polygon, obj)
|
|
|
// Object.assign(obj._polygon, obj)
|
|
|
} |
|
|
} |
|
|
if (obj._polyline) { |
|
|
if (obj._polyline) { |
|
|
obj._polyline.customProp = { |
|
|
obj._polyline.customProp = { |
|
|
id: obj.id, |
|
|
id: obj.id, |
|
|
drawType: obj.customProp.drawType, |
|
|
drawType: obj.customProp.drawType, |
|
|
remark: obj.customProp.remark, |
|
|
remark: obj.customProp.remark, |
|
|
sceneId: obj.customProp.sceneId |
|
|
sceneId: obj.customProp.sceneId |
|
|
} |
|
|
} |
|
|
obj._polyline.id = obj.id |
|
|
obj._polyline.id = obj.id |
|
|
obj._polyline.name = '绘画' |
|
|
obj._polyline.name = '绘画' |
|
|
// obj._polyline = Object.assign({},obj)
|
|
|
// obj._polyline = Object.assign({},obj)
|
|
@ -178,6 +187,29 @@ export function drawShow(obj: any, config: any, state: Number) { |
|
|
return obj |
|
|
return obj |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function listenMouseHandler(obj: any) { |
|
|
|
|
|
//添加鼠标事件 ,双击结束创建/编辑
|
|
|
|
|
|
let handler = new window.Cesium.ScreenSpaceEventHandler(window.$earth.czm.viewer.scene.canvas); |
|
|
|
|
|
handler.setInputAction(() => { |
|
|
|
|
|
if (obj.creating || obj.editing) { |
|
|
|
|
|
obj.creating = false |
|
|
|
|
|
obj.editing = false |
|
|
|
|
|
console.log("完成", obj); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}, window.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK); //鼠标左键双击事件
|
|
|
|
|
|
// obj.ondbclick = () => {
|
|
|
|
|
|
// obj.creating = false
|
|
|
|
|
|
// obj.editing = false
|
|
|
|
|
|
// console.log("完成", obj);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// obj.onclick = () => {
|
|
|
|
|
|
// obj.creating = false
|
|
|
|
|
|
// obj.editing = false
|
|
|
|
|
|
// console.log("完成222", obj);
|
|
|
|
|
|
// }
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//区域编辑ui窗体
|
|
|
//区域编辑ui窗体
|
|
|
export function editUI(obj: any, cancel: Function = null, ok: Function = null) { |
|
|
export function editUI(obj: any, cancel: Function = null, ok: Function = null) { |
|
|
obj.creating = true; |
|
|
obj.creating = true; |
|
|