| | |
| | | import { ref } from 'vue' |
| | | import { cesiumOperation } from '/@/hooks/use-cesium-tsa' |
| | | import { XMLToJSON } from './kmz' |
| | | import _ from 'lodash' |
| | | import _, { includes } from 'lodash' |
| | | const { addPolyline, getEntityById, removeAllDataSource, removeAllPoint } = cesiumOperation() |
| | | |
| | | const getResource = (name: string) => { |
| | |
| | | icon: getResource('waylinetool/camera-off.png'), |
| | | }, |
| | | { |
| | | key: 'time', |
| | | key: 'multipleTiming', |
| | | name: '开始等时间隔拍照', |
| | | icon: getResource('waylinetool/shoot1.png'), |
| | | }, |
| | | { |
| | | key: 'distance', |
| | | key: 'multipleDistance', |
| | | name: '开始等距间隔拍照', |
| | | icon: getResource('waylinetool/shoot2.png'), |
| | | }, |
| | |
| | | key: 'panoShot', |
| | | name: '全景拍摄', |
| | | icon: getResource('waylinetool/panoramicview.png'), |
| | | } |
| | | }, |
| | | ] |
| | | |
| | | const waylinePointsEvent = ref<tragetPoint[]>([]) |
| | |
| | | } |
| | | const kmlJson = XMLToJSON(kmlRes).Document |
| | | const points = Array.isArray(kmlJson.Folder?.Placemark) ? kmlJson.Folder.Placemark : [kmlJson.Folder.Placemark] |
| | | let takePhotoNum = 0 |
| | | points?.forEach((point: { actionGroup: any }, index: number) => { |
| | | if (point !== undefined) { |
| | | if (Reflect.has(point, 'actionGroup')) { |
| | | const action = point.actionGroup.action |
| | | if (Array.isArray(action)) { |
| | | action.forEach((item) => { |
| | | const { actionActuatorFunc } = item |
| | | actionActuatorFunc?.['#text'] === 'takePhoto' && takePhotoNum++ |
| | | const actionObj: eventParmas | any = actionList.find((event) => actionActuatorFunc['#text'] === event.key) |
| | | waylinePointsEvent.value[index].eventList?.push(actionObj) |
| | | if (Array.isArray(point.actionGroup)) { |
| | | const actionGroups = point.actionGroup |
| | | actionGroups.forEach((actionGroup) => { |
| | | const action = actionGroup.action |
| | | const actionTrigger = actionGroup.actionTrigger |
| | | pointActionShow(action, actionTrigger, index) |
| | | }) |
| | | } else { |
| | | action?.actionActuatorFunc['#text'] === 'takePhoto' && takePhotoNum++ |
| | | const actionObj: eventParmas | any = actionList.find( |
| | | (item) => action?.actionActuatorFunc['#text'] === item.key, |
| | | ) |
| | | waylinePointsEvent.value[index].eventList?.push(actionObj) |
| | | const action = point.actionGroup.action |
| | | const actionTrigger = point.actionGroup.actionTrigger |
| | | pointActionShow(action, actionTrigger, index) |
| | | } |
| | | } |
| | | } |
| | | }) |
| | | waylineDetails[3].value = takePhotoNum |
| | | } |
| | | |
| | | let takePhotoNum = 0 |
| | | const pointActionShow = ( |
| | | action: { forEach: (arg0: (item: any) => void) => void; actionActuatorFunc: { [x: string]: string } }, |
| | | actionTrigger: { actionTriggerType: { [x: string]: string } }, |
| | | index: number, |
| | | ) => { |
| | | if (Array.isArray(action)) { |
| | | action.forEach((item) => { |
| | | const { actionActuatorFunc } = item |
| | | actionActuatorFunc?.['#text'] === 'takePhoto' && takePhotoNum++ |
| | | const actionObj: eventParmas | any = actionList.find((event) => { |
| | | if (actionTrigger?.actionTriggerType['#text'] === event.key) { |
| | | return actionTrigger?.actionTriggerType['#text'] === event.key |
| | | } else { |
| | | return actionActuatorFunc['#text'] === event.key |
| | | } |
| | | }) |
| | | waylinePointsEvent.value[index].eventList?.push(actionObj) |
| | | }) |
| | | } else { |
| | | action?.actionActuatorFunc['#text'] === 'takePhoto' && takePhotoNum++ |
| | | const actionObj: eventParmas | any = actionList.find((item) => { |
| | | const actionTriggerType = actionTrigger.actionTriggerType['#text'] |
| | | if (['multipleDistance', 'multipleTiming'].includes(actionTriggerType)) { |
| | | return actionTriggerType === item.key |
| | | } else { |
| | | return action?.actionActuatorFunc['#text'] === item.key |
| | | } |
| | | }) |
| | | waylinePointsEvent.value[index].eventList?.push(actionObj) |
| | | } |
| | | } |
| | | |
| | | const clearWaylineData = () => { |
| | | kmlEntities.value = [] |
| | | waylinePointsEvent.value = [] |