| | |
| | | const suddenlyEdit = ref(false) |
| | | const processList = ref([]) |
| | | let viewPlane |
| | | let allDeviceList = [] |
| | | const hasPatrolTaskList = computed(() => ['30', '40', '50', '60'].includes(String(formData.value.workOrderStatus))) |
| | | |
| | | const gdStatusObj = { |
| | |
| | | |
| | | // 新增模式绘制 |
| | | function addPolygon() { |
| | | drawPolygonExample = new DrawPolygon(viewer) |
| | | drawPolygonExample = new DrawPolygon({ deviceList: allDeviceList }) |
| | | drawPolygonExample.initHandler(viewer) |
| | | drawPolygonExample.subscribe('getPolygonPositions', drawFinished) |
| | | } |
| | |
| | | if (!formData.value?.geom) return |
| | | pointList.value = geomAnalysis(formData.value.geom) |
| | | drawPolygonExample?.destroy() |
| | | drawPolygonExample = new DrawPolygon(viewer) |
| | | drawPolygonExample = new DrawPolygon({ deviceList: allDeviceList }) |
| | | let noClosedList = _.cloneDeep(pointList.value) |
| | | noClosedList.pop() |
| | | drawPolygonExample.initPolygon( |
| | |
| | | }) |
| | | } |
| | | |
| | | // 生成圆形坐标点 |
| | | function buildCirclePositions(center, radius, segments = 120) { |
| | | const cartographic = Cesium.Cartographic.fromCartesian(center) |
| | | const positions = [] |
| | | for (let i = 0; i < segments; i++) { |
| | | const angle = (i / segments) * 2 * Math.PI |
| | | const lat = cartographic.latitude + (radius / 6378137) * Math.cos(angle) |
| | | const lon = cartographic.longitude + (radius / (6378137 * Math.cos(cartographic.latitude))) * Math.sin(angle) |
| | | positions.push(Cesium.Cartesian3.fromRadians(lon, lat)) |
| | | } |
| | | return positions |
| | | } |
| | | |
| | | // 渲染 |
| | | function renderingAllDevice(list) { |
| | | list.forEach(item => { |
| | |
| | | pixelOffset: new Cesium.Cartesian2(0, -20), |
| | | }, |
| | | }) |
| | | // 覆盖范围 - 5km圆形区域 |
| | | viewer.entities.add({ |
| | | position: position, |
| | | ellipse: { |
| | | semiMajorAxis: 5000, |
| | | semiMinorAxis: 5000, |
| | | material: Cesium.Color.fromBytes(45, 140, 240, 80), |
| | | outline: false, |
| | | heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, |
| | | }, |
| | | }) |
| | | // 覆盖范围描边线 - 贴地 |
| | | const circlePositions = buildCirclePositions(position, 5000) |
| | | viewer.entities.add({ |
| | | polyline: { |
| | | positions: [...circlePositions, circlePositions[0]], |
| | | clampToGround: true, |
| | | width: 2, |
| | | material: Cesium.Color.fromBytes(45, 140, 240, 255), |
| | | }, |
| | | }) |
| | | }) |
| | | } |
| | | |
| | |
| | | initMap() |
| | | const allDeviceRes = await gdManageDeviceListApi() |
| | | formData.value = dialogMode.value === 'add' ? initForm() : row |
| | | renderingAllDevice(allDeviceRes?.data?.data || []) |
| | | allDeviceList = allDeviceRes?.data?.data || [] |
| | | renderingAllDevice(allDeviceList) |
| | | if (dialogMode.value === 'add') { |
| | | addPolygon() |
| | | } else { |