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