|
|
@ -1,14 +1,14 @@ |
|
|
|
/** |
|
|
|
* 监听鼠标事件 |
|
|
|
* 用于EarthComp.vue |
|
|
|
* |
|
|
|
* |
|
|
|
*/ |
|
|
|
import { nextTick } from 'vue'; |
|
|
|
import { nextTick } from 'vue'; |
|
|
|
import { defHttp } from '/@/utils/http/axios'; |
|
|
|
import $ from 'jquery'; |
|
|
|
import { useUserStore } from '/@/store/modules/user'; |
|
|
|
import { useEarthMapStore } from '/@/store/modules/earthMap'; |
|
|
|
import { earthMapUrl } from '@/api/earth/earthMap' |
|
|
|
import { earthMapUrl } from '@/api/earth/earthMap'; |
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'; |
|
|
|
import { CircleScan } from '@/utils/earthMap/radarEntity'; |
|
|
|
import { radianToDegreeInLngLatHeight } from '@/utils/earthMap/earth'; |
|
|
@ -19,409 +19,408 @@ let store = useEarthMapStore(); |
|
|
|
const { createMessage } = useMessage(); |
|
|
|
|
|
|
|
export default function listenMouseHandler(that) { |
|
|
|
const handler = new window.Cesium.ScreenSpaceEventHandler(window.$viewer.scene.canvas); |
|
|
|
that._handler = handler; |
|
|
|
//取消双击旋转事件
|
|
|
|
window.$viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(window.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK); |
|
|
|
/* MOUSE事件(有性能问题,慎用!) */ |
|
|
|
|
|
|
|
const handler = new window.Cesium.ScreenSpaceEventHandler(window.$viewer.scene.canvas); |
|
|
|
that._handler = handler; |
|
|
|
//取消双击旋转事件
|
|
|
|
window.$viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(window.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK); |
|
|
|
/* MOUSE事件(有性能问题,慎用!) */ |
|
|
|
/* 鼠标左键事件 */ |
|
|
|
{ |
|
|
|
handler.setInputAction((click: any) => { |
|
|
|
if (typeof that._pin !== 'undefined') { |
|
|
|
// 销毁指示线
|
|
|
|
that._pin.destroy(); |
|
|
|
} |
|
|
|
|
|
|
|
/* 鼠标左键事件 */ |
|
|
|
{ |
|
|
|
handler.setInputAction((click: any) => { |
|
|
|
if (typeof that._pin !== 'undefined') { |
|
|
|
// 销毁指示线
|
|
|
|
that._pin.destroy(); |
|
|
|
} |
|
|
|
|
|
|
|
let pickedFeature = window.$viewer.scene.pick(click.position); |
|
|
|
console.log('点击:', pickedFeature); |
|
|
|
let pickedFeature = window.$viewer.scene.pick(click.position); |
|
|
|
console.log('点击:', pickedFeature); |
|
|
|
|
|
|
|
if (pickedFeature && pickedFeature.id) { |
|
|
|
// 三维模型
|
|
|
|
if (pickedFeature.id.xbsjType && pickedFeature.id.xbsjType === 'Model') { |
|
|
|
//点击电线杆触发弹窗
|
|
|
|
store.cameraData.forEach((data) => { |
|
|
|
if (!$.isEmptyObject(data.msCameraSiteList)) { |
|
|
|
if (!data.msCameraSiteList) { |
|
|
|
return; |
|
|
|
} |
|
|
|
data.msCameraSiteList.forEach((data) => { |
|
|
|
if (pickedFeature.id.customProp === data.id) { |
|
|
|
if ($('.cameraModal ul').length > 0) { |
|
|
|
$('.cameraModal ul').remove(); |
|
|
|
} |
|
|
|
$('.cameraModal').append('<ul></ul>'); |
|
|
|
if (!data.msCameraSettingList) return; |
|
|
|
// 将监控相机列表传入弹窗组件中
|
|
|
|
that.cameraList = data.msCameraSettingList; |
|
|
|
// 将监控点位置传入弹窗组件中
|
|
|
|
that.monitorPosition = pickedFeature.id._primitive.xbsjPosition; |
|
|
|
data.msCameraSettingList.forEach((data, index) => { |
|
|
|
let camera_img = |
|
|
|
data.type == '4' |
|
|
|
? window._CONFIG['staticDomainURL'] + '/qiuji.png' |
|
|
|
: data.type == '3' |
|
|
|
? window._CONFIG['staticDomainURL'] + '/qiangji.png' |
|
|
|
: window._CONFIG['staticDomainURL'] + '/qiangji.png'; |
|
|
|
let cameraStatus = data.status == '1' ? 'successStatus' : data.status == '2' ? 'offlineStatus' : 'errorStatus'; |
|
|
|
let rtspUrl = data.cameraCode; |
|
|
|
// 'rtsp://' + data.user + ':' + data.password + '@' + data.ip + window._CONFIG['cameraMain']
|
|
|
|
$('.cameraModal ul').append( |
|
|
|
'<li><a class="openIframe" id="' + |
|
|
|
data.id + |
|
|
|
'" videoUrl="' + |
|
|
|
rtspUrl + |
|
|
|
'" cameraIP="' + |
|
|
|
data.ip + |
|
|
|
'" cameraUser="' + |
|
|
|
data.user + |
|
|
|
'" cameraPsd="' + |
|
|
|
data.password + |
|
|
|
'"><img src="' + |
|
|
|
camera_img + |
|
|
|
'" /><div class="' + |
|
|
|
cameraStatus + |
|
|
|
'">' + |
|
|
|
data.cameraName + |
|
|
|
'</div> </a></li>' |
|
|
|
); |
|
|
|
}); |
|
|
|
let cameraModal: any = document.getElementById('cameraModal') |
|
|
|
cameraModal.style.left = click.position.x + -45 + 'px'; |
|
|
|
cameraModal.style.top = click.position.y + -180 + 'px'; |
|
|
|
that.cameraModalShow = true; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// 船只模型
|
|
|
|
if (pickedFeature.id.xbsjType && pickedFeature.id.name.includes('船') && pickedFeature.id.xbsjType === 'Model') { |
|
|
|
that.AISInfoWindowShow = true; |
|
|
|
// 赋值船只场景id
|
|
|
|
that.ship_guid = pickedFeature.id.guid; |
|
|
|
if (pickedFeature && pickedFeature.id) { |
|
|
|
// 三维模型
|
|
|
|
if (pickedFeature.id.xbsjType && pickedFeature.id.xbsjType === 'Model') { |
|
|
|
//点击电线杆触发弹窗
|
|
|
|
store.cameraData.forEach((data) => { |
|
|
|
if (!$.isEmptyObject(data.msCameraSiteList)) { |
|
|
|
if (!data.msCameraSiteList) { |
|
|
|
return; |
|
|
|
} |
|
|
|
data.msCameraSiteList.forEach((data) => { |
|
|
|
if (pickedFeature.id.customProp === data.id) { |
|
|
|
if ($('.cameraModal ul').length > 0) { |
|
|
|
$('.cameraModal ul').remove(); |
|
|
|
} |
|
|
|
$('.cameraModal').append('<ul></ul>'); |
|
|
|
if (!data.msCameraSettingList) return; |
|
|
|
// 将监控相机列表传入弹窗组件中
|
|
|
|
that.cameraList = data.msCameraSettingList; |
|
|
|
// 将监控点位置传入弹窗组件中
|
|
|
|
that.monitorPosition = pickedFeature.id._primitive.xbsjPosition; |
|
|
|
data.msCameraSettingList.forEach((data, index) => { |
|
|
|
let camera_img = |
|
|
|
data.type == '4' |
|
|
|
? window._CONFIG['staticDomainURL'] + '/qiuji.png' |
|
|
|
: data.type == '3' |
|
|
|
? window._CONFIG['staticDomainURL'] + '/qiangji.png' |
|
|
|
: window._CONFIG['staticDomainURL'] + '/qiangji.png'; |
|
|
|
let cameraStatus = data.status == '1' ? 'successStatus' : data.status == '2' ? 'offlineStatus' : 'errorStatus'; |
|
|
|
let rtspUrl = data.cameraCode; |
|
|
|
// 'rtsp://' + data.user + ':' + data.password + '@' + data.ip + window._CONFIG['cameraMain']
|
|
|
|
$('.cameraModal ul').append( |
|
|
|
'<li><a class="openIframe" id="' + |
|
|
|
data.id + |
|
|
|
'" videoUrl="' + |
|
|
|
rtspUrl + |
|
|
|
'" cameraIP="' + |
|
|
|
data.ip + |
|
|
|
'" cameraUser="' + |
|
|
|
data.user + |
|
|
|
'" cameraPsd="' + |
|
|
|
data.password + |
|
|
|
'"><img src="' + |
|
|
|
camera_img + |
|
|
|
'" /><div class="' + |
|
|
|
cameraStatus + |
|
|
|
'">' + |
|
|
|
data.cameraName + |
|
|
|
'</div> </a></li>' |
|
|
|
); |
|
|
|
}); |
|
|
|
let cameraModal: any = document.getElementById('cameraModal'); |
|
|
|
cameraModal.style.left = click.position.x + -45 + 'px'; |
|
|
|
cameraModal.style.top = click.position.y + -180 + 'px'; |
|
|
|
that.cameraModalShow = true; |
|
|
|
} |
|
|
|
//雷达扫描范围
|
|
|
|
if ( |
|
|
|
pickedFeature.id._xbsjOwner && |
|
|
|
pickedFeature.id._xbsjOwner.customProp && |
|
|
|
JSON.parse(pickedFeature.id._xbsjOwner.customProp).labelAttr == '4' |
|
|
|
) { |
|
|
|
let labelCode = JSON.parse(pickedFeature.id._xbsjOwner.customProp).labelCode; |
|
|
|
console.log(pickedFeature.id._xbsjOwner); |
|
|
|
if (pickedFeature.id._xbsjOwner.addViewShedReturn) { |
|
|
|
//显示/不显示雷达扫码效果
|
|
|
|
// pickedFeature.id._xbsjOwner.addViewShedReturn.show = !pickedFeature.id._xbsjOwner.addViewShedReturn.show;
|
|
|
|
// console.log("pickedFeature.id._xbsjOwner.addViewShedReturn",pickedFeature.id._xbsjOwner.addViewShedReturn);
|
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// 船只模型
|
|
|
|
if (pickedFeature.id.xbsjType && pickedFeature.id.name.includes('船')) { |
|
|
|
that.AISInfoWindowShow = true; |
|
|
|
// 赋值船只场景id - 唯一标识 可通过该字段获取其余信息
|
|
|
|
that.ship_guid = pickedFeature.id.guid; |
|
|
|
} |
|
|
|
//雷达扫描范围
|
|
|
|
if ( |
|
|
|
pickedFeature.id._xbsjOwner && |
|
|
|
pickedFeature.id._xbsjOwner.customProp && |
|
|
|
JSON.parse(pickedFeature.id._xbsjOwner.customProp).labelAttr == '4' |
|
|
|
) { |
|
|
|
let labelCode = JSON.parse(pickedFeature.id._xbsjOwner.customProp).labelCode; |
|
|
|
console.log(pickedFeature.id._xbsjOwner); |
|
|
|
if (pickedFeature.id._xbsjOwner.addViewShedReturn) { |
|
|
|
//显示/不显示雷达扫码效果
|
|
|
|
// pickedFeature.id._xbsjOwner.addViewShedReturn.show = !pickedFeature.id._xbsjOwner.addViewShedReturn.show;
|
|
|
|
// console.log("pickedFeature.id._xbsjOwner.addViewShedReturn",pickedFeature.id._xbsjOwner.addViewShedReturn);
|
|
|
|
|
|
|
|
//清空当前雷达,并将该方法指向undefined(清空)
|
|
|
|
pickedFeature.id._xbsjOwner.addViewShedReturn.clear(); |
|
|
|
pickedFeature.id._xbsjOwner.addViewShedReturn = undefined; |
|
|
|
} else { |
|
|
|
defHttp.get({ url: earthMapUrl.radarList, params: { radarCode: labelCode } }, { isTransformResponse: false }).then((res) => { |
|
|
|
if (res.success) { |
|
|
|
if (res.result.records.length > 0) { |
|
|
|
let data = res.result.records[0]; |
|
|
|
let rgb; |
|
|
|
if (data.customProp) { |
|
|
|
rgb = JSON.parse(data.customProp).color; |
|
|
|
} |
|
|
|
let radarRadius = data.workingRadius; |
|
|
|
let radarRange = data.elevation; |
|
|
|
let radarShifting = data.angularRadian; |
|
|
|
let left = Number(radarShifting) - Number(radarRange) / 2; |
|
|
|
//参数:经纬度、半径、起始角度(正北方向)、结束角度
|
|
|
|
console.log('雷达扫描范围', data); |
|
|
|
//清空当前雷达,并将该方法指向undefined(清空)
|
|
|
|
pickedFeature.id._xbsjOwner.addViewShedReturn.clear(); |
|
|
|
pickedFeature.id._xbsjOwner.addViewShedReturn = undefined; |
|
|
|
} else { |
|
|
|
defHttp.get({ url: earthMapUrl.radarList, params: { radarCode: labelCode } }, { isTransformResponse: false }).then((res) => { |
|
|
|
if (res.success) { |
|
|
|
if (res.result.records.length > 0) { |
|
|
|
let data = res.result.records[0]; |
|
|
|
let rgb; |
|
|
|
if (data.customProp) { |
|
|
|
rgb = JSON.parse(data.customProp).color; |
|
|
|
} |
|
|
|
let radarRadius = data.workingRadius; |
|
|
|
let radarRange = data.elevation; |
|
|
|
let radarShifting = data.angularRadian; |
|
|
|
let left = Number(radarShifting) - Number(radarRange) / 2; |
|
|
|
//参数:经纬度、半径、起始角度(正北方向)、结束角度
|
|
|
|
console.log('雷达扫描范围', data); |
|
|
|
|
|
|
|
//弧度转角度
|
|
|
|
let degreePosition = radianToDegreeInLngLatHeight( |
|
|
|
pickedFeature.id._xbsjOwner.position[0], |
|
|
|
pickedFeature.id._xbsjOwner.position[1], |
|
|
|
0.1 |
|
|
|
); |
|
|
|
//创建雷达扫描 深度
|
|
|
|
// window.$viewer.scene.globe.depthTestAgainstTerrain = true;
|
|
|
|
let rader = new CircleScan(window.$viewer); |
|
|
|
rader.add(degreePosition, null, radarRadius, 10000); |
|
|
|
pickedFeature.id._xbsjOwner.addViewShedReturn = rader; |
|
|
|
//弧度转角度
|
|
|
|
let degreePosition = radianToDegreeInLngLatHeight( |
|
|
|
pickedFeature.id._xbsjOwner.position[0], |
|
|
|
pickedFeature.id._xbsjOwner.position[1], |
|
|
|
0.1 |
|
|
|
); |
|
|
|
//创建雷达扫描 深度
|
|
|
|
// window.$viewer.scene.globe.depthTestAgainstTerrain = true;
|
|
|
|
let rader = new CircleScan(window.$viewer); |
|
|
|
rader.add(degreePosition, null, radarRadius, 10000); |
|
|
|
pickedFeature.id._xbsjOwner.addViewShedReturn = rader; |
|
|
|
|
|
|
|
// 雷达扫描2
|
|
|
|
// let rader2 = window.$viewer.entities.add({
|
|
|
|
// position: Cesium.Cartesian3.fromDegrees(113.528333, 22.156109),
|
|
|
|
// name: '雷达扫描',
|
|
|
|
// ellipse: {
|
|
|
|
// semiMajorAxis: 5000.0,
|
|
|
|
// semiMinorAxis: 5000.0,
|
|
|
|
// material: new Cesium.RadarScanMaterialProperty({
|
|
|
|
// color: new Cesium.Color(1.0, 1.0, 0.0, 0.7),
|
|
|
|
// speed: 20.0,
|
|
|
|
// }),
|
|
|
|
// height: 20.0,
|
|
|
|
// heightReference: Cesium.HeightReference.RELATIVE_TO_GROUND,
|
|
|
|
// outline: true,
|
|
|
|
// outlineColor: new Cesium.Color(1.0, 1.0, 0.0, 1.0)
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
// 雷达扫描2
|
|
|
|
// let rader2 = window.$viewer.entities.add({
|
|
|
|
// position: Cesium.Cartesian3.fromDegrees(113.528333, 22.156109),
|
|
|
|
// name: '雷达扫描',
|
|
|
|
// ellipse: {
|
|
|
|
// semiMajorAxis: 5000.0,
|
|
|
|
// semiMinorAxis: 5000.0,
|
|
|
|
// material: new Cesium.RadarScanMaterialProperty({
|
|
|
|
// color: new Cesium.Color(1.0, 1.0, 0.0, 0.7),
|
|
|
|
// speed: 20.0,
|
|
|
|
// }),
|
|
|
|
// height: 20.0,
|
|
|
|
// heightReference: Cesium.HeightReference.RELATIVE_TO_GROUND,
|
|
|
|
// outline: true,
|
|
|
|
// outlineColor: new Cesium.Color(1.0, 1.0, 0.0, 1.0)
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
|
|
|
|
// pickedFeature.id._xbsjOwner.addViewShedReturn= addViewShedRadar(
|
|
|
|
// pickedFeature.id._xbsjOwner.position,
|
|
|
|
// radarRadius,
|
|
|
|
// left,
|
|
|
|
// Number(radarRange) / 2 + Number(radarShifting),
|
|
|
|
// [rgb.r / 255, rgb.g / 255, rgb.b / 255, rgb.a]
|
|
|
|
// );
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
// pickedFeature.id._xbsjOwner.addViewShedReturn= addViewShedRadar(
|
|
|
|
// pickedFeature.id._xbsjOwner.position,
|
|
|
|
// radarRadius,
|
|
|
|
// left,
|
|
|
|
// Number(radarRange) / 2 + Number(radarShifting),
|
|
|
|
// [rgb.r / 255, rgb.g / 255, rgb.b / 255, rgb.a]
|
|
|
|
// );
|
|
|
|
} |
|
|
|
} else { |
|
|
|
//关闭所有气泡窗
|
|
|
|
that.cameraModalShow = false; |
|
|
|
that.poiModalShow = false; |
|
|
|
} |
|
|
|
}, window.Cesium.ScreenSpaceEventType.LEFT_CLICK); |
|
|
|
} |
|
|
|
/* 鼠标右键事件 */ |
|
|
|
{ |
|
|
|
handler.setInputAction((click) => { |
|
|
|
// 判断点击位置是否有实体
|
|
|
|
//返回具有 `primitive` 属性的对象,该属性包含场景中特定窗口坐标处的第一个(顶部)图元,如果该位置没有任何内容,则返回未定义的对象。其他属性可能会根据基元的类型进行设置,并可用于进一步识别拾取的对象。
|
|
|
|
let pickedFeature = window.$viewer.scene.pick(click.position); |
|
|
|
// console.log("pick",pickedFeature);
|
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
//关闭所有气泡窗
|
|
|
|
that.cameraModalShow = false; |
|
|
|
that.poiModalShow = false; |
|
|
|
} |
|
|
|
}, window.Cesium.ScreenSpaceEventType.LEFT_CLICK); |
|
|
|
} |
|
|
|
/* 鼠标右键事件 */ |
|
|
|
{ |
|
|
|
handler.setInputAction((click) => { |
|
|
|
// 判断点击位置是否有实体
|
|
|
|
//返回具有 `primitive` 属性的对象,该属性包含场景中特定窗口坐标处的第一个(顶部)图元,如果该位置没有任何内容,则返回未定义的对象。其他属性可能会根据基元的类型进行设置,并可用于进一步识别拾取的对象。
|
|
|
|
let pickedFeature = window.$viewer.scene.pick(click.position); |
|
|
|
// console.log("pick",pickedFeature);
|
|
|
|
|
|
|
|
let entity = pickedFeature && pickedFeature.id; |
|
|
|
console.log('pick', pickedFeature); |
|
|
|
console.log('entity', entity); |
|
|
|
if (entity == undefined) { |
|
|
|
return; |
|
|
|
let entity = pickedFeature && pickedFeature.id; |
|
|
|
console.log('pick', pickedFeature); |
|
|
|
console.log('entity', entity); |
|
|
|
if (entity == undefined) { |
|
|
|
return; |
|
|
|
} |
|
|
|
if (typeof pickedFeature !== 'undefined' && pickedFeature.id.xbsjType == 'Model') { |
|
|
|
//点击电线杆触发弹窗
|
|
|
|
store.cameraData.forEach((data) => { |
|
|
|
if (!$.isEmptyObject(data.msCameraSiteList)) { |
|
|
|
if (!data.msCameraSettingList) { |
|
|
|
return; |
|
|
|
} |
|
|
|
if (typeof pickedFeature !== 'undefined' && pickedFeature.id.xbsjType == 'Model') { |
|
|
|
//点击电线杆触发弹窗
|
|
|
|
store.cameraData.forEach((data) => { |
|
|
|
if (!$.isEmptyObject(data.msCameraSiteList)) { |
|
|
|
if (!data.msCameraSettingList) { |
|
|
|
return; |
|
|
|
} |
|
|
|
data.msCameraSiteList.forEach((data) => { |
|
|
|
if (pickedFeature.id.customProp === data.id) { |
|
|
|
window.$uia.contextMenu.pop([ |
|
|
|
{ |
|
|
|
text: '监控视域分析属性', |
|
|
|
func: () => { |
|
|
|
let testConfig = { |
|
|
|
ref: 'testView', |
|
|
|
name: '雷达视域分析', |
|
|
|
position: [1.514482876761954, 0.8497520519403554, -0.7553906497788317], |
|
|
|
rotation: [4.535844766941594, 0.32288591161895097, 0], |
|
|
|
near: 1, |
|
|
|
far: 400, |
|
|
|
fovH: Math.PI / 3, |
|
|
|
fovV: Math.PI / 6, |
|
|
|
show: false, |
|
|
|
}; |
|
|
|
let Viewshed = new window.XE.Obj.Viewshed(window.$earth); |
|
|
|
Viewshed.xbsjFromJSON(testConfig); |
|
|
|
window.$uia.showPropertyWindow(Viewshed); |
|
|
|
}, |
|
|
|
}, |
|
|
|
]); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
//巡检监控视频
|
|
|
|
else if (typeof pickedFeature !== 'undefined' && entity._name == '视频图元') { |
|
|
|
// console.log(pickedFeature)
|
|
|
|
// console.log("entity",entity)
|
|
|
|
data.msCameraSiteList.forEach((data) => { |
|
|
|
if (pickedFeature.id.customProp === data.id) { |
|
|
|
window.$uia.contextMenu.pop([ |
|
|
|
{ |
|
|
|
text: '编辑', |
|
|
|
func: () => { |
|
|
|
$mitt.emit('addRoamPathVideoClose'); |
|
|
|
// store.commit('customPrimitive', entity.xbsjGuid);
|
|
|
|
store.customPrimitive = entity.xbsjGuid; |
|
|
|
// 打开对应的创建巡检视频窗口
|
|
|
|
nextTick(() => { |
|
|
|
that.addRoamVideoShow = true; |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
text: '删除', |
|
|
|
func: () => { |
|
|
|
window.$uia.confirm('确认删除?', () => { |
|
|
|
defHttp |
|
|
|
.delete( |
|
|
|
{ |
|
|
|
url: '/military/msAreaCustomPrimitive/delete', |
|
|
|
params: { id: entity.id }, |
|
|
|
}, |
|
|
|
{ isTransformResponse: false, joinParamsToUrl: true } |
|
|
|
) |
|
|
|
.then((response) => { |
|
|
|
if (response.code == 200) { |
|
|
|
let customPrimitiveList = store.customPrimitiveList; |
|
|
|
// console.log("a",customPrimitiveList);
|
|
|
|
customPrimitiveList.forEach((element, index) => { |
|
|
|
const model = window.$earth.getObject(element); |
|
|
|
// console.log("model.id",model.id);
|
|
|
|
// console.log("entity.id",entity.id);
|
|
|
|
if (model.id == entity.id) { |
|
|
|
let customPrimitive = customPrimitiveList.splice(index, 1)[0]; |
|
|
|
model.destroy(); |
|
|
|
} |
|
|
|
}); |
|
|
|
// store.dispatch('asyncCustomPrimitive', customPrimitiveList);
|
|
|
|
store.customPrimitiveList = customPrimitiveList; |
|
|
|
|
|
|
|
// notification.close("RoamVideoSet");
|
|
|
|
// sessionStorage.setItem("RoamVideoSet", "false");
|
|
|
|
} else { |
|
|
|
createMessage.error('修改失败', 2); |
|
|
|
console.error('删除失败', response); |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch((res) => { |
|
|
|
console.error('错误', res); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
{ |
|
|
|
text: '监控视域分析属性', |
|
|
|
func: () => { |
|
|
|
let testConfig = { |
|
|
|
ref: 'testView', |
|
|
|
name: '雷达视域分析', |
|
|
|
position: [1.514482876761954, 0.8497520519403554, -0.7553906497788317], |
|
|
|
rotation: [4.535844766941594, 0.32288591161895097, 0], |
|
|
|
near: 1, |
|
|
|
far: 400, |
|
|
|
fovH: Math.PI / 3, |
|
|
|
fovV: Math.PI / 6, |
|
|
|
show: false, |
|
|
|
}; |
|
|
|
let Viewshed = new window.XE.Obj.Viewshed(window.$earth); |
|
|
|
Viewshed.xbsjFromJSON(testConfig); |
|
|
|
window.$uia.showPropertyWindow(Viewshed); |
|
|
|
}, |
|
|
|
}, |
|
|
|
]); |
|
|
|
} |
|
|
|
//绘画图形
|
|
|
|
else if (typeof pickedFeature !== 'undefined' && entity.name == '绘画') { |
|
|
|
// console.log("entity", entity);
|
|
|
|
window.$uia.contextMenu.pop([ |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
//巡检监控视频
|
|
|
|
else if (typeof pickedFeature !== 'undefined' && entity._name == '视频图元') { |
|
|
|
// console.log(pickedFeature)
|
|
|
|
// console.log("entity",entity)
|
|
|
|
window.$uia.contextMenu.pop([ |
|
|
|
{ |
|
|
|
text: '编辑', |
|
|
|
func: () => { |
|
|
|
$mitt.emit('addRoamPathVideoClose'); |
|
|
|
// store.commit('customPrimitive', entity.xbsjGuid);
|
|
|
|
store.customPrimitive = entity.xbsjGuid; |
|
|
|
// 打开对应的创建巡检视频窗口
|
|
|
|
nextTick(() => { |
|
|
|
that.addRoamVideoShow = true; |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
text: '删除', |
|
|
|
func: () => { |
|
|
|
window.$uia.confirm('确认删除?', () => { |
|
|
|
defHttp |
|
|
|
.delete( |
|
|
|
{ |
|
|
|
text: '编辑', |
|
|
|
func: () => { |
|
|
|
window.$uia.showPropertyWindow(entity); |
|
|
|
//记录编辑前信息
|
|
|
|
let oldEntity = { |
|
|
|
depthTest: entity.depthTest, //深度检测
|
|
|
|
color: [...entity.color], //颜色
|
|
|
|
outline: { |
|
|
|
color: [...entity.outline.color], //边框颜色
|
|
|
|
show: entity.outline.show, //边框显示
|
|
|
|
width: entity.outline.width, //边框宽度
|
|
|
|
}, |
|
|
|
positions: [...entity.positions], |
|
|
|
}; |
|
|
|
nextTick(() => { |
|
|
|
// 主要ui窗口
|
|
|
|
const mainUI = window.$uia._vm.$refs.mainUI; |
|
|
|
// 所有打开的ui窗口Ref值
|
|
|
|
const windowsAttrList = Object.keys(mainUI.$refs); |
|
|
|
// 寻找当前窗体的工具对象
|
|
|
|
const modelToolKey = windowsAttrList.filter((f) => f.indexOf(entity.guid) > -1)[0]; |
|
|
|
const modelTool = mainUI.$refs[modelToolKey][0]; |
|
|
|
// 当前窗体的元素
|
|
|
|
const el = modelTool.$el; |
|
|
|
// this.cloneEl(el)
|
|
|
|
// 样式
|
|
|
|
el.style.width = '380px'; //宽度
|
|
|
|
el.children[2].style.padding = '0px'; |
|
|
|
el.children[2].style.transition = 'none'; |
|
|
|
el.children[2].children[0].children[0].style.minWidth = '370px'; |
|
|
|
// 关闭名称input
|
|
|
|
el.children[2].children[0].children[0].children[0].style.display = 'none'; |
|
|
|
// 关闭创建按钮
|
|
|
|
el.children[2].children[0].children[0].children[1].children[0].children[1].style.display = 'none'; |
|
|
|
// 关闭贴地
|
|
|
|
el.children[2].children[0].children[0].children[2].children[0].style.display = 'none'; |
|
|
|
// 关闭拉伸
|
|
|
|
el.children[2].children[0].children[0].children[3].children[0].style.display = 'none'; |
|
|
|
el.children[2].children[0].children[0].children[3].children[1].style.display = 'none'; |
|
|
|
el.children[2].children[0].children[0].children[3].children[2].style.display = 'none'; |
|
|
|
el.children[2].children[0].children[0].children[3].children[3].style.marginLeft = '8px'; |
|
|
|
// 右上角关闭
|
|
|
|
const cancelTopRightBtn = el.children[1].children[1]; |
|
|
|
// 取消按钮元素
|
|
|
|
const cancelBtn = el.children[3].children[0]; |
|
|
|
// 确认按钮元素
|
|
|
|
const okBtn = el.children[3].children[1]; |
|
|
|
// 取消按钮
|
|
|
|
cancelTopRightBtn.onclick = cancelBtn.onclick = function () { |
|
|
|
//恢复原来设置
|
|
|
|
// console.log("oldEntity", oldEntity);
|
|
|
|
// console.log("entity", entity);
|
|
|
|
// entity.xbsjFromJSON(oldEntity)
|
|
|
|
// entity = JSON.parse(oldEntity)
|
|
|
|
entity.depthTest = oldEntity.depthTest; |
|
|
|
entity.color = oldEntity.color; |
|
|
|
entity.outline = oldEntity.outline; |
|
|
|
entity.positions = oldEntity.positions; |
|
|
|
entity.editing = false; |
|
|
|
}; |
|
|
|
okBtn.onclick = function () { |
|
|
|
let params = { |
|
|
|
id: entity.customProp?.id, |
|
|
|
drawData: JSON.stringify(entity), |
|
|
|
}; |
|
|
|
// console.log("submit", entity);
|
|
|
|
defHttp |
|
|
|
.post( |
|
|
|
{ |
|
|
|
url: '/military/dtMapDraw/edit', |
|
|
|
params: params, |
|
|
|
}, |
|
|
|
{ isTransformResponse: false } |
|
|
|
) |
|
|
|
.then(() => { |
|
|
|
createMessage.success('编辑成功', 2); |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
createMessage.error('编辑失败', 2); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}); |
|
|
|
}, |
|
|
|
url: '/military/msAreaCustomPrimitive/delete', |
|
|
|
params: { id: entity.id }, |
|
|
|
}, |
|
|
|
{ isTransformResponse: false, joinParamsToUrl: true } |
|
|
|
) |
|
|
|
.then((response) => { |
|
|
|
if (response.code == 200) { |
|
|
|
let customPrimitiveList = store.customPrimitiveList; |
|
|
|
// console.log("a",customPrimitiveList);
|
|
|
|
customPrimitiveList.forEach((element, index) => { |
|
|
|
const model = window.$earth.getObject(element); |
|
|
|
// console.log("model.id",model.id);
|
|
|
|
// console.log("entity.id",entity.id);
|
|
|
|
if (model.id == entity.id) { |
|
|
|
let customPrimitive = customPrimitiveList.splice(index, 1)[0]; |
|
|
|
model.destroy(); |
|
|
|
} |
|
|
|
}); |
|
|
|
// store.dispatch('asyncCustomPrimitive', customPrimitiveList);
|
|
|
|
store.customPrimitiveList = customPrimitiveList; |
|
|
|
|
|
|
|
// notification.close("RoamVideoSet");
|
|
|
|
// sessionStorage.setItem("RoamVideoSet", "false");
|
|
|
|
} else { |
|
|
|
createMessage.error('修改失败', 2); |
|
|
|
console.error('删除失败', response); |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch((res) => { |
|
|
|
console.error('错误', res); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
]); |
|
|
|
} |
|
|
|
//绘画图形
|
|
|
|
else if (typeof pickedFeature !== 'undefined' && entity.name == '绘画') { |
|
|
|
// console.log("entity", entity);
|
|
|
|
window.$uia.contextMenu.pop([ |
|
|
|
{ |
|
|
|
text: '编辑', |
|
|
|
func: () => { |
|
|
|
window.$uia.showPropertyWindow(entity); |
|
|
|
//记录编辑前信息
|
|
|
|
let oldEntity = { |
|
|
|
depthTest: entity.depthTest, //深度检测
|
|
|
|
color: [...entity.color], //颜色
|
|
|
|
outline: { |
|
|
|
color: [...entity.outline.color], //边框颜色
|
|
|
|
show: entity.outline.show, //边框显示
|
|
|
|
width: entity.outline.width, //边框宽度
|
|
|
|
}, |
|
|
|
positions: [...entity.positions], |
|
|
|
}; |
|
|
|
nextTick(() => { |
|
|
|
// 主要ui窗口
|
|
|
|
const mainUI = window.$uia._vm.$refs.mainUI; |
|
|
|
// 所有打开的ui窗口Ref值
|
|
|
|
const windowsAttrList = Object.keys(mainUI.$refs); |
|
|
|
// 寻找当前窗体的工具对象
|
|
|
|
const modelToolKey = windowsAttrList.filter((f) => f.indexOf(entity.guid) > -1)[0]; |
|
|
|
const modelTool = mainUI.$refs[modelToolKey][0]; |
|
|
|
// 当前窗体的元素
|
|
|
|
const el = modelTool.$el; |
|
|
|
// this.cloneEl(el)
|
|
|
|
// 样式
|
|
|
|
el.style.width = '380px'; //宽度
|
|
|
|
el.children[2].style.padding = '0px'; |
|
|
|
el.children[2].style.transition = 'none'; |
|
|
|
el.children[2].children[0].children[0].style.minWidth = '370px'; |
|
|
|
// 关闭名称input
|
|
|
|
el.children[2].children[0].children[0].children[0].style.display = 'none'; |
|
|
|
// 关闭创建按钮
|
|
|
|
el.children[2].children[0].children[0].children[1].children[0].children[1].style.display = 'none'; |
|
|
|
// 关闭贴地
|
|
|
|
el.children[2].children[0].children[0].children[2].children[0].style.display = 'none'; |
|
|
|
// 关闭拉伸
|
|
|
|
el.children[2].children[0].children[0].children[3].children[0].style.display = 'none'; |
|
|
|
el.children[2].children[0].children[0].children[3].children[1].style.display = 'none'; |
|
|
|
el.children[2].children[0].children[0].children[3].children[2].style.display = 'none'; |
|
|
|
el.children[2].children[0].children[0].children[3].children[3].style.marginLeft = '8px'; |
|
|
|
// 右上角关闭
|
|
|
|
const cancelTopRightBtn = el.children[1].children[1]; |
|
|
|
// 取消按钮元素
|
|
|
|
const cancelBtn = el.children[3].children[0]; |
|
|
|
// 确认按钮元素
|
|
|
|
const okBtn = el.children[3].children[1]; |
|
|
|
// 取消按钮
|
|
|
|
cancelTopRightBtn.onclick = cancelBtn.onclick = function () { |
|
|
|
//恢复原来设置
|
|
|
|
// console.log("oldEntity", oldEntity);
|
|
|
|
// console.log("entity", entity);
|
|
|
|
// entity.xbsjFromJSON(oldEntity)
|
|
|
|
// entity = JSON.parse(oldEntity)
|
|
|
|
entity.depthTest = oldEntity.depthTest; |
|
|
|
entity.color = oldEntity.color; |
|
|
|
entity.outline = oldEntity.outline; |
|
|
|
entity.positions = oldEntity.positions; |
|
|
|
entity.editing = false; |
|
|
|
}; |
|
|
|
okBtn.onclick = function () { |
|
|
|
let params = { |
|
|
|
id: entity.customProp?.id, |
|
|
|
drawData: JSON.stringify(entity), |
|
|
|
}; |
|
|
|
// console.log("submit", entity);
|
|
|
|
defHttp |
|
|
|
.post( |
|
|
|
{ |
|
|
|
url: '/military/dtMapDraw/edit', |
|
|
|
params: params, |
|
|
|
}, |
|
|
|
{ isTransformResponse: false } |
|
|
|
) |
|
|
|
.then(() => { |
|
|
|
createMessage.success('编辑成功', 2); |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
createMessage.error('编辑失败', 2); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
text: '删除', |
|
|
|
func: () => { |
|
|
|
window.$uia.confirm('确认删除?', () => { |
|
|
|
defHttp |
|
|
|
.delete( |
|
|
|
{ |
|
|
|
text: '删除', |
|
|
|
func: () => { |
|
|
|
window.$uia.confirm('确认删除?', () => { |
|
|
|
defHttp |
|
|
|
.delete( |
|
|
|
{ |
|
|
|
url: '/military/dtMapDraw/delete', |
|
|
|
params: { id: entity.customProp?.id }, |
|
|
|
}, |
|
|
|
{ isTransformResponse: false, joinParamsToUrl: true } |
|
|
|
) |
|
|
|
.then((response) => { |
|
|
|
if (response.code == 200) { |
|
|
|
let shapeList = store.shapeList; |
|
|
|
shapeList.forEach((element, index) => { |
|
|
|
const model = window.$earth.getObject(element); |
|
|
|
if (model.id == entity.customProp?.id) { |
|
|
|
let shape = shapeList.splice(index, 1)[0]; |
|
|
|
model.destroy(); |
|
|
|
} |
|
|
|
}); |
|
|
|
store.shapeList = shapeList; |
|
|
|
} else { |
|
|
|
createMessage.error('删除失败', 2); |
|
|
|
console.error('删除失败', response); |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch((res) => { |
|
|
|
console.error('错误', res); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
url: '/military/dtMapDraw/delete', |
|
|
|
params: { id: entity.customProp?.id }, |
|
|
|
}, |
|
|
|
]); |
|
|
|
} |
|
|
|
}, window.Cesium.ScreenSpaceEventType.RIGHT_CLICK); //右键事件
|
|
|
|
} |
|
|
|
/* picked事件 */ |
|
|
|
{ |
|
|
|
/* let canvasbox = window.$viewer.canvas, pickPosition = {}, cameraModal = this.$refs.cameraModal;//操作cameraModal组件 |
|
|
|
{ isTransformResponse: false, joinParamsToUrl: true } |
|
|
|
) |
|
|
|
.then((response) => { |
|
|
|
if (response.code == 200) { |
|
|
|
let shapeList = store.shapeList; |
|
|
|
shapeList.forEach((element, index) => { |
|
|
|
const model = window.$earth.getObject(element); |
|
|
|
if (model.id == entity.customProp?.id) { |
|
|
|
let shape = shapeList.splice(index, 1)[0]; |
|
|
|
model.destroy(); |
|
|
|
} |
|
|
|
}); |
|
|
|
store.shapeList = shapeList; |
|
|
|
} else { |
|
|
|
createMessage.error('删除失败', 2); |
|
|
|
console.error('删除失败', response); |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch((res) => { |
|
|
|
console.error('错误', res); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
]); |
|
|
|
} |
|
|
|
}, window.Cesium.ScreenSpaceEventType.RIGHT_CLICK); //右键事件
|
|
|
|
} |
|
|
|
/* picked事件 */ |
|
|
|
{ |
|
|
|
/* let canvasbox = window.$viewer.canvas, pickPosition = {}, cameraModal = this.$refs.cameraModal;//操作cameraModal组件 |
|
|
|
canvasbox.onclick = e => { |
|
|
|
pickPosition.x = e.offsetX; |
|
|
|
pickPosition.y = e.offsetY; |
|
|
@ -433,5 +432,5 @@ export default function listenMouseHandler(that) { |
|
|
|
that.cameraModalShow = false; |
|
|
|
} |
|
|
|
} */ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|