fireControl.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //火灾 控制类
  2. import vtkUnstructuredDataReader from "../reader/UnstructuredDataReader.js";
  3. export class fireControl {
  4. constructor(){
  5. //事故编号
  6. this.aid=5 ;
  7. //当前步数
  8. this.step;
  9. //总步数
  10. this.stepsum=10;
  11. //url
  12. this._url =import.meta.env.VITE_BASE_URL+"/TransServlet?channelNo=service&clientToken=e47b87eec69545559d1e81e56626da68&userId=5f06c8bc77234f969d13e160b54c27e3&aid=";
  13. //几何数据
  14. this.polydata;
  15. //Scalars 数据 array[setp]=Map(scalars,value[points]=array),
  16. this.scalars=new Array();
  17. this.scalar=new Map();
  18. this.reader =vtkUnstructuredDataReader.newInstance();
  19. }
  20. //几何数据初始化
  21. async initGemetry() {
  22. const url =this._url+this.aid+"&transCode=D000014";
  23. await this.reader.setUrl(url).then(() => {
  24. this.polydata= this.reader.getOutputData(0);
  25. });
  26. }
  27. //标量数据初始化
  28. async initScalrs(){
  29. for (let index = 0; index <= this.stepsum; index++) {
  30. await this.reader.setUrl(this._url+"&transCode=D00009&step="+ index ).then(() => {
  31. const scalarMap = this.reader.getOutputData(1);
  32. this.scalars.push(scalarMap);
  33. });
  34. }
  35. }
  36. //获取第几步标量数据
  37. async getScalrsByStep(step){
  38. this.step =step;
  39. const url =this._url+this.aid+"&transCode=D00009&step="+ this.step;
  40. await this.reader.setUrl(url).then(() => {
  41. const scalarMap = this.reader.getOutputData(1);
  42. this.scalar=scalarMap;
  43. });
  44. }
  45. }
  46. export function createFireControl(){
  47. return new fireControl();
  48. }