|  | @@ -15,6 +15,7 @@ import { formatDefaultLocale } from 'd3-format';
 | 
											
												
													
														|  |  import { ref,onMounted } from 'vue';
 |  |  import { ref,onMounted } from 'vue';
 | 
											
												
													
														|  |  import '@kitware/vtk.js/Rendering/Profiles/Geometry';
 |  |  import '@kitware/vtk.js/Rendering/Profiles/Geometry';
 | 
											
												
													
														|  |  import vtkRenderWindowWithControlBar from '@kitware/vtk.js/Rendering/Misc/RenderWindowWithControlBar';
 |  |  import vtkRenderWindowWithControlBar from '@kitware/vtk.js/Rendering/Misc/RenderWindowWithControlBar';
 | 
											
												
													
														|  | 
 |  | +import vtkFullScreenRenderWindow from '@kitware/vtk.js/Rendering/Misc/FullScreenRenderWindow';
 | 
											
												
													
														|  |  import vtkActor           from '@kitware/vtk.js/Rendering/Core/Actor';
 |  |  import vtkActor           from '@kitware/vtk.js/Rendering/Core/Actor';
 | 
											
												
													
														|  |  import vtkMapper          from '@kitware/vtk.js/Rendering/Core/Mapper';
 |  |  import vtkMapper          from '@kitware/vtk.js/Rendering/Core/Mapper';
 | 
											
												
													
														|  |  import vtkUnstructuredDataReader from '../reader/UnstructuredDataReader.js';
 |  |  import vtkUnstructuredDataReader from '../reader/UnstructuredDataReader.js';
 | 
											
										
											
												
													
														|  | @@ -23,11 +24,14 @@ import vtkLookupTable from '@kitware/vtk.js/Common/Core/LookupTable';
 | 
											
												
													
														|  |  import vtkDataArray from '@kitware/vtk.js/Common/Core/DataArray.js';
 |  |  import vtkDataArray from '@kitware/vtk.js/Common/Core/DataArray.js';
 | 
											
												
													
														|  |  import vtkColorTransferFunction from '@kitware/vtk.js/Rendering/Core/ColorTransferFunction';
 |  |  import vtkColorTransferFunction from '@kitware/vtk.js/Rendering/Core/ColorTransferFunction';
 | 
											
												
													
														|  |  // 响应式状态
 |  |  // 响应式状态
 | 
											
												
													
														|  | -const count = ref(0);
 |  | 
 | 
											
												
													
														|  | 
 |  | +const count = ref(0);//步数
 | 
											
												
													
														|  |  const opacity = ref(0.1);
 |  |  const opacity = ref(0.1);
 | 
											
												
													
														|  |  const min=ref(0.0);
 |  |  const min=ref(0.0);
 | 
											
												
													
														|  |  const max=ref(1.0);
 |  |  const max=ref(1.0);
 | 
											
												
													
														|  | -const scalarAll = ref([]);
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +const scalarFAll = ref([]);//火灾标量
 | 
											
												
													
														|  | 
 |  | +const scalarWAll = ref([]);//水灾标量
 | 
											
												
													
														|  | 
 |  | +const foW =ref(false);//火灾 true  水灾 false
 | 
											
												
													
														|  |  /*
 |  |  /*
 | 
											
												
													
														|  |    Temperature:温度
 |  |    Temperature:温度
 | 
											
												
													
														|  |    Pressure:压强
 |  |    Pressure:压强
 | 
											
										
											
												
													
														|  | @@ -35,15 +39,16 @@ const scalarAll = ref([]);
 | 
											
												
													
														|  |    CO2:CO2
 |  |    CO2:CO2
 | 
											
												
													
														|  |    Height:水位高度
 |  |    Height:水位高度
 | 
											
												
													
														|  |  */
 |  |  */
 | 
											
												
													
														|  | -const scalarName = ref("SO2");
 |  | 
 | 
											
												
													
														|  | -const filedir =ref("data/Fire/");
 |  | 
 | 
											
												
													
														|  | -// const scalarName = ref("Height");
 |  | 
 | 
											
												
													
														|  | -// const filedir =ref("data/Water/");
 |  | 
 | 
											
												
													
														|  | 
 |  | +// const scalarName = ref("SO2");
 | 
											
												
													
														|  | 
 |  | +// const filedir =ref("data/Fire/");
 | 
											
												
													
														|  | 
 |  | +const scalarName = ref("Height");
 | 
											
												
													
														|  | 
 |  | +const filedir =ref("data/Water/");
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  const renderWindowWith = vtkRenderWindowWithControlBar.newInstance({
 |  |  const renderWindowWith = vtkRenderWindowWithControlBar.newInstance({
 | 
											
												
													
														|  |      controlSize: 2,
 |  |      controlSize: 2,
 | 
											
												
													
														|  |    });
 |  |    });
 | 
											
												
													
														|  | 
 |  | +// const renderWindowWith =vtkFullScreenRenderWindow.newInstance();
 | 
											
												
													
														|  |  const renderer = renderWindowWith.getRenderer();
 |  |  const renderer = renderWindowWith.getRenderer();
 | 
											
												
													
														|  |  // renderer.setBackground([0.1,0.2,0]); 
 |  |  // renderer.setBackground([0.1,0.2,0]); 
 | 
											
												
													
														|  |  const renderWindow = renderWindowWith.getRenderWindow();
 |  |  const renderWindow = renderWindowWith.getRenderWindow();
 | 
											
										
											
												
													
														|  | @@ -80,7 +85,12 @@ function getMinMax(scalars){
 | 
											
												
													
														|  |  // 用来修改状态、触发更新的函数
 |  |  // 用来修改状态、触发更新的函数
 | 
											
												
													
														|  |  function increment() {
 |  |  function increment() {
 | 
											
												
													
														|  |    count.value++;
 |  |    count.value++;
 | 
											
												
													
														|  | -  const scalars=scalarAll.value[count.value];
 |  | 
 | 
											
												
													
														|  | 
 |  | +  var scalars;
 | 
											
												
													
														|  | 
 |  | +  if(foW.value){
 | 
											
												
													
														|  | 
 |  | +       scalars=scalarFAll.value[count.value];
 | 
											
												
													
														|  | 
 |  | +  }else{
 | 
											
												
													
														|  | 
 |  | +       scalars=scalarWAll.value[count.value];
 | 
											
												
													
														|  | 
 |  | +  }
 | 
											
												
													
														|  |    const polydata = mapper.getInputData();      
 |  |    const polydata = mapper.getInputData();      
 | 
											
												
													
														|  |    const scalarArray=scalars.get(scalarName.value);
 |  |    const scalarArray=scalars.get(scalarName.value);
 | 
											
												
													
														|  |    // console.log("scalarArray:",scalarArray);
 |  |    // console.log("scalarArray:",scalarArray);
 | 
											
										
											
												
													
														|  | @@ -97,11 +107,20 @@ function increment() {
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  //加载所有 标量数据
 |  |  //加载所有 标量数据
 | 
											
												
													
														|  |  function loadScalarAll(){
 |  |  function loadScalarAll(){
 | 
											
												
													
														|  | 
 |  | +  //水灾
 | 
											
												
													
														|  |   for (let index = 0; index <= 60; index++) {
 |  |   for (let index = 0; index <= 60; index++) {
 | 
											
												
													
														|  |      const reader = vtkUnstructuredDataReader.newInstance();
 |  |      const reader = vtkUnstructuredDataReader.newInstance();
 | 
											
												
													
														|  | -    reader.setUrl(filedir.value+'POST'+index+'.vtk').then(() => {
 |  | 
 | 
											
												
													
														|  | 
 |  | +    reader.setUrl("data/Water/"+'POST'+index+'.vtk').then(() => {
 | 
											
												
													
														|  |      const scalars = reader.getOutputData(1);
 |  |      const scalars = reader.getOutputData(1);
 | 
											
												
													
														|  | -    scalarAll.value[index]=scalars;
 |  | 
 | 
											
												
													
														|  | 
 |  | +    scalarWAll.value[index]=scalars;
 | 
											
												
													
														|  | 
 |  | +    });
 | 
											
												
													
														|  | 
 |  | +  }
 | 
											
												
													
														|  | 
 |  | +  //火灾
 | 
											
												
													
														|  | 
 |  | +  for (let index = 0; index <= 60; index++) {
 | 
											
												
													
														|  | 
 |  | +    const reader = vtkUnstructuredDataReader.newInstance();
 | 
											
												
													
														|  | 
 |  | +    reader.setUrl("data/Fire/"+'POST'+index+'.vtk').then(() => {
 | 
											
												
													
														|  | 
 |  | +    const scalars = reader.getOutputData(1);
 | 
											
												
													
														|  | 
 |  | +    scalarFAll.value[index]=scalars;
 | 
											
												
													
														|  |      });
 |  |      });
 | 
											
												
													
														|  |    }
 |  |    }
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
										
											
												
													
														|  | @@ -178,10 +197,10 @@ onMounted(() => {
 | 
											
												
													
														|  |      ctf.addRGBPoint(3.0, 1.0, 0.5, 0.0);
 |  |      ctf.addRGBPoint(3.0, 1.0, 0.5, 0.0);
 | 
											
												
													
														|  |      ctf.addRGBPoint(4.0, 1.0, 0.0, 0.0);
 |  |      ctf.addRGBPoint(4.0, 1.0, 0.0, 0.0);
 | 
											
												
													
														|  |      mapper.setLookupTable(ctf);
 |  |      mapper.setLookupTable(ctf);
 | 
											
												
													
														|  | -    lut = mapper.getLookupTable();
 |  | 
 | 
											
												
													
														|  | -    scalarBarActor.setScalarsToColors(lut);
 |  | 
 | 
											
												
													
														|  | 
 |  | +    // lut = mapper.getLookupTable();
 | 
											
												
													
														|  | 
 |  | +    // scalarBarActor.setScalarsToColors(lut);
 | 
											
												
													
														|  |      resetCamera();
 |  |      resetCamera();
 | 
											
												
													
														|  | -    render();
 |  | 
 | 
											
												
													
														|  | 
 |  | +   renderWindow.render();
 | 
											
												
													
														|  |    });
 |  |    });
 | 
											
												
													
														|  |    loadScalarAll();
 |  |    loadScalarAll();
 | 
											
												
													
														|  |  });
 |  |  });
 |