diff --git a/web/src/components/trajectory/imggui.vue b/web/src/components/trajectory/imggui.vue index c2fcf58..da6951e 100644 --- a/web/src/components/trajectory/imggui.vue +++ b/web/src/components/trajectory/imggui.vue @@ -4,14 +4,10 @@ - + - + @@ -24,17 +20,17 @@ import * as d3 from 'd3' // === Props 定义 === const props = defineProps({ imageUrl: { type: String, required: true }, - bounds: { + bounds: { type: Array, required: true, default: () => [0, 0, 1, 1] // [minLng, minLat, maxLng, maxLat] }, - trajectory: { + trajectory: { type: Array, required: true, default: () => [] }, - qvehuan: { + qvehuan: { type: Boolean, default: false } @@ -64,13 +60,13 @@ const initMap = () => { svgWidth.value = container.clientWidth svgHeight.value = container.clientHeight } - + const [minLng, minLat, maxLng, maxLat] = props.bounds - + xScale.value = d3.scaleLinear() .domain([minLng, maxLng]) .range([0, svgWidth.value]) - + yScale.value = d3.scaleLinear() .domain([minLat, maxLat]) .range([svgHeight.value, 0]) @@ -83,7 +79,7 @@ const initMap = () => { const initZoom = () => { const mapZoom = d3.zoom() .scaleExtent([0.5, 3]) // 缩放范围 - .translateExtent([[-svgWidth.value, -svgHeight.value], [2*svgWidth.value, 2*svgHeight.value]]) + .translateExtent([[-svgWidth.value, -svgHeight.value], [2 * svgWidth.value, 2 * svgHeight.value]]) .on("zoom", (event) => { d3.select(svgRef.value).select('.zoom-container') .attr("transform", event.transform) @@ -131,10 +127,10 @@ const renderTrajectoryPath = () => { .attr('stroke', '#1890FF') .attr('stroke-width', 2.5) .attr('fill', 'none') - .attr('stroke-dasharray', function() { + .attr('stroke-dasharray', function () { return this.getTotalLength() }) - .attr('stroke-dashoffset', function() { + .attr('stroke-dashoffset', function () { return this.getTotalLength() }) .transition() @@ -152,7 +148,7 @@ const renderTrajectoryMarkers = () => { props.trajectory.forEach(([lng, lat], index) => { const x = xScale.value(lng) const y = yScale.value(lat) - + d3.select(svgRef.value).select('.zoom-container') .append('circle') .attr('class', `marker-circle marker-${index}`) @@ -162,12 +158,12 @@ const renderTrajectoryMarkers = () => { .attr('fill', '#FF4D4F') .attr('stroke', '#fff') .attr('stroke-width', 0.8) - .on('mouseover', function() { + .on('mouseover', function () { d3.select(this) .attr('r', 4) .attr('stroke-width', 1.2) }) - .on('mouseout', function() { + .on('mouseout', function () { d3.select(this) .attr('r', 2.5) .attr('stroke-width', 0.8) @@ -216,24 +212,26 @@ const toggleFullscreen = () => { // === 全屏状态更新处理 === const handleFullscreenChange = () => { isFullscreen.value = !!document.fullscreenElement - // 全屏切换时主动清除原有轨迹 clearOldElements() - - // 延迟执行以确保DOM更新 - setTimeout(() => { - initMap() - updateTrajectory() - }, 500) + requestAnimationFrame(() => { + // 延迟执行以确保DOM更新 + setTimeout(() => { + initMap() + updateTrajectory() + }, 500) + }) + } // === 窗口大小变化处理 === const handleResize = () => { if (resizeTimeout) clearTimeout(resizeTimeout) resizeTimeout = setTimeout(() => { + clearOldElements() initMap() updateTrajectory() - }, 300) + },500) } // === 响应式监听与生命周期 === @@ -253,14 +251,14 @@ onMounted(() => { // 添加全屏变化监听 document.addEventListener('fullscreenchange', handleFullscreenChange) window.addEventListener('resize', handleResize) - + // 初始化SVG尺寸 const container = d3.select(svgRef.value).node() if (container) { svgWidth.value = container.clientWidth svgHeight.value = container.clientHeight } - + // 加载图片 const imageElement = d3.select(svgRef.value).select('image') if (imageElement) { diff --git a/web/src/views/testdata/datamanagement/index.vue b/web/src/views/testdata/datamanagement/index.vue index c2e476e..431b753 100644 --- a/web/src/views/testdata/datamanagement/index.vue +++ b/web/src/views/testdata/datamanagement/index.vue @@ -44,6 +44,7 @@ import VideoPlayerAsyncLoading from "@/components/file/preview/VideoPlayerAsyncL import TextViewerAsyncLoading from "@/components/file/preview/TextViewerAsyncLoading.vue"; import MarkdownViewerDialogAsyncLoading from "@/components/file/preview/MarkdownViewerDialogAsyncLoading.vue"; import { display } from "html2canvas/dist/types/css/property-descriptors/display"; +import { getDict } from '@/api/dict' const { dialogVideoVisible, dialogTextVisible, dialogPdfVisible, dialogOfficeVisible, dialog3dVisible } = useFilePreview(); const { clearALlFinishedUploadFile } = useFileUpload(); const { currentStorageKey } = useHeaderStorageList(); @@ -51,6 +52,7 @@ const { openRow } = useFileData(); const userStore = useUserStore(); onMounted(() => { getProject() + getDictOne() }); onBeforeUnmount(() => { @@ -63,6 +65,15 @@ onBeforeUnmount(() => { } }) +const trackFileType = ref([]) +function getDictOne() { + getDict({ dictcode: 'Trajectory_File_Key' }).then((res: any) => { + trackFileType.value = res.data + }) +} +function iftrackFile(name: string): boolean { + return trackFileType.value.some((item: any) => name.includes(item.dictname)); +} //拖动条 const vMove = { mounted(el: any) { @@ -1769,6 +1780,10 @@ function getSSELink() { try { const data = JSON.parse(e.data) console.log('SSE消息:', data) + if(data.message == '配置文件选择错误,请重新选择!'){ + ElMessage.warning(data.message) + return + } if (data) { dynamicCoordinates.value.push([data.lon, data.lat]) if (dynamicCoordinates.value.length > 2) { @@ -1960,7 +1975,8 @@ const configradio: any = ref(null) style="cursor: pointer;"> --> - 取消 -
+