|  | @@ -67,6 +67,7 @@ import ColorCardDialog from "./dialog/ColorCardDialog.vue"
 | 
	
		
			
				|  |  |  import ContourDialog from "./dialog/ContourDialog.vue"
 | 
	
		
			
				|  |  |  import cloudChart from "@/views/threejsView/index.vue" // 云图
 | 
	
		
			
				|  |  |  import h5wasm from 'h5wasm'
 | 
	
		
			
				|  |  | +import { usePltDataStore } from '@/store/modules/pltData'
 | 
	
		
			
				|  |  |  const props = defineProps({
 | 
	
		
			
				|  |  |    modelValue: {
 | 
	
		
			
				|  |  |      type: Boolean,
 | 
	
	
		
			
				|  | @@ -208,10 +209,9 @@ const getPltData = async (fpid) => {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  // HDF5转Three.js格式的解析器
 | 
	
		
			
				|  |  |  const parseHDF5ToThreeJS = (h5file) => {
 | 
	
		
			
				|  |  | +  const pltStore = usePltDataStore()
 | 
	
		
			
				|  |  |    const result = {
 | 
	
		
			
				|  |  | -    "data" : {
 | 
	
		
			
				|  |  | -      "datasetType": "plt",
 | 
	
		
			
				|  |  | -    },
 | 
	
		
			
				|  |  | +    "data": { "datasetType": "plt" },
 | 
	
		
			
				|  |  |      metadata: {
 | 
	
		
			
				|  |  |        title: h5file.attrs.title?.value || '',
 | 
	
		
			
				|  |  |        variables: JSON.parse(h5file.attrs.variables?.value || "[]"),
 | 
	
	
		
			
				|  | @@ -219,25 +219,21 @@ const parseHDF5ToThreeJS = (h5file) => {
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      zones: []
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  | +  const zones = []
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  // 新版h5wasm数据提取方法
 | 
	
		
			
				|  |  | +  // 增强型数据提取方法
 | 
	
		
			
				|  |  |    const extractDataset = (group, name) => {
 | 
	
		
			
				|  |  |      try {
 | 
	
		
			
				|  |  | -      // 方法1:直接访问
 | 
	
		
			
				|  |  | -      if (group[name] && group[name].value) {
 | 
	
		
			
				|  |  | -        return group[name].value
 | 
	
		
			
				|  |  | -      }
 | 
	
		
			
				|  |  | +      // 尝试多种访问方式
 | 
	
		
			
				|  |  | +      const dataset = group.get?.(name) ||  // 方法1: get()
 | 
	
		
			
				|  |  | +                     group[name]?.value ||  // 方法2: 直接访问
 | 
	
		
			
				|  |  | +                     Object.entries(group).find(([k]) => k === name)?.[1]?.value // 方法3: 遍历查找
 | 
	
		
			
				|  |  |        
 | 
	
		
			
				|  |  | -      // 方法2:遍历entries
 | 
	
		
			
				|  |  | -      for (const [key, obj] of Object.entries(group)) {
 | 
	
		
			
				|  |  | -        if (key === name && obj?.value) {
 | 
	
		
			
				|  |  | -          return obj.value
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | +      // 特殊处理数组类型数据
 | 
	
		
			
				|  |  | +      if (dataset && typeof dataset === 'object' && 'value' in dataset) {
 | 
	
		
			
				|  |  | +        return dataset.value
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  | -      
 | 
	
		
			
				|  |  | -      // 方法3:get方法
 | 
	
		
			
				|  |  | -      const dataset = group.get?.(name)
 | 
	
		
			
				|  |  | -      return dataset?.value
 | 
	
		
			
				|  |  | +      return dataset
 | 
	
		
			
				|  |  |      } catch (e) {
 | 
	
		
			
				|  |  |        console.warn(`提取 ${name} 失败:`, e)
 | 
	
		
			
				|  |  |        return null
 | 
	
	
		
			
				|  | @@ -246,26 +242,34 @@ const parseHDF5ToThreeJS = (h5file) => {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    // 处理每个区域
 | 
	
		
			
				|  |  |    for (const zoneKey of h5file.keys()) {
 | 
	
		
			
				|  |  | -    if (!zoneKey.startsWith('zone_')) continue
 | 
	
		
			
				|  |  | +    try {
 | 
	
		
			
				|  |  | +      // 正确获取组对象
 | 
	
		
			
				|  |  | +      const zone = h5file.get(zoneKey)
 | 
	
		
			
				|  |  | +      if (!zone || typeof zone !== 'object') continue
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    const zone = h5file[zoneKey] || h5file.get(zoneKey)
 | 
	
		
			
				|  |  | -    console.log(`处理 ${zoneKey}:`, zone)
 | 
	
		
			
				|  |  | +      console.log(`处理 ${zoneKey}:`, zone)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    const zoneData = {
 | 
	
		
			
				|  |  | -      name: zoneKey,
 | 
	
		
			
				|  |  | -      vertices: extractDataset(zone, 'vertices'),
 | 
	
		
			
				|  |  | -      indices: extractDataset(zone, 'indices'),
 | 
	
		
			
				|  |  | -      variables: {}
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | +      const zoneData = {
 | 
	
		
			
				|  |  | +        name: zoneKey.replace(/^zone_\d+_/, ''), // 去除可能的zone_前缀
 | 
	
		
			
				|  |  | +        vertices: extractDataset(zone, 'vertices'),
 | 
	
		
			
				|  |  | +        indices: extractDataset(zone, 'indices'),
 | 
	
		
			
				|  |  | +        variables: {}
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    // 提取变量数据
 | 
	
		
			
				|  |  | -    result.metadata.variables.forEach(varName => {
 | 
	
		
			
				|  |  | -      zoneData.variables[varName] = extractDataset(zone, `var_${varName}`)
 | 
	
		
			
				|  |  | -    })
 | 
	
		
			
				|  |  | +      // 提取变量数据
 | 
	
		
			
				|  |  | +      result.metadata.variables.forEach(varName => {
 | 
	
		
			
				|  |  | +        const data = extractDataset(zone, `var_${varName}`)
 | 
	
		
			
				|  |  | +        if (data) zoneData.variables[varName] = data
 | 
	
		
			
				|  |  | +      })
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    result.zones.push(zoneData)
 | 
	
		
			
				|  |  | +      zones.push(zoneData)
 | 
	
		
			
				|  |  | +    } catch (e) {
 | 
	
		
			
				|  |  | +      console.warn(`处理区域 ${zoneKey} 时出错:`, e)
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +  pltStore.setZones(zones)
 | 
	
		
			
				|  |  | +  result.zones = zones
 | 
	
		
			
				|  |  |    console.log('最终解析结果:', result)
 | 
	
		
			
				|  |  |    return result
 | 
	
		
			
				|  |  |  }
 |